/* =========================================================================
   CREATE AGENT / EDIT AGENT (views/agent-builder), on the kit: fields .vx-label + .vx-field, the tabs .vx-tabs, buttons
   .vx-btn, the lists .vx-rows / .vx-row, Earlier versions a .vx-accordion. What is left here only places them, on kit
   tokens; logical properties, so Arabic mirrors. The deep review parts (tabs.js, voices.js) at the end.
   ========================================================================= */
/* ---- the form ---- */
/* The form starts on the page's own content edge, like every page's title and lists (no inset of its own). */
.creator{padding:0 0 var(--vx-sp-6)}
/* The portrait is shown whole and large: the full width of the form, its box taking the picture's own shape (4:5 before
   there is one), up to about 60% of the screen's height; nothing is cropped. */
.creator-portrait{position:relative;width:100%;margin:var(--vx-sp-2) auto var(--vx-sp-3h)}
.agent-form.creator .avatar-preview{width:100%;height:auto;aspect-ratio:4/5;max-height:60dvh;margin:0 auto;border-radius:var(--verser-avatar-preview-radius)}
.agent-form.creator .avatar-preview:has(>img){aspect-ratio:var(--pic-ratio,4/5)}
.creator .avatar-preview>img{object-fit:contain}
.creator .placeholder-face{opacity:.6}
.avatar-preview[aria-busy=true]>img{opacity:.4;transition:opacity var(--vx-dur-mid) var(--vx-ease-std)}
.avatar-preview .making{position:relative;z-index:2;padding:0 var(--vx-sp-3);text-align:center;font:var(--vx-fw-medium) var(--vx-fs-7)/1.3 var(--vx-font);color:var(--vx-ink-2)}
/* Describe a portrait (the generate button inside the field) or a photo, on one line. */
.creator-pic-row{display:flex;align-items:center;gap:var(--vx-sp-2h)}
.creator-prompt-wrap{flex:1}
.creator-or{flex:none}
.creator-consent{display:flex;gap:var(--vx-sp-2h);align-items:center;min-height:var(--vx-h);margin-block-start:var(--vx-sp-2h);cursor:pointer}
/* Each field's name sits over it; the first one of a pane starts at the pane's top. */
.creator .builder-label{margin-block:var(--vx-sp-4) var(--vx-sp-2)}
#createScreen .builder-pane>.builder-label:first-child{margin-block-start:0}
.creator-assist{margin-block-start:var(--vx-sp-3)}
.creator-voices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--vx-sp-2h)}
.creator-voices>div{min-width:0}
.creator-error:empty{display:none}
.creator-error{margin:var(--vx-sp-4) var(--vx-sp-0h) 0}
.builder-save{margin-block-start:var(--vx-sp-4)}
/* Earlier versions, What it knows: the lists and their heads. */
.builder-versions{margin-block-start:var(--vx-sp-4)}
.builder-actions{margin-block-start:var(--vx-sp-3)}
.builder-files-head{margin-block:var(--vx-sp-6) var(--vx-sp-1)}
/* A context document's state in the brain and Open in Drive, under its size and date; a note's and a version's words and
   a chat summary are read whole, not cut at the row's end. */
.file-row .file-state{display:flex;flex-wrap:wrap;align-items:center;gap:var(--vx-sp-1h) var(--vx-sp-3);margin-block-start:var(--vx-sp-1h)}
.file-row .builder-row-sub{white-space:normal;overflow-wrap:anywhere}
.file-row .builder-summary{white-space:pre-line}
/* Delete or Restore asks in the row (confirmInline): the question takes its own line under the row's words, as before. */
.file-row:has(>.confirm-row){flex-wrap:wrap}
.file-row>.confirm-row{flex:1 1 100%;min-inline-size:0}
/* ---- the builder on a desktop ---- */
/* The portrait first (4:5, kept in view while the fields scroll) and the fields beside it, once the page has room for
   both: the portrait takes at most two fifths of the row (and never more than its 60%-of-the-screen size), so the fields
   are always the wider column; narrower, the portrait keeps its 4:5 shape above the fields instead of a wide letterbox. */
body.desk #createScreen{container:creator/inline-size}
body.desk .agent-form.creator .avatar-preview{max-width:calc(60dvh * 4 / 5);margin:0}
@container creator (min-width:560px){
  body.desk .creator{display:grid;grid-template-columns:minmax(0,min(40%,calc(60dvh * 4 / 5))) minmax(0,1fr);column-gap:var(--vx-sp-8);align-items:start}
  body.desk .creator-picture{position:sticky;top:var(--vx-sp-6)}
  body.desk .creator-portrait{margin-block-start:0}   /* the portrait's top on the Name label's line */
  body.desk .creator-fields>.builder-label:first-child{margin-block-start:0}
}
/* ---- deep review parts ---- */
/* A10: the tab row under the name; each pane starts a little under it. */
#createScreen .builder-tabs{margin-block-start:var(--vx-sp-4h)}
#createScreen .builder-pane{padding-block-start:var(--vx-sp-3h)}
#createScreen .builder-pane[hidden]{display:none}
/* What it knows: the fold is gone, its tab is the fold. */
#builderContext>summary{display:none}

/* A2: the voice lists stack (one per language), the select and its kit button out of sight, kept as the value. */
#createScreen .creator-voices:has(.voice-picked){grid-template-columns:minmax(0,1fr);gap:var(--vx-sp-4h)}
/* A voice: its radio, name and sound, Play at the end, all on the card's middle line. */
.voice-list{--vx-gap:var(--vx-sp-2)}
.voice-choice{align-items:center}
.voice-choice-text{flex:1;min-inline-size:0}
.creator-voices>.voice-picked>:not(.builder-label):not(.voice-list){display:none}
@container creator (min-width:760px){#createScreen .creator-voices:has(.voice-picked){grid-template-columns:repeat(2,minmax(0,1fr))}}

/* A5: the danger zone, set apart under a hairline at the end of the form; its button is the kit's danger button. */
.builder-danger{margin-block-start:var(--vx-sp-7);padding-block-start:var(--vx-sp-4h);border-block-start:1px solid var(--vx-hair);display:grid;justify-items:start;gap:var(--vx-sp-1h)}
.builder-danger:has(#deleteAgentBtn.hidden){display:none}
.builder-danger-title{margin:0;font:var(--vx-fw-semibold) var(--vx-fs-8)/1.3 var(--vx-font);color:var(--vx-danger-text)}
.builder-danger-note{margin:0 0 var(--vx-sp-1h)}
.builder-danger #deleteAgentNote:empty{display:none}

/* A8: the status line under the agent's name is a button (agent-status.js): a 44px target around the line, a ring on
   keyboard focus, its look unchanged. */
.story .ready-badge[data-status-tap]{position:relative;cursor:pointer}
.story .ready-badge[data-status-tap]::after{content:"";position:absolute;inset-inline:calc(-1 * var(--vx-sp-2));top:50%;height:var(--vx-back-h);transform:translateY(-50%)}
.story .ready-badge[data-status-tap]:focus-visible{outline:var(--ring-width) solid var(--ring);outline-offset:var(--vx-sp-1);border-radius:var(--radius-3xs)}
@media (hover:hover) and (pointer:fine){.story .ready-badge[data-status-tap]:hover{text-decoration:underline;text-underline-offset:3px}}

/* Editor actions share the story action's open icon-over-caption form. Fields keep their native surface. */
#createScreen .creator :is(.vx-btn, .builder-tabs > button) {
  --vx-btn-bg: transparent;
  --vx-btn-fg: var(--vx-ink-2);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--vx-sp-1);
  min-inline-size: 44px;
  min-block-size: 44px;
  inline-size: auto;
  block-size: auto;
  max-inline-size: 100%;
  padding: var(--vx-sp-2) var(--vx-sp-3);
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: var(--vx-ink-2);
  font: 300 var(--vx-fs-4)/1.3 var(--vx-font);
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
}
#createScreen .creator .vx-btn:not(.deleg8-use-person) { display: inline-flex; }
html[data-characters="pixel"] #createScreen .creator .deleg8-use-person { display: inline-flex; }
#createScreen .creator .vx-btn.hidden { display: none; }
#createScreen .creator :is(.vx-btn, .builder-tabs > button) .icon { inline-size: 24px; block-size: 24px; flex: none; stroke-width: 1.4; }
#createScreen .creator :is(.vx-btn, .builder-tabs > button) > span { font: inherit; max-inline-size: 160px; }
#createScreen .creator .vx-btn:hover { background: none; color: var(--vx-ink); box-shadow: none; }
#createScreen .creator .vx-btn[data-variant="danger"] { color: var(--vx-danger-text); }
#createScreen .creator .vx-btn:disabled { opacity: .4; cursor: default; }
#createScreen .creator :is(.vx-btn, .builder-tabs > button):focus-visible { outline: var(--ring-width) solid var(--ring); outline-offset: var(--vx-sp-1); }
#createScreen .builder-tabs { min-inline-size: 0; max-inline-size: 100%; }
#createScreen .creator .builder-tabs > button { display: inline-flex; flex: 1 0 0; min-block-size: 64px; padding-inline: var(--vx-sp-1); font-size: var(--vx-fs-2); }
#createScreen .creator .builder-tabs > button[aria-selected="true"] { color: var(--vx-ink); }
#createScreen .creator .builder-tabs > button::after { inset-inline: calc(50% - 8px); }
#createScreen .creator :is(.creator-fields, .creator-picture, .builder-pane) { min-inline-size: 0; }
#createScreen .creator .builder-save { display: flex; margin-inline: auto; }
#createScreen .creator .file-row :is(.file-open, .file-remove, .note-remove, .version-restore),
#createScreen .creator .voice-play { flex: none; padding-inline: var(--vx-sp-1); }
#createScreen .creator .voice-play > span { font-size: var(--vx-fs-2); }
#createScreen .creator .creator-generate { margin: 0; min-block-size: 44px; padding: var(--vx-sp-1); }

html[data-characters="pixel"] #createScreen .creator .creator-generate { display: none; }

/* Apply and the one final Save/Create action remain clear rectangular text buttons. */
#createScreen .creator .vx-btn:is(.wd-go, .builder-save) {
  flex-direction: row;
  min-block-size: 44px;
  padding: var(--vx-sp-3) var(--vx-sp-4);
  border: 1px solid var(--vx-hair-2);
  border-radius: var(--vx-r-sm);
  background: var(--vx-card);
  color: var(--vx-ink);
  font: var(--vx-fw-regular) var(--vx-fs-6)/1.3 var(--vx-font);
  white-space: nowrap;
}
#createScreen .creator .vx-btn.builder-save {
  display: flex;
  inline-size: 100%;
  margin-inline: 0;
  border-color: transparent;
  background: var(--vx-btn-primary-bg);
  color: var(--vx-btn-primary-fg);
}
#createScreen .creator .vx-btn.builder-save > span { max-inline-size: none; }
#createScreen .creator :is(.vx-help, .note) { font: 300 var(--vx-fs-4)/1.4 var(--vx-font); }
