/* ============================================================================
   Verse AI composer (js/verse-ai-composer.js, js/verse-ai-capture.js). Reference: docs/VERSE-AI-COMPOSER.md.
   Loaded after chat.html's own rules and built on the page's theme variables (--bg-*, --text-*, --border-*,
   --primary-color), so every theme of the page themes the composer too.

   What colour means here:
     orange (--vac-studio, Verse Studio's own accent)  the prompt goes to Verse Studio and costs VXT
     the page's primary colour                         it goes to the AI with research
     violet (--vac-build)                              Build mode
     red (--vac-rec)                                   the microphone or camera is recording
   Shapes: a circle acts (+, dictate, send), a rounded chip is a setting, the tag at the start of the prompt is the tool.
   The capture surface is the one place that leaves the theme: it is always dark, like a viewfinder.
   Bump ?v= in chat.html on every edit.
   ============================================================================ */

:root {
    --vac-studio: #FF6B1A;
    --vac-studio-hi: #FF8A4C;
    --vac-studio-on: #1A0D05;
    --vac-build: #6D4FC4;
    --vac-rec: #E5484D;
    --vac-ink: #141210;
    --vac-ink-2: #23201c;
    --vac-paper: #F3EDE4;
    --vac-radius: 18px;
    --vac-ease: cubic-bezier(.2, .7, .2, 1);
    /* Secondary text. The page's own --text-secondary cannot be used: the Rich UI library (llm-ui-gen) writes a
       :root block after the page's themes that sets --text-secondary to one grey for every theme (3.6:1 on the dark
       theme). These two are mixed from the theme's text and surface colours instead, so they follow every theme. */
    --vac-soft: #5c5c5c;
    --vac-faint: #767676;
    --vac-soft: color-mix(in srgb, var(--text-primary) 80%, var(--bg-primary));
    --vac-faint: color-mix(in srgb, var(--text-primary) 66%, var(--bg-primary));
}

/* A tone is the colour of the chosen tool; its ink, wash and line are mixed with the theme so they read on any of the
   page's eleven themes. Declared on the element that carries data-tool (a var() resolves where it is declared). */
.vac-tone { --vac-tone: var(--vac-soft); }
.vac-tone[data-tool="image"], .vac-tone[data-tool="video"], .vac-tone[data-tool="audio"] { --vac-tone: var(--vac-studio); }
.vac-tone[data-tool="research"] { --vac-tone: var(--primary-color); }
.vac-tone[data-tool="build"] { --vac-tone: var(--vac-build); }
.vac-tone {
    --vac-tone-ink: var(--vac-tone);
    --vac-tone-wash: var(--bg-tertiary);
    --vac-tone-line: var(--border-secondary);
    --vac-tone-ink: color-mix(in srgb, var(--vac-tone) 45%, var(--text-primary));
    --vac-tone-wash: color-mix(in srgb, var(--vac-tone) 12%, var(--bg-primary));
    --vac-tone-line: color-mix(in srgb, var(--vac-tone) 42%, var(--bg-primary));
}

/* ---------------------------------------------------------------- the card */
.input-container .vac {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    max-width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-secondary);
    border-radius: var(--vac-radius);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.input-container .vac:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, .05);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--border-focus) 16%, transparent);
}
.input-container .vac[data-tool] { border-color: var(--vac-tone-line); }
.input-container .vac[data-tool]:focus-within {
    border-color: var(--vac-tone);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--vac-tone) 18%, transparent);
}
.input-container .vac.is-drop {
    border-style: dashed;
    border-color: var(--vac-studio);
    background: color-mix(in srgb, var(--vac-studio) 6%, var(--bg-primary));
}
.vac [hidden], .vac-pop [hidden], .vac-card [hidden] { display: none !important; }
/* The page gives every button a 44px minimum on touch screens; the composer sizes its own targets below. */
.vac button, .vac-pop button, .vac-card button, .vac-turn button { min-width: 0; min-height: 0; font-family: inherit; }

/* ---------------------------------------------------------------- the prompt and the tool tag */
.vac .vac-field { position: relative; overflow: hidden; border-radius: var(--vac-radius); }
.vac .message-input {
    display: block;
    width: 100%;
    min-height: 46px;
    max-height: 200px;
    padding: 10px 16px 8px !important;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    font-size: 16px;
    line-height: 26px;
    color: var(--text-primary);
    text-indent: var(--vac-indent, 0);
}
.vac .message-input:focus { border: 0; box-shadow: none; outline: none; }
.vac .message-input::placeholder { color: var(--vac-faint); }
.vac .message-input[disabled] { opacity: .55; }

.vac-pill {
    position: absolute;
    left: 12px;
    top: 9px;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 6px 0 10px;
    border: 1px solid var(--vac-tone-line);
    border-radius: 8px;
    background: var(--vac-tone-wash);
    box-shadow: inset 3px 0 0 var(--vac-tone);
    color: var(--vac-tone-ink);
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background-color .12s ease, border-color .12s ease;
    animation: vac-pill-in .16s var(--vac-ease);
}
.vac-pill:hover { background: color-mix(in srgb, var(--vac-tone) 20%, var(--bg-primary)); }
.vac-pill:focus-visible { outline: 2px solid var(--vac-tone); outline-offset: 2px; }
.vac-pill svg { flex: none; }
.vac-pill .vac-pill-x { opacity: .6; margin-left: 1px; }
.vac-pill:hover .vac-pill-x, .vac-pill:focus-visible .vac-pill-x { opacity: 1; }
@keyframes vac-pill-in { from { opacity: 0; transform: translateX(-6px) scale(.96); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- the bar: +, presets, dictate, send / generate */
.vac .vac-bar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 4px 10px 10px;
}
.vac .vac-plus {
    flex: none;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-secondary);
    border-radius: 50%;
    background: transparent;
    color: var(--vac-soft);
    cursor: pointer;
    transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}
.vac .vac-plus svg { transition: transform .18s var(--vac-ease); }
.vac .vac-plus:hover { background: var(--bg-hover); color: var(--text-primary); }
.vac .vac-plus[aria-expanded="true"] { background: var(--text-primary); border-color: var(--text-primary); color: var(--bg-primary); }
.vac .vac-plus[aria-expanded="true"] svg { transform: rotate(45deg); }
.vac .vac-plus:focus-visible, .vac-chip:focus-visible, .vac .voice-btn:focus-visible, .vac .send-btn:focus-visible, .vac-generate:focus-visible,
.vac-starter:focus-visible, .vac-frame-x:focus-visible, .vac-role:focus-visible, .vac-linkbtn:focus-visible, .vac-guide-btn:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

.vac .vac-presets {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-height: 36px;
}
.vac .vac-presets:empty { display: none; }
.vac-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    max-width: 100%;
    padding: 0 9px 0 10px;
    border: 1px solid var(--border-primary);
    border-radius: 9px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .12s ease, border-color .12s ease;
}
.vac-chip:hover { background: var(--bg-hover); }
.vac-chip[aria-expanded="true"] { border-color: var(--vac-soft); background: var(--bg-hover); }
.vac-chip[aria-pressed="true"] { border-color: var(--vac-tone-line); background: var(--vac-tone-wash); color: var(--vac-tone-ink); }
.vac-chip svg { flex: none; color: var(--vac-soft); }
.vac-chip[aria-pressed="true"] svg { color: inherit; }
.vac-chip .vac-chip-text { overflow: hidden; text-overflow: ellipsis; }
.vac-chip .vac-caret { opacity: .55; margin-left: -1px; }
.vac-chip:disabled { opacity: .5; cursor: default; }
.vac-chip.is-lead { font-weight: 600; }
.vac-presets-msg { font-size: 13px; color: var(--vac-soft); line-height: 1.4; padding: 6px 2px; }

.vac .input-buttons {
    position: static;
    transform: none;
    flex: none;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}
.vac .voice-btn, .vac .send-btn {
    width: 36px !important;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0 !important;
    border-radius: 50%;
    flex: none;
}
.vac .voice-btn { background: transparent; color: var(--vac-soft); }
.vac .voice-btn:hover { background: var(--bg-hover); color: var(--text-primary); transform: none; }
.vac .voice-btn.listening { background: var(--danger-color); color: #fff; }
.vac .send-btn:hover { transform: none; }

.vac-generate {
    display: inline-flex;
    align-items: stretch;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 11px;
    background: var(--vac-studio);
    color: var(--vac-studio-on);
    font-size: 14px;
    font-weight: 650;
    line-height: 1;
    cursor: pointer;
    overflow: hidden;
    transition: background-color .12s ease;
}
.vac-generate:hover { background: var(--vac-studio-hi); }
.vac-generate .vac-generate-verb { display: inline-flex; align-items: center; gap: 7px; padding: 0 12px 0 14px; }
.vac-generate .vac-generate-price {
    display: inline-flex;
    align-items: center;
    padding: 0 13px 0 11px;
    border-left: 1px solid rgba(26, 13, 5, .28);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    white-space: nowrap;
}
.vac-generate .vac-generate-price:empty { display: none; }
.vac-generate[aria-disabled="true"] { background: var(--bg-hover); color: var(--vac-faint); cursor: default; }
.vac-generate[aria-disabled="true"] .vac-generate-price { border-left-color: var(--border-secondary); }
/* the price is being worked out: still the Studio's button, only dimmed, so a change of setting does not flash grey */
.vac-generate.is-pricing[aria-disabled="true"] { background: var(--vac-studio); color: var(--vac-studio-on); opacity: .55; }
.vac-generate.is-pricing[aria-disabled="true"] .vac-generate-price { border-left-color: rgba(26, 13, 5, .28); }
.vac-generate.is-busy .vac-generate-verb::before {
    content: "";
    width: 13px;
    height: 13px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: vac-spin .8s linear infinite;
}
@keyframes vac-spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- what is attached */
.vac .vac-tray { padding: 12px 12px 2px; }
.vac-frames { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.vac-frame { position: relative; width: 76px; display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.vac-frame-thumb {
    position: relative;
    width: 76px;
    height: 76px;
    border: 1px solid var(--border-primary);
    border-radius: 11px;
    background: var(--bg-tertiary);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--vac-soft);
}
.vac-frame-thumb img, .vac-frame-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.vac-frame-kind {
    position: absolute; left: 5px; bottom: 5px;
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 6px; border-radius: 6px;
    background: rgba(20, 18, 16, .72); color: #fff;
    font-size: 11px; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums;
}
.vac-frame-play {
    width: 36px; height: 36px; border-radius: 50%;
    border: 1px solid var(--border-secondary); background: var(--bg-primary); color: var(--text-primary);
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.vac-frame-play:hover { background: var(--bg-hover); }
.vac-frame-x {
    position: absolute; top: -7px; right: -7px; z-index: 2;
    width: 22px; height: 22px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border-secondary); border-radius: 50%;
    background: var(--bg-primary); color: var(--vac-soft); cursor: pointer;
    box-shadow: var(--shadow-sm);
}
.vac-frame-x:hover { color: var(--danger-color); border-color: var(--danger-color); }
.vac-frame-x::after { content: ""; position: absolute; inset: -9px; }   /* a larger target than the glyph */
.vac-role {
    display: inline-flex; align-items: center; justify-content: space-between; gap: 2px;
    width: 100%; padding: 2px 2px 2px 4px;
    border: 0; border-radius: 6px; background: transparent;
    color: var(--vac-soft); font-size: 11.5px; font-weight: 500; line-height: 1.3; text-align: left; cursor: pointer;
}
.vac-role:hover { background: var(--bg-hover); color: var(--text-primary); }
.vac-role span { min-width: 0; overflow-wrap: break-word; }
.vac-role svg { flex: none; }
.vac-role.is-static { cursor: default; }
.vac-role.is-static:hover { background: transparent; color: var(--vac-soft); }
.vac-frame.is-unused .vac-frame-thumb { border-style: dashed; border-color: var(--danger-color); }
.vac-frame.is-unused .vac-frame-thumb img, .vac-frame.is-unused .vac-frame-thumb video { opacity: .45; }
.vac-frame.is-unused .vac-role { color: var(--danger-color); }
.vac-frame-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(20, 18, 16, .35); }
.vac-frame-bar i { display: block; height: 100%; width: 0; background: var(--vac-studio); transition: width .2s linear; }
.vac-frame-add {
    width: 76px; height: 76px;
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    border: 1px dashed var(--border-secondary); border-radius: 11px; background: transparent;
    color: var(--vac-soft); font-size: 11.5px; cursor: pointer;
}
.vac-frame-add:hover { background: var(--bg-hover); color: var(--text-primary); }
.vac-tray-line { margin: 8px 2px 0; font-size: 12.5px; line-height: 1.45; color: var(--vac-soft); }
.vac-tray-line.is-warn { color: var(--danger-color); }

/* media is attached and no tool is chosen: say where it goes and offer the tools that can use it */
.vac-guide {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
    margin-top: 10px; padding: 10px 12px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--vac-studio) 9%, var(--bg-primary));
    border: 1px solid color-mix(in srgb, var(--vac-studio) 32%, var(--bg-primary));
}
.vac-guide-text { flex: 1 1 220px; font-size: 13.5px; line-height: 1.4; color: var(--text-primary); }
.vac-guide-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.vac-guide-btn {
    display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
    border: 1px solid color-mix(in srgb, var(--vac-studio) 55%, var(--bg-primary)); border-radius: 9px;
    background: var(--bg-primary); color: var(--text-primary); font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.vac-guide-btn:hover { background: var(--vac-studio); border-color: var(--vac-studio); color: var(--vac-studio-on); }
.vac-guide.is-nudge { animation: vac-nudge .5s var(--vac-ease); }
@keyframes vac-nudge { 0%, 100% { transform: none; } 30% { transform: translateX(-5px); } 65% { transform: translateX(4px); } }

/* the chat's own (document) attachments now sit inside the card */
.vac .attachments-preview { margin: 0; padding: 12px 12px 0; max-height: 132px; }
.vac .attachments-preview .attachment-item { border-radius: 10px; }
.vac .attachments-preview.is-aside .attachment-item { opacity: .6; }

/* ---------------------------------------------------------------- prompt starters */
.vac .vac-starters { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 8px; }
.vac-starter {
    max-width: 100%;
    padding: 6px 11px;
    border: 1px solid var(--border-primary);
    border-radius: 9px;
    background: transparent;
    color: var(--vac-soft);
    font-size: 13px;
    line-height: 1.35;
    text-align: left;
    cursor: pointer;
    transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}
.vac-starter:hover { background: var(--vac-tone-wash); border-color: var(--vac-tone-line); color: var(--text-primary); }

/* ---------------------------------------------------------------- the price sentence, the balance, what went wrong */
.vac .vac-note {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px;
    padding: 9px 14px 10px;
    border-top: 1px solid var(--border-primary);
    font-size: 12.5px; line-height: 1.45; color: var(--vac-soft);
}
.vac-note-msg { flex: 1 1 100%; display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; color: var(--text-primary); }
.vac-note-msg.is-error { color: var(--danger-color); }
.vac-note-msg svg { flex: none; margin-top: 2px; }
.vac-note-fine { flex: 1 1 260px; }
.vac-note-balance { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vac-note-balance.is-short { color: var(--danger-color); }
.vac-linkbtn {
    display: inline; padding: 0; border: 0; background: none;
    color: var(--primary-color); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
a.vac-linkbtn:visited { color: var(--primary-color); }

/* ---------------------------------------------------------------- menus and popovers (appended to the card or the body) */
.vac-pop {
    position: fixed;
    z-index: 10050;
    min-width: 220px;
    max-width: min(420px, calc(100vw - 16px));
    max-height: min(64vh, 460px);
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--border-secondary);
    border-radius: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    box-shadow: 0 18px 48px rgba(20, 18, 16, .22), 0 2px 6px rgba(20, 18, 16, .08);
    font-size: 14px;
    animation: vac-pop-in .13s var(--vac-ease);
}
@keyframes vac-pop-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.vac-pop-title { padding: 8px 10px 4px; font-size: 12px; font-weight: 600; color: var(--vac-faint); }
.vac-pop-sep { height: 1px; margin: 6px 4px; background: var(--border-primary); }
.vac-backdrop { position: fixed; inset: 0; z-index: 10040; background: rgba(20, 18, 16, .38); animation: vac-fade .15s ease; }
@keyframes vac-fade { from { opacity: 0; } to { opacity: 1; } }

/* the + menu: adding is a row of tiles, tools are rows that say what they do */
.vac-pop.vac-menu { width: 380px; max-height: min(86vh, 660px); }
.vac-tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; padding: 2px; }
.vac-tile {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 9px 2px 7px; border: 0; border-radius: 10px; background: transparent;
    color: var(--text-primary); font-size: 11.5px; line-height: 1.25; text-align: center; cursor: pointer;
}
.vac-tile-ico {
    width: 38px; height: 38px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--bg-tertiary); border: 1px solid var(--border-primary); color: var(--text-primary);
}
.vac-tile:hover, .vac-tile:focus-visible { background: var(--bg-hover); outline: none; }
.vac-tile:focus-visible .vac-tile-ico { border-color: var(--border-focus); }
.vac-tile.is-rec .vac-tile-ico { color: var(--vac-rec); }
.vac-item {
    display: flex; align-items: center; gap: 11px; width: 100%;
    padding: 8px 10px; border: 0; border-radius: 10px; background: transparent;
    color: var(--text-primary); font-size: 14px; text-align: left; cursor: pointer;
}
.vac-item:hover, .vac-item:focus-visible, .vac-item.is-active { background: var(--bg-hover); outline: none; }
.vac-item-ico {
    flex: none; width: 30px; height: 30px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--vac-tone-wash); color: var(--vac-tone-ink); box-shadow: inset 3px 0 0 var(--vac-tone);
}
.vac-item-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.vac-item-name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.vac-item-desc { font-size: 12.5px; color: var(--vac-soft); line-height: 1.35; }
.vac-item-hint { flex: none; font-size: 12px; color: var(--vac-faint); font-variant-numeric: tabular-nums; }
.vac-item[aria-checked="true"] .vac-item-hint, .vac-item[aria-selected="true"] .vac-item-hint { color: var(--vac-tone-ink); }
.vac-item[aria-disabled="true"] { opacity: .5; cursor: default; }
.vac-item.is-plain .vac-item-ico { background: var(--bg-tertiary); color: var(--vac-soft); box-shadow: none; }
.vac-check { flex: none; color: var(--vac-tone-ink); }
.vac-badge {
    padding: 1px 6px; border-radius: 6px; font-size: 10.5px; font-weight: 600; line-height: 1.5;
    background: var(--bg-tertiary); border: 1px solid var(--border-primary); color: var(--vac-soft);
}
.vac-fit { font-size: 12px; color: var(--vac-soft); }
.vac-fit.is-yes { color: var(--vac-tone-ink); }
.vac-fit.is-no { color: var(--danger-color); }

/* the slash menu sits on top of the card */
.vac-slash { position: absolute; left: 0; bottom: calc(100% + 8px); width: min(400px, 100%); scroll-padding-bottom: 38px; animation: vac-pop-in .12s var(--vac-ease); }
.vac-slash .vac-item { padding: 7px 10px; }
/* the key hint stays in sight while a long list of skills scrolls above it */
.vac-slash-foot { position: sticky; bottom: -6px; margin: 4px -6px -6px; padding: 7px 16px 8px; border-top: 1px solid var(--border-primary); background: var(--bg-primary); font-size: 11.5px; color: var(--vac-faint); }

/* option lists and small forms inside a popover */
.vac-opts { display: flex; flex-direction: column; }
.vac-opt {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 8px 10px; border: 0; border-radius: 9px; background: transparent;
    color: var(--text-primary); font-size: 14px; text-align: left; cursor: pointer;
}
.vac-opt:hover, .vac-opt:focus-visible { background: var(--bg-hover); outline: none; }
.vac-opt[aria-selected="true"] .vac-opt-name { font-weight: 600; }
.vac-opt .vac-check { flex: none; margin-left: auto; visibility: hidden; }
.vac-opt[aria-selected="true"] .vac-check { visibility: visible; }
.vac-opt-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.vac-opt-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.vac-opt-sub { display: block; font-size: 12.5px; font-weight: 400; line-height: 1.35; color: var(--vac-soft); }
.vac-opt-right { flex: none; font-size: 12px; color: var(--vac-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }
.vac-pop.vac-models { width: 420px; }
.vac-models .vac-opt { align-items: flex-start; padding-top: 10px; padding-bottom: 10px; }
.vac-models .vac-opt-right, .vac-models .vac-check { margin-top: 2px; }
.vac-models .vac-opt .vac-check { margin-left: 0; }
.vac-ratio { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 18px; }
.vac-ratio i { display: block; border: 1.6px solid currentColor; border-radius: 2.5px; }
.vac-ratio.is-auto i { border-style: dashed; }
.vac-form { padding: 6px 8px 8px; display: flex; flex-direction: column; gap: 12px; min-width: 260px; }
.vac-form label, .vac-form .vac-form-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--vac-soft); margin-bottom: 5px; }
.vac-form input[type="number"], .vac-form textarea, .vac-form select {
    width: 100%; padding: 8px 10px; border: 1px solid var(--border-secondary); border-radius: 9px;
    background: var(--bg-primary); color: var(--text-primary); font: inherit; font-size: 14px;
}
.vac-form textarea { min-height: 92px; resize: vertical; line-height: 1.45; }
.vac-form input[type="range"] { width: 100%; accent-color: var(--vac-studio); }
.vac-form-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.vac-form-val { font-size: 13px; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.vac-form-hint { font-size: 12px; color: var(--vac-soft); line-height: 1.4; }
.vac-switch {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
    padding: 6px 2px; border: 0; background: none; color: var(--text-primary); font-size: 14px; text-align: left; cursor: pointer;
}
.vac-switch i { flex: none; position: relative; width: 36px; height: 20px; border-radius: 10px; background: var(--border-secondary); transition: background-color .12s ease; }
.vac-switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .14s var(--vac-ease); }
.vac-switch[aria-checked="true"] i { background: var(--vac-studio); }
.vac-switch[aria-checked="true"] i::after { transform: translateX(16px); }
.vac-stepper { display: inline-flex; align-items: center; gap: 10px; }
.vac-stepper button { width: 32px; height: 32px; border: 1px solid var(--border-secondary); border-radius: 9px; background: var(--bg-primary); color: var(--text-primary); font-size: 16px; cursor: pointer; }
.vac-stepper button:disabled { opacity: .4; cursor: default; }
.vac-pop-foot { display: flex; justify-content: flex-end; padding: 2px 8px 6px; }
.vac-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px;
    border: 1px solid var(--border-secondary); border-radius: 9px; background: var(--bg-primary); color: var(--text-primary);
    font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.vac-btn:hover { background: var(--bg-hover); }
.vac-btn.is-primary { background: var(--text-primary); border-color: var(--text-primary); color: var(--bg-primary); }
.vac-btn.is-primary:hover { opacity: .9; }
.vac-btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.vac-voice-play { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border-secondary); background: var(--bg-primary); color: var(--text-primary); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }

/* ---------------------------------------------------------------- the capture surface: always dark, like a viewfinder */
.vac .vac-capture {
    position: relative;
    margin: 10px 10px 0;
    padding: 12px;
    border-radius: 13px;
    border: 1px solid rgba(243, 237, 228, .1);
    background: var(--vac-ink);
    color: var(--vac-paper);
    font-size: 14px;
}
.vcap-head { display: flex; align-items: center; gap: 10px; min-height: 26px; }
.vcap-title { font-weight: 600; }
.vcap-tally { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: #fff; }
.vcap-tally i { width: 10px; height: 10px; border-radius: 50%; background: var(--vac-rec); box-shadow: 0 0 0 0 rgba(229, 72, 77, .7); animation: vcap-pulse 1.4s ease-out infinite; }
@keyframes vcap-pulse { 0% { box-shadow: 0 0 0 0 rgba(229, 72, 77, .7); } 100% { box-shadow: 0 0 0 9px rgba(229, 72, 77, 0); } }
.vcap-time { margin-left: auto; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.vcap-time small { font-size: 12px; font-weight: 500; opacity: .6; }
.vcap-meter { display: block; width: 100%; height: 44px; margin-top: 10px; border-radius: 8px; background: var(--vac-ink-2); }
/* The view takes the camera's own shape (--vcap-ar, set from the picture) and at most a third of the window's height,
   so the prompt and its bar stay on screen under it. */
.vcap-view {
    position: relative;
    width: min(100%, calc(clamp(150px, 34vh, 300px) * var(--vcap-ar, 1.7778)));
    aspect-ratio: var(--vcap-ar, 1.7778);
    margin: 10px auto 0;
    border-radius: 10px;
    overflow: hidden;
    background: #000;
}
.vcap-view video, .vcap-view img, .vcap-view canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
.vac.is-capturing .vac-tray, .vac.is-capturing .vac-starters, .vac.is-capturing .vac-note, .vac.is-capturing .attachments-preview, .vac.is-capturing #vacAside { display: none !important; }
.vcap-view.is-mirror video.vcap-live { transform: scaleX(-1); }
.vcap-corner { position: absolute; width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, .9); pointer-events: none; }
.vcap-corner.tl { left: 12px; top: 12px; border-right: 0; border-bottom: 0; }
.vcap-corner.tr { right: 12px; top: 12px; border-left: 0; border-bottom: 0; }
.vcap-corner.bl { left: 12px; bottom: 12px; border-right: 0; border-top: 0; }
.vcap-corner.br { right: 12px; bottom: 12px; border-left: 0; border-top: 0; }
/* while a video records, the light and the clock take the top corners' places */
.vcap-view:has(.vcap-tally) .vcap-corner.tl, .vcap-view:has(.vcap-tally) .vcap-corner.tr { display: none; }
.vcap-view .vcap-tally { position: absolute; left: 14px; top: 12px; padding: 4px 9px; border-radius: 7px; background: rgba(20, 18, 16, .62); font-size: 13px; }
.vcap-view .vcap-time { position: absolute; right: 14px; top: 12px; margin: 0; padding: 4px 9px; border-radius: 7px; background: rgba(20, 18, 16, .62); font-size: 13px; }
.vcap-msg { margin-top: 10px; font-size: 13.5px; line-height: 1.45; color: rgba(243, 237, 228, .86); }
.vcap-msg.is-error { color: #ffb3b5; }
.vcap-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.vcap-actions .vcap-spacer { flex: 1 1 auto; }
.vcap-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px;
    border: 1px solid rgba(243, 237, 228, .28); border-radius: 10px; background: transparent; color: var(--vac-paper);
    font-size: 14px; font-weight: 600; cursor: pointer;
}
.vcap-btn:hover { background: rgba(243, 237, 228, .1); }
.vcap-btn:focus-visible { outline: 2px solid var(--vac-paper); outline-offset: 2px; }
.vcap-btn.is-keep { background: var(--vac-paper); border-color: var(--vac-paper); color: var(--vac-ink); }
.vcap-btn.is-keep:hover { background: #fff; }
.vcap-btn.is-rec { background: var(--vac-rec); border-color: var(--vac-rec); color: #fff; }
.vcap-btn.is-rec:hover { background: #ee5a5f; }
.vcap-btn.is-stop i { width: 11px; height: 11px; border-radius: 2px; background: currentColor; }
.vcap-btn.is-rec i { width: 11px; height: 11px; border-radius: 50%; background: currentColor; }
.vcap-shutter {
    width: 54px; height: 54px; padding: 0; border-radius: 50%; border: 3px solid var(--vac-paper); background: transparent; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.vcap-shutter i { width: 40px; height: 40px; border-radius: 50%; background: var(--vac-paper); transition: transform .1s ease; }
.vcap-shutter:active i { transform: scale(.9); }
.vcap-shutter:focus-visible { outline: 2px solid var(--vac-paper); outline-offset: 3px; }
.vcap-player { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.vcap-player .vcap-meter { margin-top: 0; flex: 1 1 auto; min-width: 0; }
.vcap-play { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--vac-paper); color: var(--vac-ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.vcap-play:focus-visible { outline: 2px solid var(--vac-paper); outline-offset: 3px; }

/* ---------------------------------------------------------------- in the conversation */
/* A media turn is not a chat reply: the reply's Copy / Speak / Regenerate row never shows on it. */
.message[data-vac-media] > .message-content > .message-actions { display: none !important; }
.vac-turn { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 6px; }
.vac-turn-tag {
    display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px 0 10px;
    border: 1px solid var(--vac-tone-line); border-radius: 7px; background: var(--vac-tone-wash);
    box-shadow: inset 3px 0 0 var(--vac-tone); color: var(--vac-tone-ink); font-size: 12.5px; font-weight: 600; line-height: 1;
}
.vac-turn-inputs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.vac-turn-thumb { width: 56px; height: 56px; border-radius: 9px; border: 1px solid var(--border-primary); background: var(--bg-tertiary); overflow: hidden; display: inline-flex; align-items: center; justify-content: center; color: var(--vac-soft); }
.vac-turn-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vac-turn-count { font-size: 12.5px; color: var(--vac-soft); }

.vac-card {
    max-width: 560px;
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    background: var(--bg-primary);
    overflow: hidden;
    line-height: 1.45;
}
.vac-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 11px 14px; font-size: 13px; color: var(--vac-soft); }
.vac-card-head .vac-turn-tag { height: 22px; font-size: 12px; }
.vac-card-model { font-weight: 600; color: var(--text-primary); }
.vac-card-meta { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; }
.vac-card-meta span { white-space: nowrap; font-variant-numeric: tabular-nums; }
.vac-card-body { border-top: 1px solid var(--border-primary); }
.vac-card-media { display: block; background: var(--vac-ink); }
.message-text .vac-card img, .message-text .vac-card video { margin: 0; border-radius: 0; max-width: 100%; }
.vac-card-media img, .vac-card-media video { display: block; width: 100%; max-height: 520px; object-fit: contain; background: var(--vac-ink); }
.vac-card-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px; background: var(--vac-ink); }
.vac-card-grid.is-three { grid-template-columns: repeat(3, 1fr); }
.vac-card-grid .vac-card-media img { max-height: none; object-fit: cover; aspect-ratio: 1 / 1; }
.vac-card-grid .vac-card-media:focus-visible { outline: 2px solid var(--vac-studio); outline-offset: -2px; }
.vac-card-audio { padding: 14px; background: var(--bg-tertiary); }
.vac-card-audio audio { display: block; width: 100%; }
.vac-card-wait { display: flex; align-items: center; gap: 12px; padding: 18px 14px; font-size: 14px; color: var(--text-primary); }
.vac-card-wait small { display: block; font-size: 12.5px; color: var(--vac-soft); font-variant-numeric: tabular-nums; }
.vac-ring { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--vac-studio) 25%, var(--bg-primary)); border-top-color: var(--vac-studio); animation: vac-spin 1s linear infinite; }
.vac-card-fail { display: flex; align-items: flex-start; gap: 10px; padding: 14px; font-size: 14px; color: var(--text-primary); }
.vac-card-fail svg { flex: none; margin-top: 2px; color: var(--danger-color); }
.vac-card-fail small { display: block; margin-top: 3px; font-size: 13px; color: var(--vac-soft); }
.vac-card-fail.is-info { color: var(--vac-soft); font-size: 13.5px; }
.vac-card-fail.is-info svg { color: var(--vac-soft); }
.vac-card-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px 12px; border-top: 1px solid var(--border-primary); }
.vac-card-actions:empty { display: none; }
.vac-act {
    display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px;
    border: 1px solid var(--border-primary); border-radius: 9px; background: var(--bg-primary); color: var(--text-primary);
    font-size: 13px; font-weight: 500; text-decoration: none; cursor: pointer;
}
.vac-act:hover { background: var(--bg-hover); }
.vac-act:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
a.vac-act:visited { color: var(--text-primary); }

.vac-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- phones */
@media (max-width: 768px) {
    .input-container .vac { padding: 0; gap: 0; }
    .vac .message-input { min-height: 46px; padding: 10px 14px 8px !important; font-size: 16px; }
    .vac .voice-btn, .vac .send-btn { width: 40px !important; height: 40px; min-width: 40px; min-height: 40px; }
    .vac .vac-plus { width: 40px; height: 40px; }
    .vac-generate { height: 40px; }
}
@media (max-width: 560px) {
    /* menus and popovers become sheets that rise from the bottom edge */
    .vac-pop.is-sheet {
        left: 0 !important; right: 0 !important; top: auto !important; bottom: 0 !important;
        width: auto; max-width: none; max-height: 78vh;
        border-radius: 18px 18px 0 0; border-bottom: 0;
        padding: 8px 8px calc(12px + env(safe-area-inset-bottom, 0px));
        animation: vac-sheet-in .2s var(--vac-ease);
    }
    .vac-pop.is-sheet::before { content: ""; display: block; width: 38px; height: 4px; margin: 2px auto 8px; border-radius: 2px; background: var(--border-secondary); }
    .vac-pop.vac-menu { width: auto; max-height: 86vh; }
    .vac .vac-bar { flex-wrap: wrap; row-gap: 8px; }
    .vac .vac-presets { order: -1; flex: 1 1 100%; }
    .vac-card { max-width: 100%; }
    .vac-slash { width: 100%; }
    /* the starters become one row to swipe, so the conversation keeps its room */
    .vac .vac-starters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; scroll-padding: 0 12px; }
    .vac .vac-starters::-webkit-scrollbar { display: none; }
    .vac-starter { flex: 0 0 auto; max-width: 76vw; scroll-snap-align: start; }
    .vac-starter span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
    /* frames keep their 76 px: at 66 px "Reference" no longer fitted beside its caret and broke inside the word */
    .vac-frames { gap: 8px; }
    .vac-pop.vac-models { width: auto; }
}
@keyframes vac-sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (hover: none) and (pointer: coarse) {
    .vac-chip, .vac-guide-btn { height: 38px; }
    .vac-starter { padding: 9px 12px; }
    .vac-item, .vac-opt { padding-top: 11px; padding-bottom: 11px; }
    .vac-pill { height: 30px; top: 8px; }
    .vac-pill::after { content: ""; position: absolute; inset: -8px; }
    .vac-act { height: 38px; }
    .vac-role { padding-top: 6px; padding-bottom: 6px; }
    .vac-item-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .vac-pill, .vac-pop, .vac-slash, .vac-backdrop, .vac-guide.is-nudge, .vac-pop.is-sheet { animation: none; }
    .vac .vac-plus svg, .vac-switch i::after, .vcap-shutter i { transition: none; }
    .vcap-tally i { animation: none; box-shadow: 0 0 0 3px rgba(229, 72, 77, .35); }
    .vac-ring, .vac-generate.is-busy .vac-generate-verb::before { animation-duration: 2.4s; }
}
