/* UI v4 (loaded last): the Claude-style composer, the voice sheet, Back buttons and the Appearance choices, all in Liquid Glass. */
/* Composer v4: a Claude-style bar in Liquid Glass.
   Top: the message box, full width, growing with the text. Bottom row inside the SAME rounded glass: [+] on the left; the model and the ONE action button (mic / send / stop) on the right.
   Search, Collaborate, Tools and a chosen prompt mode are small removable chips that exist only while they are on. Everything else (Connectors, Queue, modes) lives in the "+" sheet.
   Colours are tokens only (theme.css); the glass is the shared Liquid Glass recipe. */
.composer {
  gap: 4px; padding: 12px 12px 10px 14px; border-radius: 28px;
  background: linear-gradient(180deg, rgba(var(--sv-text-rgb), .085), rgba(var(--sv-text-rgb), .03)), rgba(var(--sv-composer-bg-rgb), .62);
  border: 1px solid rgba(var(--sv-text-rgb), .16) !important;
  box-shadow: inset 0 1px 0 rgba(var(--sv-text-rgb), .16), inset 0 -1px 0 rgba(0, 0, 0, .22), 0 18px 44px -20px rgba(0, 0, 0, .65);
  -webkit-backdrop-filter: blur(30px) saturate(1.6); backdrop-filter: blur(30px) saturate(1.6);
}
.composer:focus-within { border-color: rgba(var(--sv-text-rgb), .3) !important; box-shadow: inset 0 1px 0 rgba(var(--sv-text-rgb), .2), inset 0 -1px 0 rgba(0, 0, 0, .22), 0 18px 44px -20px rgba(0, 0, 0, .65), 0 0 0 3px rgba(var(--sv-text-rgb), .07); }

/* The message box: the whole width, one line to start, then it grows. Never squeezed by the controls (they are on their own row). */
.composer > .composer-field { display: block; width: 100%; min-width: 0; padding: 0; }
.composer .composer-input, .composer .composer-input:focus, .composer .composer-input:focus-visible { border: 0 !important; background: transparent !important; box-shadow: none !important; outline: none !important; border-radius: 0 !important; }
.composer .composer-input { display: block; width: 100%; box-sizing: border-box; min-height: 26px; max-height: min(40vh, 220px); padding: 6px 2px 4px; line-height: 1.5; }

/* Chips: only what is on. */
.composer-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 0; min-width: 0; }
.composer-chips:not(:has(> :not([hidden]):not([aria-pressed="false"]))) { display: none; }
.composer-chips > .composer-pill[aria-pressed="false"] { display: none; }
.composer-chips > .composer-pill, .composer-mode-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px 0 12px; border-radius: 999px; font-size: var(--sv-type-tool-label-size);
  color: var(--sv-text); background: rgba(var(--sv-accent-rgb), .16); border: 1px solid rgba(var(--sv-accent-rgb), .38); cursor: pointer;
}
.composer-chips > .composer-pill .composer-pill-label { display: inline !important; }
.composer-chips > .composer-pill svg { width: 16px; height: 16px; }
.composer-chips > .composer-pill::after { content: "\00d7"; margin-left: 2px; font-size: 1.05rem; line-height: 1; color: var(--sv-text-2); }
.composer-mode-chip { cursor: default; flex-wrap: wrap; }
.composer-mode-chip[hidden] { display: none; }
.composer-mode-chip .composer-mode-target { min-height: 28px; max-width: 160px; border-radius: 14px; padding: 0 8px; font-size: var(--sv-type-tool-label-size); }
.composer-mode-x { display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--sv-text-2); cursor: pointer; }
.composer-mode-x:hover { background: rgba(var(--sv-text-rgb), .14); color: var(--sv-text); }
.composer-mode-x svg { width: 14px; height: 14px; }

/* The bottom row. */
.composer-bar { display: flex; align-items: center; gap: 8px; min-width: 0; padding-top: 2px; }
.composer-bar-fill { flex: 1 1 auto; min-width: 0; }
.composer-bar .plus-wrap { flex: none; }
.composer-bar .composer-circle { width: 44px; height: 44px; min-height: 44px; background: rgba(var(--sv-text-rgb), .08); border: 1px solid rgba(var(--sv-text-rgb), .14); }
.composer-bar .glass-select { flex: 0 1 auto; min-width: 0; align-self: center; }
.composer-bar .glass-chip, .composer-bar .model-chip {
  min-height: 44px; max-width: 100%; padding: 0 6px 0 12px; border: 0; background: transparent; box-shadow: none;
  font-size: var(--sv-type-subtitle-size); letter-spacing: .01em; color: var(--sv-text-2); border-radius: 999px;
}
.composer-bar .glass-chip:hover { background: rgba(var(--sv-text-rgb), .08); color: var(--sv-text); }
.composer-bar .glass-chip-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.composer-bar .composer-action { width: 44px; height: 44px; flex: none; margin: 0; align-self: center; }
/* The popover for the model list opens upward and stays inside the screen. */
.composer-bar .glass-select .glass-popover { left: auto; right: 0; transform-origin: bottom right; }

/* Voice: while the voice sheet is open, the strip in the composer stays quiet (the sheet says it all). */
body.voice-sheet-open .composer-voice-strip { display: none !important; }

@media (max-width: 640px) {
  .composer { border-radius: 26px; padding: 11px 10px 9px 12px; }
  .composer .composer-input { font-size: var(--sv-type-body-secondary-size); }
}
@media (prefers-reduced-transparency: reduce) { .composer { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--sv-composer-bg); } }

/* ------------------------------------------------------------------------------------------------------------------------------------
   Voice sheet (js/voiceSheet.js): a frosted Liquid Glass sheet from the bottom; the Savannah feather video in the middle, large, with no background.
   ------------------------------------------------------------------------------------------------------------------------------------ */
.vs-backdrop {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, 0); transition: background-color .28s ease; -webkit-tap-highlight-color: transparent;
}
.vs-backdrop.open { background: rgba(0, 0, 0, .42); }
.vs-sheet {
  position: relative; isolation: isolate; width: min(100%, 520px); box-sizing: border-box; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 20px calc(18px + env(safe-area-inset-bottom, 0px)); border-radius: 34px 34px 0 0;
  background: linear-gradient(180deg, rgba(var(--sv-text-rgb), .13), rgba(var(--sv-text-rgb), .04) 38%), rgba(var(--sv-composer-bg-rgb), .56);
  border: 1px solid rgba(var(--sv-text-rgb), .2); border-bottom: 0;
  box-shadow: inset 0 1px 0 rgba(var(--sv-text-rgb), .26), inset 0 -1px 0 rgba(0, 0, 0, .2), 0 -24px 60px -24px rgba(0, 0, 0, .7);
  -webkit-backdrop-filter: blur(42px) saturate(1.7); backdrop-filter: blur(42px) saturate(1.7);
  transform: translateY(100%); transition: transform .34s cubic-bezier(.2, .8, .2, 1); color: var(--sv-text);
}
.vs-backdrop.open .vs-sheet { transform: none; }
.vs-grip { width: 44px; height: 5px; border-radius: 3px; background: rgba(var(--sv-text-rgb), .3); margin-bottom: 8px; }
.vs-title { margin: 0; padding: 0 8px; text-align: center; font-size: var(--sv-type-body-size); font-weight: 500; line-height: 1.35; color: var(--sv-text); text-wrap: balance; }
.vs-sub { margin: 0; min-height: 1.3em; text-align: center; font-size: var(--sv-type-subtitle-size); color: var(--sv-text-2); font-variant-numeric: tabular-nums; }
.vs-note { margin: 4px 0 0; max-width: 34ch; text-align: center; font-size: var(--sv-type-tool-description-size); line-height: 1.45; color: var(--sv-text-3); }
.vs-note:empty { display: none; }

/* The feather: big, centred, NO box and no background. The video's black becomes transparency (js/voiceSheet.js): white feathers in dark mode, ink feathers in light mode. */
.vs-stage { position: relative; display: grid; place-items: center; width: min(78vw, 340px); aspect-ratio: 1; margin: 4px 0 2px; }
.vs-feather { display: block; width: 100%; height: 100%; object-fit: contain; background: transparent; border: 0; pointer-events: none; }
.vs-source { position: absolute; width: 2px; height: 2px; opacity: 0; pointer-events: none; }   /* the hidden source the canvas reads from (kept in the page so every browser plays it) */

.vs-actions { display: flex; align-items: center; justify-content: center; gap: 22px; margin-top: 6px; min-height: 64px; }
.vs-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 64px; height: 64px; padding: 0; border-radius: 50%; cursor: pointer; font: inherit; font-size: var(--sv-type-body-secondary-size);
  color: var(--sv-text); background: rgba(var(--sv-text-rgb), .1); border: 1px solid rgba(var(--sv-text-rgb), .2);
  box-shadow: inset 0 1px 0 rgba(var(--sv-text-rgb), .22); transition: transform .12s ease, background-color .15s ease; touch-action: manipulation;
}
.vs-btn:hover { background: rgba(var(--sv-text-rgb), .17); }
.vs-btn:active { transform: scale(.93); }
.vs-btn svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.vs-btn:focus-visible { outline: 2px solid var(--sv-text); outline-offset: 3px; }
.vs-done { background: var(--sv-text); color: var(--sv-app-bg); border-color: transparent; }
.vs-done:hover { background: var(--sv-text); filter: brightness(.94); }
.vs-retry { width: auto; min-width: 64px; padding: 0 22px; border-radius: 32px; }
.vs-retry svg { width: 20px; height: 20px; }
.vs-btn[hidden] { display: none; }
.vs-sheet[data-phase="processing"] .vs-feather { opacity: .9; }
@media (min-width: 700px) { .vs-backdrop { align-items: center; } .vs-sheet { border-radius: 34px; border-bottom: 1px solid rgba(var(--sv-text-rgb), .2); } }
@media (prefers-reduced-motion: reduce) { .vs-sheet, .vs-backdrop { transition: none; } .vs-btn { transition: none; } }
@media (prefers-reduced-transparency: reduce) { .vs-sheet { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--sv-card); } }

/* The one action button: a light disc with a dark glyph when there is something to send (Claude-style), a quiet glass disc for the microphone. */
.composer-bar .composer-action[data-action="send"] { background: var(--sv-text); color: var(--sv-app-bg); border-color: transparent; box-shadow: none; }
.composer-bar .composer-action[data-action="send"]:hover { background: var(--sv-text); filter: brightness(.93); }
.composer-bar .composer-action[data-action="voice"] { background: rgba(var(--sv-text-rgb), .1); color: var(--sv-text); border: 1px solid rgba(var(--sv-text-rgb), .16); }
.composer-bar .glass-chip, .composer-bar .model-chip { color: var(--sv-text-2); }

/* ------------------------------------------------------------------------------------------------------------------------------------
   Appearance: three looks as glass cards (Dark, Light, Glass), each with a small picture of itself. The pictures use fixed colours on purpose (they show the look they stand for).
   ------------------------------------------------------------------------------------------------------------------------------------ */
.ap-looks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 6px 0 4px; }
.ap-look {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; padding: 10px; border-radius: 20px; cursor: pointer; text-align: left; font: inherit; color: var(--sv-text);
  background: rgba(var(--sv-text-rgb), .05); border: 1px solid rgba(var(--sv-text-rgb), .14); box-shadow: inset 0 1px 0 rgba(var(--sv-text-rgb), .1);
  transition: border-color .15s ease, background-color .15s ease, transform .12s ease;
}
.ap-look:hover { background: rgba(var(--sv-text-rgb), .09); }
.ap-look:active { transform: scale(.98); }
.ap-look[aria-checked="true"] { border-color: var(--sv-text); box-shadow: inset 0 1px 0 rgba(var(--sv-text-rgb), .14), 0 0 0 1px var(--sv-text); }
.ap-look:focus-visible { outline: 2px solid var(--sv-text); outline-offset: 2px; }
.ap-look-name { font-size: var(--sv-type-body-secondary-size); font-weight: 500; }
.ap-look-hint { font-size: var(--sv-type-tool-description-size); line-height: 1.35; color: var(--sv-text-2); }
.ap-preview { position: relative; display: block; width: 100%; aspect-ratio: 16 / 11; border-radius: 12px; overflow: hidden; border: 1px solid rgba(var(--sv-text-rgb), .14); }
.ap-preview .ap-dot { position: absolute; left: 9px; top: 9px; width: 10px; height: 10px; border-radius: 50%; }
.ap-preview .ap-bar { position: absolute; left: 9px; right: 9px; bottom: 9px; height: 14px; border-radius: 7px; }
.ap-preview .ap-bar.short { bottom: 29px; right: 36%; height: 8px; border-radius: 4px; }
.ap-preview-dark { background: #1f1c1b; } .ap-preview-dark .ap-dot { background: var(--sv-accent); } .ap-preview-dark .ap-bar { background: #3a3432; } .ap-preview-dark .ap-bar.short { background: #6b615e; }
.ap-preview-light { background: #f4f3ee; } .ap-preview-light .ap-dot { background: var(--sv-accent); } .ap-preview-light .ap-bar { background: #ffffff; box-shadow: 0 0 0 1px #dedcd3; } .ap-preview-light .ap-bar.short { background: #b1ada1; box-shadow: none; }
@media (max-width: 420px) { .ap-looks { grid-template-columns: 1fr; } .ap-look { flex-direction: row; align-items: center; } .ap-preview { width: 84px; flex: none; } .ap-look-name, .ap-look-hint { display: block; } .ap-look > .ap-look-name { flex: 1 1 auto; } .ap-look > .ap-look-hint { display: none; } }
.ap-label { margin: 14px 0 2px; font-size: var(--sv-type-tool-label-size); letter-spacing: .06em; text-transform: uppercase; color: var(--sv-text-2); }
.ap-swatch { display: block; width: 100%; aspect-ratio: 16 / 11; border-radius: 12px; border: 1px solid rgba(var(--sv-text-rgb), .14);
  background: radial-gradient(120% 120% at 25% 15%, color-mix(in srgb, var(--sw) 55%, #fff) 0%, var(--sw) 48%, color-mix(in srgb, var(--sw) 55%, #000) 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); }
@media (max-width: 420px) { .ap-swatch { width: 84px; flex: none; } }

/* Type: Newsreader is the face of the app, and headings are set in its bold. (Doto stays for technical text only: css/typography.css.) */
h1, h2, h3, h4, h5, h6, .chat-header-title, .chat-empty-brand, .sh-h3, .vs-title, .cc-sheet-title { font-weight: 700; }

/* ---- Menu button: only in the chat header and on the Settings front page ----------------------------------------------------------------------------------------------------
   Every other screen is reached from somewhere and has Back, so the round menu button in the top bar is gone (the empty bar goes with it on a phone). */
.topbar .menu-toggle { display: none !important; }
@media (max-width: 860px) { .topbar { display: none; } }
.sh-nav-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sh-nav-head .sh-nav-title { margin: 0; }
/* one round frosted-glass button, nothing around it */
.sh-menu-btn {
  width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 0 !important; border-radius: 50% !important; display: inline-grid; place-items: center; flex: none;
  color: var(--sv-text) !important; cursor: pointer;
  background: rgba(var(--sv-border-rgb), 0.16) !important;
  -webkit-backdrop-filter: blur(22px) saturate(1.6); backdrop-filter: blur(22px) saturate(1.6);
  border: 1px solid rgba(var(--sv-border-rgb), 0.38) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 8px 24px rgba(0, 0, 0, 0.22) !important;
}
.sh-menu-btn:active { transform: scale(0.94); }
.sh-menu-btn svg { width: 22px; height: 22px; fill: currentColor; stroke: none; }

/* ---- Dark mode: Lifted graphite -------------------------------------------------------------------------------------------------------------------------------------
   Clearer frosted glass and a stronger accent glow over the lifted warm-graphite canvas (theme.css), so dark mode is no longer near-black.
   Light mode keeps liquid-glass.css as it is. The glow follows the chosen accent (coral or sage). */
:root:not([data-mode="light"]) {
  --lg-glass: rgba(255, 255, 255, .085);
  --lg-glass-strong: rgba(var(--sv-elevated-rgb), .72);
  --lg-line: rgba(255, 255, 255, .17);
  --lg-blur: blur(30px) saturate(190%);
  --lg-rim: inset 0 1px 0 rgba(255, 255, 255, .26), inset 0 -1px 0 rgba(0, 0, 0, .18);
}
:root:not([data-mode="light"]) body::before {
  background:
    radial-gradient(62% 48% at 10% 4%, rgba(var(--sv-accent-rgb), .46), transparent 70%),
    radial-gradient(48% 38% at 96% 34%, rgba(var(--sv-accent-rgb), .24), transparent 72%),
    radial-gradient(50% 38% at 78% 58%, rgba(var(--sv-accent-rgb), .28), transparent 72%),
    radial-gradient(60% 46% at 26% 106%, rgba(var(--sv-accent-rgb), .38), transparent 72%);
}
