/* Dark-grey + pink accent, unconditionally - not a prefers-color-scheme
   toggle. Single palette by design (explicit user request), so no dark-mode
   media query exists here - :root IS the dark theme now.

   Structural aesthetic (radius scale, hairline color-mix-softened borders in
   place of flat ones, rounded-square avatars, Nunito-first type stack, a
   layered edge-shadow reserved for genuinely elevated surfaces) reimplemented
   from Lobe UI (extra-repos/lobe-ui-master, MIT-licensed, nothing copied) -
   see that repo's src/styles/theme/token/base.ts for the radius scale and
   src/chat/ChatItem/style.ts for the border-softening convention. Lobe also
   fades row-level controls in on hover, deliberately NOT adopted for
   .msg-controls below - its version only ever holds secondary metadata,
   while this app's Continue/Regenerate/swipe buttons are primary actions,
   and hiding them by default would be a real usability regression on touch
   (no hover at all). Colors are this app's own, unchanged - Lobe UI's own
   default palette is intentionally colorless/monochrome (its accent hues
   are opt-in theming, not baked in), so there was nothing there to copy for
   color. */
/* Nunito, self-hosted (not a Google Fonts <link> - this app is local-first,
   see obsidian/03-policy.md § Privacy, and a page load shouldn't leak a
   request to Google just to render text). Variable font (weight 200-1000
   in one file) rather than separate static weight files - this stylesheet
   already uses 600/650/700/800 in different places, a variable font covers
   all of them without multiplying file count. */
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("fonts/Nunito-Variable.woff2") format("woff2");
}
@font-face {
  font-family: "Nunito";
  font-style: italic;
  font-weight: 200 1000;
  font-display: swap;
  src: url("fonts/Nunito-Italic-Variable.woff2") format("woff2");
}

:root {
  --bg: #222021;
  --panel: #2c2a2c;
  --rail: #1d1b1b;
  --ink: #f0eef4;
  --muted: #9d97ab;
  --line: #333138;
  --accent: #e0218a;
  --accent-ink: #1c1120;
  --user: #3a2140;
  --error: #ff8a7a;
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --control-height: 36px;
  /* Softened border - a hairline that reads as lower-contrast than a flat
     var(--line), used for surface separation instead of shadows almost
     everywhere; real box-shadow is reserved for genuinely elevated moments
     (see --shadow-edge below). */
  --line-soft: color-mix(in srgb, var(--line) 66%, transparent);
  --shadow-edge: 0 1px 0 -1px var(--line), 0 1px 2px -0.5px var(--line),
    0 2px 2px -1px var(--line-soft), 0 3px 6px -4px var(--line-soft);
}

* { box-sizing: border-box; }

/* The `hidden` attribute has to actually hide things.
 *
 * Browsers implement it as `[hidden] { display: none }` in the UA
 * stylesheet, which ANY author rule setting `display` outranks. So
 * `.tile { display: flex }` silently defeated `tile.hidden = true`, and
 * Home's style filter ran correctly while hiding nothing. `.style-filter`
 * had the same problem in reverse: declared `display: flex`, so it stayed
 * visible on every route despite starting `hidden`.
 *
 * !important because the whole point is to beat component rules - this is
 * the one place in the file where that's the correct tool rather than a
 * workaround. Anything toggled with .hidden in JS depends on it. */
[hidden] { display: none !important; }

body {
  margin: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.55 Nunito, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display",
    "Segoe UI", Roboto, "Helvetica Neue", Arial, ui-sans-serif, system-ui, sans-serif;
}

body[data-app-mode="offline"] {
  background: linear-gradient(135deg, #071b3e 0%, #0a2858 46%, #111e4a 100%);
}
body[data-app-mode="online"] {
  background: linear-gradient(135deg, #222021 0%, #292329 52%, #211f25 100%);
}

/* --- Top banner: site-wide, every page --------------------------------------- */

.top-banner {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 52px;
  padding: 0 18px;
  background: var(--rail);
  border-bottom: 1px solid var(--line-soft);
}

.offline-mode-badge {
  display: none;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid color-mix(in srgb, #ff5555 32%, transparent);
  border-radius: 999px;
  color: #f0dfe4;
  background: color-mix(in srgb, #721e34 34%, transparent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .025em;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}
.top-banner .offline-mode-badge { margin-right: auto; }
.offline-mode-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: #ff4545;
  box-shadow: 0 0 8px color-mix(in srgb, #ff4545 72%, transparent);
  animation: offline-mode-blink 1.2s ease-in-out infinite;
}
@keyframes offline-mode-blink {
  50% { opacity: .25; }
}
@media (prefers-reduced-motion: reduce) {
  .offline-mode-dot { animation: none; }
}
body[data-app-mode="offline"] .offline-mode-badge { display: inline-flex; }

.top-banner .brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.top-banner .logo-chip {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
}

.top-banner h1 {
  margin: 0;
  margin-right: auto;
  font-size: 14px;
  font-weight: 650;
  color: var(--ink);
}

.top-banner .sub {
  font-size: 12px;
  color: var(--muted);
}

.top-banner a.banner-link {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}
.top-banner a.banner-link:hover { color: var(--ink); }

/* --- Shell: persona rail | page content ------------------------------------- */

.shell {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 280px;
  flex: 1;
  min-height: 0;
}

.shell.shell--rail-only {
  grid-template-columns: 64px minmax(0, 1fr);
}

@media (max-width: 820px) {
  .shell { grid-template-columns: 48px minmax(0, 1fr); }
  .side { display: none; }
}

/* --- Persona rail: quick-switch avatar bubbles, every page ------------------- */

.persona-rail {
  background: var(--rail);
  border-right: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  overflow-y: auto;
}

.rail-home {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--muted);
  text-decoration: none;
  flex-shrink: 0;
}

.rail-home.active {
  background: var(--panel);
  color: var(--accent);
  border: 1px solid var(--line-soft);
}

/* Rounded square, not a circle - a deliberate Lobe UI signature (its
   Avatar defaults to shape="square"), reimplemented here as the chat
   persona bubbles' shape. */
.avatar-bubble {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-lg);
  border: none;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.avatar-bubble:hover { transform: scale(1.08); }
.avatar-bubble:disabled { opacity: 0.5; cursor: default; transform: none; }

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

/* Per-chat backgrounds use server-validated keys, never raw user CSS. */
body[data-chat-background="rose"] .main,
body[data-chat-background="rose"] .chat-layout { background: radial-gradient(circle at 20% 10%, #5d2247, transparent 44%), #241d24; }
body[data-chat-background="ocean"] .main,
body[data-chat-background="ocean"] .chat-layout { background: radial-gradient(circle at 75% 5%, #164a66, transparent 45%), #18252d; }
body[data-chat-background="forest"] .main,
body[data-chat-background="forest"] .chat-layout { background: radial-gradient(circle at 15% 15%, #28523f, transparent 42%), #1c2721; }
body[data-chat-background="sunset"] .main,
body[data-chat-background="sunset"] .chat-layout { background: radial-gradient(circle at 80% 0%, #71352a, transparent 46%), #2d2020; }

/* --- Header ----------------------------------------------------------------- */

.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 52px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--panel);
}

.bar h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.status {
  font-size: 12px;
  color: var(--muted);
  margin-right: auto;
  font-variant-numeric: tabular-nums;
}

button {
  font: inherit;
  height: var(--control-height);
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
}

button:disabled { opacity: 0.5; cursor: default; }

button.ghost {
  height: auto;
  background: transparent;
  color: var(--muted);
  border-color: var(--line-soft);
  padding: 5px 10px;
  font-size: 13px;
}

/* Send button doubles as Stop while a generation is in flight - see
   app.js/persona-chat.js's stopGeneration(). Danger-toned so it reads as a
   different action than "Send," not just a relabeled version of it. */
button.stop-mode {
  background: var(--error);
  color: var(--bg);
}

/* --- Conversation ------------------------------------------------------------ */

.log {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-anchor: none;
}

.scroll-down {
  position: absolute;
  z-index: 3;
  right: 22px;
  bottom: 82px;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line-soft);
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 3px 14px #0005;
  font-size: 24px;
  line-height: 1;
}
.scroll-down[hidden] { display: none; }

.runpod-startup {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  background: color-mix(in srgb, var(--bg) 76%, transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}
.runpod-startup.visible { opacity: 1; }
.runpod-startup-orbit {
  width: 48px;
  height: 48px;
  border: 3px solid var(--line-soft);
  border-top-color: var(--accent);
  border-right-color: var(--accent);
  border-radius: 50%;
  animation: runpod-orbit 800ms linear infinite;
}
.runpod-startup-label { color: var(--ink); font-size: 14px; }
@keyframes runpod-orbit { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .runpod-startup-orbit { animation-duration: 2.4s; }
  .runpod-startup { transition-duration: 0ms; }
}

.msg {
  max-width: min(46rem, 88%);
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line-soft);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg.user {
  align-self: flex-end;
  background: var(--user);
  border-color: transparent;
}

.msg.error {
  color: var(--error);
  border-color: currentColor;
  background: transparent;
}

.msg .who {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 4px;
}

.msg.pending { color: var(--muted); font-style: italic; }

/* Narration/action beats (**wrapped like this** per
   PERSONA_CHARACTER_REINFORCEMENT) - italic and slightly muted to read as
   a stage direction, distinct from plain spoken dialogue right next to it.
   Never raw "**" characters - see appendFormattedText. */
.narration {
  display: block;
  margin: 2px 0 10px;
  padding: 1px 0 1px 11px;
  border-left: 3px solid var(--muted);
  border-left-color: color-mix(in srgb, var(--muted) 65%, transparent);
  font-style: italic;
  color: var(--muted);
}

.narration:last-child { margin-bottom: 0; }
.dialogue { display: block; color: var(--ink); }

.msg.image, .msg.video, .msg.audio { padding: 8px; white-space: normal; }
.msg.image img, .msg.video video {
  display: block;
  max-width: 100%;
  max-height: 360px;
  border-radius: var(--radius-sm);
}
.media-signature-layout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 100%;
}
.media-signature-layout > img,
.media-signature-layout > video {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 50%;
}
.generation-signature-frame {
  flex: 1 1 300px;
  width: 340px;
  min-width: 230px;
  max-width: 100%;
  height: 360px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #211e23;
}
@media (max-width: 700px) {
  .media-signature-layout { flex-wrap: wrap; }
  .media-signature-layout > img,
  .media-signature-layout > video { max-width: 100%; }
  .generation-signature-frame { flex-basis: 100%; width: 100%; height: 300px; }
}
.msg.audio audio { display: block; width: 100%; max-width: 320px; }
/* --- Rough-progress dotted ring (pending messages with a time estimate) ------- */

.progress-ring {
  position: relative;
  width: 40px;
  height: 40px;
  margin: 8px auto 2px;
}

.progress-ring .dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: var(--line);
  transition: background 0.25s ease;
  transform: rotate(calc(var(--i) * (360deg / var(--dots)))) translateY(-17px);
}

.progress-ring .dot.filled {
  background: var(--accent);
}

/* --- Persona chat: swipe / regenerate controls -------------------------------- */

/* Lobe UI fades this kind of row-level control bar in on hover, but its
   version only ever holds secondary metadata (timestamps, minor icons) -
   Continue/Regenerate/swipe here are primary actions, and hiding them by
   default would be a real usability regression on touch (no hover at all).
   Kept always visible; what's actually reused from Lobe is the quieter
   look - no boxed divider line, just breathing room. */
.msg-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.msg-controls .swipe-btn,
.msg-controls .regen-btn,
.msg-controls .continue-btn,
.msg-controls .game-return-btn,
.msg-controls .upscale-btn,
.msg-controls .edit-btn {
  padding: 3px 8px;
  font-size: 12px;
}

.msg-controls .swipe-counter {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.msg-controls .regen-btn {
  margin-left: auto;
}

/* Auto-masked face editing ("Edit" button under a chat image) - a toggled
   row rather than always-visible, so a compact prompt input doesn't
   dominate the image caption area when not in use. */
.edit-row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.edit-row.hidden {
  display: none;
}

.edit-input {
  flex: 1;
  font: inherit;
  font-size: 12px;
  color: inherit;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-soft);
  background: var(--bg);
}

.edit-row .edit-apply-btn {
  padding: 3px 8px;
  font-size: 12px;
}

.empty {
  margin: auto;
  color: var(--muted);
  text-align: center;
}

/* --- Composer ----------------------------------------------------------------- */

/* Horizontally scrollable, touch-friendly suggested replies. They are real
   user messages on click, not a separate canned-response system. */
.quick-replies {
  display: flex;
  flex: 0 0 auto;
  min-height: 48px;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  padding: 10px 18px 2px;
  background: var(--panel);
  scrollbar-width: none;
}
.quick-replies::-webkit-scrollbar { display: none; }
.quick-reply {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 8%, var(--panel));
  color: var(--ink);
  white-space: nowrap;
  font: inherit;
  font-size: 13px;
  line-height: 1.2;
  cursor: pointer;
}
.quick-reply:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--panel)); }
.quick-reply:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.su-runpod-row { display: grid; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); overflow-wrap: anywhere; }
.runpod-summary { padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--panel) 82%, var(--accent)); font-size: 14px; }
.runpod-pod-card { display: grid; gap: 16px; padding: 18px; margin: 12px 0; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.runpod-pod-card__head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.runpod-pod-card__name { font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.runpod-pod-card__meta { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.runpod-status { display: inline-flex; padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: color-mix(in srgb, var(--accent) 18%, var(--panel)); }
.runpod-status--running { color: #78e0a2; background: color-mix(in srgb, #2fb56b 20%, var(--panel)); }
.runpod-metrics { display: grid; grid-template-columns: repeat(4, minmax(100px, 1fr)); gap: 8px; }
.runpod-metric { padding: 10px; border-radius: 8px; background: color-mix(in srgb, var(--line) 35%, var(--panel)); }
.runpod-metric__label { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.runpod-metric__value { display: block; margin-top: 3px; font-size: 18px; font-weight: 700; }
.runpod-underutilized { padding: 10px 12px; border-left: 3px solid #e4b44c; color: var(--ink); background: color-mix(in srgb, #e4b44c 13%, var(--panel)); }
.runpod-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 680px) { .runpod-metrics { grid-template-columns: repeat(2, minmax(100px, 1fr)); } }
.runpod-subnav { border-top: 1px solid var(--line-soft); padding-top: 10px; }
.runpod-subnav .field { min-width: min(320px, 100%); margin: 0; }
.runpod-model-assets { display: grid; gap: 8px; margin: 8px 0 12px; }
.runpod-model-asset { display: grid; grid-template-columns: minmax(0, 2fr) minmax(150px, 1fr) auto; gap: 8px; align-items: center; }
.runpod-model-asset input, .runpod-model-asset select { min-width: 0; width: 100%; }
@media (max-width: 680px) {
  .runpod-model-asset { grid-template-columns: 1fr; }
  .runpod-subnav { align-items: stretch; flex-direction: column; }
}

.composer {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 12px 18px;
  border-top: 1px solid var(--line-soft);
  background: var(--panel);
}

/* Explicit generation triggers, sitting directly above the composer
   (2026-09-12) - see app/ui/media-trigger-buttons.js. A sibling box, not
   part of the composer's own row (unlike the mic button, which lives
   inside the form). */
.media-triggers {
  position: relative;
  display: flex;
  gap: 8px;
  padding: 8px 18px 0;
  background: var(--panel);
}
.media-trigger-btn {
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.media-trigger-btn:hover { color: var(--ink); border-color: var(--accent); }
.media-trigger-btn:disabled { opacity: .5; cursor: default; }
.media-trigger-more { width: 30px; padding: 0; font-weight: 800; }

.media-trigger-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 18px;
  min-width: 140px;
  padding: 6px;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  z-index: 5;
}
.media-trigger-menu button {
  display: block;
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.media-trigger-menu button:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }

/* Text chat remains available, while token-priced generation controls make
   their exhausted state clear before the server refuses the request. */
.token-limited .media-triggers .media-trigger-btn:not(.media-trigger-more) {
  opacity: .38;
  filter: grayscale(1);
  cursor: not-allowed;
}

/* The "…" panel: this chat's automatic media frequencies. Wider than the
   old one-item menu, and its selects/checkbox take the Chat Settings
   styling (.chat-menu-field / .chat-menu-share in shell.css). */
.media-pop {
  width: 290px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.media-pop-title { margin: 0; font-size: 13px; font-weight: 800; color: var(--ink); }
.media-pop-hint { margin: -6px 0 0; font-size: 12px; color: var(--muted); }
.media-pop-status { margin: 0; min-height: 1em; font-size: 11.5px; color: var(--muted); }
.media-pop-status:empty { display: none; }
.media-trigger-menu .media-pop-link {
  height: auto;
  padding: 2px 0;
  color: var(--accent);
  font-size: 12px;
}
.media-trigger-menu .media-pop-link:hover { background: transparent; text-decoration: underline; }

textarea {
  flex: 1;
  font: inherit;
  color: inherit;
  resize: none;
  max-height: 40vh;
  min-height: var(--control-height);
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  background: var(--bg);
}

textarea:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* --- Right-side details panel ------------------------------------------------- */

.side {
  border-left: 1px solid var(--line-soft);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.side-tabs {
  display: flex;
  border-bottom: 1px solid var(--line-soft);
}

.side-tab {
  flex: 1;
  background: transparent;
  color: var(--muted);
  border: none;
  border-radius: 0;
  padding: 12px 0;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
}

.side-tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.side-panel {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.info-list { margin: 0; }
.info-list > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.info-list dt { color: var(--muted); }
.info-list dd { margin: 0; text-align: right; overflow-wrap: anywhere; }

.hint {
  margin-top: 16px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.hint code {
  background: var(--bg);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xs);
  padding: 1px 5px;
  font-size: 11px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.gallery a {
  display: block;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line-soft);
}
.gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gallery .empty {
  grid-column: 1 / -1;
  margin: 24px 0;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* --- Auth page (login.html) -------------------------------------------------- */

.auth-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 28px 26px;
  /* One of the few places that earns Lobe's actual box-shadow treatment
     (reserved for elevated/floating surfaces there) - a card floating
     alone in the middle of the page, unlike the flush-mounted panels
     elsewhere, reads as "elevated" in the same way a modal would. */
  box-shadow: var(--shadow-edge);
}

.auth-card .logo-chip {
  width: 36px;
  height: 36px;
  font-size: 12px;
  margin: 0 auto 14px;
}

.auth-card h1 {
  margin: 0 0 4px;
  font-size: 18px;
  text-align: center;
}

.auth-card .sub {
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}

.field label {
  font-size: 12px;
  color: var(--muted);
}

.field input {
  font: inherit;
  color: inherit;
  height: var(--control-height);
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  background: var(--bg);
}

.field input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Every <select>, app-wide: tells the browser the page is dark, so the
   OPEN option list (which CSS can't otherwise reach in Chromium/Safari)
   is drawn dark too instead of a white sheet over a dark page. The palette
   is unconditionally dark (see the top of this file), so there is no light
   case to preserve. The option colours are for Firefox, which does honour
   them. */
select { color-scheme: dark; }
select option { background: var(--panel); color: var(--ink); }

/* A select inside a .field matches the text inputs beside it - same
   height, radius, border and fill - with its own chevron, since the native
   one can't be recoloured. */
.field select {
  font: inherit;
  color: var(--ink);
  height: var(--control-height);
  padding: 0 34px 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239d97ab' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.field select:hover { border-color: var(--line); }
.field select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.auth-card form button[type="submit"] {
  width: 100%;
  padding: 10px 14px;
  margin-top: 4px;
}

.auth-switch {
  margin: 16px 0 0;
  font-size: 13px;
  text-align: center;
  color: var(--muted);
}

.auth-switch button {
  background: transparent;
  color: var(--accent);
  padding: 0;
  font: inherit;
  border: none;
}

.auth-error {
  font-size: 13px;
  color: var(--error);
  margin: 0 0 14px;
  min-height: 1em;
}

/* --- Personas grid (personas.html) -------------------------------------------- */

.persona-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  width: 100%;
  overflow-y: auto;
}

.persona-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.persona-card {
  /* Overrides the global `button { height: var(--control-height) }` rule
     (36px, sized for a one-line button) - confirmed live as a real bug:
     .persona-card never set its own height, so every card's box collapsed
     to 36px while its actual content (name + wrapping description +
     badge, plus 16px padding - well over 100px) spilled out past that box
     into the grid row below, reading as cards "layered on top of each
     other, halfway." height: auto lets the box size to its own content
     like any normal flex column. */
  height: auto;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.persona-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-edge);
}

.persona-card .name {
  font-weight: 650;
  font-size: 14px;
}

.persona-card .desc {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.4;
}

.persona-card .badge {
  align-self: flex-start;
  margin-top: 4px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
}

/* --- Persona chat page (persona-chat.html) ------------------------------------ */

/* --- Admin page (admin.html) --------------------------------------------------- */

.admin-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 20px 32px;
  width: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  flex: 1;
}

.admin-jobs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-jobs-empty {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.admin-job {
  display: grid;
  grid-template-columns: auto auto 1fr auto auto;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
}

.admin-job-stop {
  background: transparent;
  color: var(--error);
  border: 1px solid var(--error);
  border-radius: var(--radius-xs);
  padding: 3px 9px;
  font-size: 11.5px;
  cursor: pointer;
}

.admin-job-stop:hover {
  background: color-mix(in srgb, var(--error) 15%, transparent);
}

.admin-job-stop:disabled {
  opacity: 0.5;
  cursor: default;
}

.admin-job-kind {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  color: var(--accent-ink);
  background: var(--accent);
  white-space: nowrap;
}

/* One accent color per kind - image/video/audio jobs read apart from each
   other in the bar at a glance, not just by their text label. */
.admin-job-kind--video { background: #4fb0e0; }
.admin-job-kind--audio { background: #7fd88f; }

.admin-job-label {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 320px;
}

.admin-job-bar {
  width: 160px;
  height: 6px;
  border-radius: 999px;
  background: var(--rail);
  overflow: hidden;
}

.admin-job-bar-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.4s ease;
}

.admin-job-stats {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
}

.admin-jobs-warning {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--error);
}

/* A job ComfyUI reports but job_tracker lost track of (timed-out request,
   or a job that outlived an app restart) - dashed border marks it as
   "real, but not this app's own bookkeeping" at a glance. */
.admin-job--untracked {
  grid-template-columns: auto auto 1fr auto;
  border-style: dashed;
  border-color: var(--error);
}

.admin-history {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-history h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-history-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--line-soft);
}

.admin-history-row--failed .admin-job-stats {
  color: var(--error);
}

.admin-terminal-wrap {
  flex: 1;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--rail);
}

.admin-terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
  color: var(--muted);
}

.admin-follow {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

/* Monospace is a deliberate exception to the site-wide Nunito font - this
   is raw log output, not prose, and a terminal reading as a terminal
   (fixed-width, dark) is the point. */
.admin-terminal {
  flex: 1;
  margin: 0;
  padding: 10px 12px;
  overflow-y: auto;
  font-family: "Cascadia Code", "Consolas", "SFMono-Regular", Menlo, Monaco, monospace;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}



/* --- Icon hover: enlarge on pointer ---------------------------------------
   One place for every small, tappable control, so they behave consistently
   instead of only .avatar-bubble having it (which was the case before).

   Scales are modest and vary by element size: a big avatar growing 15%
   would shove its neighbours around, while a small toolbar glyph needs
   more than 8% for the movement to register at all.

   transform (not width/height) on purpose - it's compositor-only, so it
   can't reflow the row it sits in and can't nudge the surrounding text.
   Every rule pairs with a transition declared alongside it, otherwise the
   change snaps rather than eases.

   Disabled controls are excluded throughout: a control that grows under
   the cursor reads as "this does something", which is precisely wrong for
   one that's inert. .avatar-bubble already had that carve-out and the
   rest now match it. */

.rail-home,
.logo-chip,
.side-tab,
.gallery a,
.msg-controls button,
.admin-job-stop,
.edit-row .edit-apply-btn,
.auth-switch button {
  transition: transform 0.15s ease, opacity 0.15s ease;
}

/* Small glyph-style controls - the ones sitting in a toolbar row. */
.msg-controls button:not(:disabled):hover,
.admin-job-stop:not(:disabled):hover,
.edit-row .edit-apply-btn:not(:disabled):hover,
.auth-switch button:not(:disabled):hover {
  transform: scale(1.15);
}

/* Larger standing elements - smaller factor keeps layout calm. */
.rail-home:hover,
.logo-chip:hover,
.side-tab:hover,
.gallery a:hover {
  transform: scale(1.08);
}

/* Pressed state: dip back under the hover size so a click is felt as well
   as seen. Without this the control stays at its enlarged size through the
   press and the interaction reads as unresponsive. */
.msg-controls button:not(:disabled):active,
.admin-job-stop:not(:disabled):active,
.edit-row .edit-apply-btn:not(:disabled):active,
.auth-switch button:not(:disabled):active,
.rail-home:active,
.logo-chip:active,
.side-tab:active,
.gallery a:active,
.avatar-bubble:not(:disabled):active {
  transform: scale(0.96);
}

/* Keyboard parity: focus-visible gets the same growth as hover, so the
   effect isn't mouse-only. */
.msg-controls button:not(:disabled):focus-visible,
.admin-job-stop:not(:disabled):focus-visible,
.rail-home:focus-visible,
.side-tab:focus-visible,
.gallery a:focus-visible {
  transform: scale(1.12);
}

/* Respect the OS "reduce motion" setting. Motion-sensitive users can get
   real discomfort from things that grow and shrink under the cursor, and
   this is decoration - the hover state is still conveyed by the existing
   colour/border changes. */
@media (prefers-reduced-motion: reduce) {
  .rail-home,
  .logo-chip,
  .side-tab,
  .gallery a,
  .msg-controls button,
  .admin-job-stop,
  .edit-row .edit-apply-btn,
  .auth-switch button,
  .avatar-bubble {
    transition: none;
  }
  .rail-home:hover,
  .logo-chip:hover,
  .side-tab:hover,
  .gallery a:hover,
  .msg-controls button:hover,
  .admin-job-stop:hover,
  .edit-row .edit-apply-btn:hover,
  .auth-switch button:hover,
  .avatar-bubble:hover {
    transform: none;
  }
}


/* --- Storage meter (per-account disk allowance) ---------------------------
   Sits beside the token counter in the header. Deliberately shows a bar as
   well as a number: "1.2 GB of 2.5 GB" needs arithmetic to interpret,
   whereas a bar that's visibly two-thirds full doesn't.

   Colour only ever ADDS information here - the text carries the same
   meaning on its own, so this stays readable for colour-blind users and
   doesn't rely on the amber/red distinction being perceivable. */

.storage-meter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.storage-bar {
  display: inline-block;
  width: 46px;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

.storage-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: var(--accent, #7aa2f7);
  transition: width 0.4s ease, background 0.3s ease;
}

.storage-meter.is-warning .storage-bar-fill { background: #e0a54a; }
.storage-meter.is-full .storage-bar-fill { background: #e05a5a; }
.storage-meter.is-warning #storage-text { color: #e0a54a; }
.storage-meter.is-full #storage-text { color: #e05a5a; }


/* --- Superuser console ----------------------------------------------------
   Its own banner and function bar, but built from the same tokens as the
   rest of the app so it doesn't read as a bolted-on admin tool. */

.su-banner { gap: 18px; }
.su-nav { display: flex; gap: 6px; margin-left: 18px; flex: 1; }

.su-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted, #9aa4b2);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.su-nav-btn:hover { transform: scale(1.06); color: var(--ink, #e6e9ef); }
.su-nav-btn:active { transform: scale(0.97); }
.su-nav-btn.active {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.13);
  color: var(--ink, #e6e9ef);
}
.su-icon { font-size: 1.05rem; line-height: 1; }

.su-main { padding: 22px; max-width: 1180px; margin: 0 auto; }
.su-panel.hidden { display: none; }

.su-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 16px;
}

.su-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 16px;
}
.su-card--wide { grid-column: 1 / -1; }
.su-card h2 {
  margin: 0 0 14px;
  font-size: 0.78rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted, #9aa4b2);
}

.su-row { display: flex; gap: 10px; align-items: flex-end; margin-top: 10px; }
.su-row--split > .field { flex: 1; }

.su-btn {
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink, #e6e9ef);
  font: inherit;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}
.su-btn:hover:not(:disabled) { transform: scale(1.05); }
.su-btn:active:not(:disabled) { transform: scale(0.97); }
.su-btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.su-btn--primary { background: var(--accent, #7aa2f7); border-color: transparent; color: #0b1020; font-weight: 600; }
.su-btn--danger { background: #e05a5a; border-color: transparent; color: #fff; }
.su-btn--quiet { opacity: 0.75; }

/* Drag-and-drop target. Dashed while idle so it reads as a drop area
   rather than a button, and lifts on hover/drag-over. */
.su-drop {
  margin-top: 12px;
  border: 2px dashed rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 26px 18px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.su-drop:hover, .su-drop:focus-visible {
  transform: scale(1.01);
  border-color: var(--accent, #7aa2f7);
  background: rgba(122, 162, 247, 0.06);
}
.su-drop.is-over {
  transform: scale(1.02);
  border-color: var(--accent, #7aa2f7);
  background: rgba(122, 162, 247, 0.12);
}
.su-drop-inner p { margin: 4px 0; }
.su-drop-icon { font-size: 1.7rem; margin-bottom: 6px; }
.su-dataset-status { margin-top: 10px; font-size: 0.85rem; color: var(--muted, #9aa4b2); min-height: 1.2em; }

.su-warning {
  background: rgba(224, 165, 74, 0.12);
  border: 1px solid rgba(224, 165, 74, 0.4);
  color: #e0a54a;
  border-radius: 10px;
  padding: 11px 14px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.su-warning.hidden { display: none; }

.su-log {
  background: #0a0d14;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px;
  height: 320px;
  overflow: auto;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.su-job-status { margin-bottom: 10px; font-size: 0.9rem; }
.su-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.su-badge--running { background: rgba(122, 162, 247, 0.2); color: #7aa2f7; }
.su-badge--done { background: rgba(90, 200, 130, 0.2); color: #5ac882; }
.su-badge--failed, .su-badge--cancelled { background: rgba(224, 90, 90, 0.2); color: #e05a5a; }
.su-badge--pending { background: rgba(255, 255, 255, 0.1); color: var(--muted, #9aa4b2); }
.su-error { color: #e05a5a; }

.su-checks { display: grid; gap: 10px; }
.su-check { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 9px; background: rgba(255,255,255,0.03); }
.su-check-mark { font-size: 1.05rem; line-height: 1.3; }
.su-check.is-ok .su-check-mark { color: #5ac882; }
.su-check.is-bad .su-check-mark { color: #e05a5a; }
.su-check-name { font-weight: 600; font-size: 0.9rem; }
.su-check-path { font-size: 0.76rem; opacity: 0.75; word-break: break-all; }

.su-count-badge {
  display: inline-block;
  min-width: 18px;
  padding: 1px 6px;
  margin-left: 6px;
  border-radius: 999px;
  background: #e05a5a;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
}
.su-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; margin-bottom: 10px; }
.su-error-card { border: 1px solid rgba(224, 90, 90, 0.3); border-radius: 9px; padding: 10px 12px; background: rgba(224, 90, 90, 0.04); }
.su-error-card + .su-error-card { margin-top: 10px; }
.su-error-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.su-error-head .su-btn { margin-left: auto; }

.su-outputs { display: grid; gap: 8px; }
.su-output { display: flex; gap: 12px; align-items: center; padding: 9px 12px; border-radius: 8px; background: rgba(255,255,255,0.03); font-size: 0.85rem; }
.su-output-name { font-weight: 600; }
.su-output-size { color: var(--muted, #9aa4b2); }
.su-output-path { margin-left: auto; font-size: 0.72rem; opacity: 0.6; word-break: break-all; }

/* --- Superuser character editor's changelog -------------------------------- */
.su-log-list { display: grid; gap: 6px; max-height: 360px; overflow-y: auto; }
.su-log-entry {
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  font-size: 0.82rem;
  line-height: 1.5;
}
.su-log-entry-head { display: flex; justify-content: space-between; gap: 10px; opacity: 0.7; font-size: 0.74rem; }
.su-log-entry-field { font-weight: 600; }
.su-log-entry-diff { margin-top: 2px; word-break: break-word; }
.su-log-entry-old { color: #e05a5a; text-decoration: line-through; opacity: 0.75; }
.su-log-entry-new { color: #5ac882; }

/* --- Superuser character editor's resolved-pipeline readout --------------- */
.su-pipeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.su-pipe-group h3 { font-size: 0.9rem; margin: 0 0 8px; }
.su-pipe-sub {
  margin: 12px 0 5px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.6;
}
.su-pipe-row {
  display: flex;
  gap: 10px;
  padding: 5px 9px;
  border-radius: 6px;
  background: rgba(255,255,255,0.03);
  font-size: 0.78rem;
  margin-bottom: 3px;
}
.su-pipe-row.is-stacked { background: rgba(122, 162, 247, 0.07); }
.su-pipe-key { flex: 0 0 40%; opacity: 0.65; }
.su-pipe-val { flex: 1; word-break: break-word; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.su-pipe-val.is-none { opacity: 0.4; font-style: italic; font-family: inherit; }

/* --- Character creation ---------------------------------------------------- */

/* The "+" at the top of the rail. Deliberately distinct from a template
   bubble: it creates something of your own rather than opening a stock
   persona, so it reads as a different kind of action. */
.rail-create {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: 300;
  line-height: 1;
  background: transparent !important;
  border: 2px dashed rgba(255, 255, 255, 0.28);
  color: var(--muted, #9aa4b2);
  margin-bottom: 6px;
}
.rail-create:hover {
  border-color: var(--accent, #7aa2f7);
  color: var(--accent, #7aa2f7);
}

.banner-link--cta {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 4px 12px;
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.banner-link--cta:hover {
  transform: scale(1.06);
  border-color: var(--accent, #7aa2f7);
  color: var(--accent, #7aa2f7);
}

.cc-main { padding: 22px; max-width: 1180px; margin: 0 auto; flex: 1; overflow-y: auto; }

.cc-preview-body { display: flex; gap: 20px; flex-wrap: wrap; }

/* Portraits are generated 2:3 - the frame matches so the image is never
   letterboxed or cropped by the layout. */
.cc-portrait {
  width: 260px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.cc-preview-info { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 8px; }
.cc-preview-name { font-size: 1.2rem; font-weight: 600; }
/* --- Scrollbars ----------------------------------------------------------- */
/* The browser default is a light-grey chrome bar that reads as a foreign
   object on a dark panel. Styled to disappear into the surface and only
   assert itself on hover.

   Both syntaxes on purpose: scrollbar-width/color is the standard one
   (Firefox, and Chromium 121+), ::-webkit-scrollbar is what older
   Chromium/Edge and Safari actually honour. Neither alone covers
   everything this app runs in. */
* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--ink) 22%, transparent) transparent;
}

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--ink) 18%, transparent);
  border-radius: 999px;
  /* Transparent border with background-clip is the standard trick for an
     inset thumb - a plain narrow thumb sits flush against the edge and
     looks like a seam rather than a control. */
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--accent) 55%, transparent);
  background-clip: content-box;
}
*::-webkit-scrollbar-corner { background: transparent; }

/* --- Waiting states: typing / recording / downloading --------------------- */
/* What the CHARACTER is doing, not what the machine is doing - see
   addPendingMessage in persona-chat.js. */

.msg.pending { font-style: normal; }

.typing-word { color: var(--muted); }

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 7px;
  vertical-align: middle;
}
.typing-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  display: block;
  animation: typing-bounce 1.25s ease-in-out infinite;
}
.typing-dots i:nth-child(2) { animation-delay: .18s; }
.typing-dots i:nth-child(3) { animation-delay: .36s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .45; }
  30%           { transform: translateY(-4px); opacity: 1; }
}

/* A hole the shape of what's coming, so the layout doesn't jump when the
   real thing lands and the wait reads as something arriving. */
.media-placeholder {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 260px;
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--ink) 4%, transparent);
}
/* Matches the resolution policy: portraits 2:3, everything else 3:2. */
.media-placeholder--image { aspect-ratio: 2 / 3; }
.media-placeholder--video { aspect-ratio: 3 / 2; }
.media-placeholder--audio { height: 78px; width: 300px; }

.media-spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--ink) 16%, transparent);
  border-top-color: var(--accent);
  animation: media-spin 900ms linear infinite;
}

@keyframes media-spin { to { transform: rotate(360deg); } }

.media-caption {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  padding: 0 12px;
}

/* Motion is decoration here - the words already say what's happening, so
   suppressing it costs nothing. */
@media (prefers-reduced-motion: reduce) {
  .typing-dots i { animation: none; opacity: .7; }
  .media-spinner { animation: none; border-top-color: var(--accent); }
}
