/* Tokens y componentes de la consola. Layout en layout.css.
   Fase 31 · Modo oscuro «Obsidiana & Cristal de Puck» y modo claro «Porcelana Élfica &
   Amatista Real». Paleta fijada por Overflow: cian glaciar, amatista Emilia y plata perlada. */
:root {
  color-scheme: dark;
  --bg: #06070d;
  --bg-2: #0a0d18;
  --surface: #0d101c;
  --raised: rgba(11, 16, 27, 0.78);
  --raised-2: rgba(14, 21, 35, 0.86);
  --line: rgba(94, 234, 212, 0.18);
  --line-strong: rgba(241, 245, 249, 0.22);
  --spec: rgba(255, 255, 255, 0.10);
  --spec-strong: rgba(255, 255, 255, 0.18);
  --ink: #f1f5f9;
  --dim: #a9b7c8;
  --faint: #7d8ba0;
  --ok: #5eead4;
  --warn: #fbbf24;
  --bad: #fb7185;
  --accent: #a855f7;
  --accent-2: #5eead4;
  --accent-ink: #0b0714;
  --accent-soft: rgba(168, 85, 247, 0.16);
  --cyan: #38bdf8;
  --aqua: #5eead4;
  --amethyst: #a855f7;
  --pearl: #f1f5f9;
  --glass: rgba(7, 10, 18, 0.20);
  --glass-strong: rgba(7, 10, 18, 0.28);
  --card-border: rgba(94, 234, 212, 0.32);
  --card-spec: rgba(255, 255, 255, 0.22);
  --bubble-user: linear-gradient(135deg, rgba(15, 76, 69, 0.34) 0%, rgba(14, 58, 71, 0.30) 55%, rgba(22, 36, 54, 0.32) 100%);
  --bubble-bot: rgba(13, 19, 32, 0.20);
  --bubble-bot-accent: #5eead4;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.35);
  --shadow-md: 0 16px 40px rgb(0 0 0 / 0.38);
  --shadow-lg: 0 28px 80px rgb(0 0 0 / 0.5);
  --font: "Segoe UI Variable Display", "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, -apple-system, Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 26px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --t-press: 120ms;
  --t-ui: 180ms;
  --t-sheet: 230ms;
  --tap: 44px;
}
/* Modo claro exacto: Marfil Cálido Editorial, Aguamarina Pálido y Lavanda Seda. */
:root[data-theme="light"], body.theme-light {
  color-scheme: light;
  --bg: #faf8f5;
  --bg-2: #f6f1ea;
  --surface: #ffffff;
  --raised: #ffffff;
  --raised-2: #fdfbff;
  --line: rgba(109, 40, 217, 0.14);
  --line-strong: rgba(109, 40, 217, 0.28);
  --spec: rgba(109, 40, 217, 0.10);
  --spec-strong: rgba(109, 40, 217, 0.18);
  --ink: #12101b;
  --dim: #4b4463;
  --faint: #6c6486;
  --ok: #0d9488;
  --warn: #b45309;
  --bad: #be123c;
  --accent: #7c3aed;
  --accent-2: #0d9488;
  --accent-ink: #ffffff;
  --accent-soft: rgba(124, 58, 237, 0.12);
  --cyan: #0284c7;
  --aqua: #0d9488;
  --amethyst: #9333ea;
  --pearl: #ffffff;
  --glass: rgba(255, 255, 255, 0.30);
  --glass-strong: rgba(255, 255, 255, 0.38);
  --card-border: rgba(109, 40, 217, 0.22);
  --card-spec: rgba(255, 255, 255, 0.9);
  --bubble-user: linear-gradient(135deg, rgba(91, 33, 182, 0.42) 0%, rgba(67, 56, 202, 0.38) 50%, rgba(2, 132, 199, 0.36) 100%);
  --bubble-bot: rgba(255, 255, 255, 0.34);
  --bubble-bot-accent: #0d9488;
  --shadow-sm: 0 2px 6px rgb(24 16 48 / 0.06);
  --shadow-md: 0 12px 32px -8px rgba(24, 16, 48, 0.09);
  --shadow-lg: 0 28px 60px -18px rgba(24, 16, 48, 0.22);
}
body[data-character="coda"] { --bubble-bot-accent: #38bdf8; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
body {
  margin: 0; color: var(--ink); font: 14px/1.5 var(--font); font-variant-numeric: tabular-nums;
  background:
    radial-gradient(60rem 34rem at 8% -6%, rgba(94, 234, 212, 0.10), transparent 62%),
    radial-gradient(54rem 30rem at 96% 4%, rgba(56, 189, 248, 0.08), transparent 62%),
    radial-gradient(70rem 42rem at 50% 112%, rgba(168, 85, 247, 0.10), transparent 64%),
    radial-gradient(48rem 28rem at 78% 58%, rgba(241, 245, 249, 0.045), transparent 66%),
    var(--bg);
}
:root[data-theme="light"] body, body.theme-light {
  background:
    radial-gradient(64rem 36rem at 10% -8%, rgba(45, 212, 191, 0.10), transparent 62%),
    radial-gradient(58rem 32rem at 96% 4%, rgba(147, 51, 234, 0.08), transparent 64%),
    radial-gradient(52rem 30rem at 52% 112%, rgba(45, 212, 191, 0.06), transparent 66%),
    var(--bg);
}

/* =========================================================================================
   FASE 34 · Fondo Bokeh real de Emilia debajo del cristal Aero Glass.
   La capa queda fija, con desenfoque óptico y saturación; el velo ::after protege la lectura.
   ========================================================================================= */
body::before {
  content: ""; position: fixed; inset: -24px; z-index: -2; pointer-events: none;
  background: url("/static/wallpapers/emiliawallpaper.jpg") center center / cover no-repeat;
  filter: blur(9px) saturate(145%) brightness(0.86);
  transform: scale(1.04);
  transform-origin: center;
}
@media (max-width: 767.98px) and (orientation: portrait) {
  body::before {
    background: url("/static/wallpapers/emiliawallpapervertical.jpg") center top / cover no-repeat;
  }
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 92% at 50% 6%, rgba(6, 7, 13, 0.02) 0%,
    rgba(6, 7, 13, 0.10) 62%, rgba(6, 7, 13, 0.26) 100%);
}
:root[data-theme="light"] body::before, body.theme-light::before {
  filter: blur(9px) saturate(120%) brightness(0.98);
}
:root[data-theme="light"] body::after, body.theme-light::after {
  background: linear-gradient(180deg, rgba(250, 248, 245, 0.14) 0%,
    rgba(250, 248, 245, 0.30) 100%);
}
h1, h2, h3, p { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
::selection { background: var(--accent-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

input, select, textarea {
  font: inherit; font-size: 16px; color: var(--ink); background: rgba(9, 11, 20, 0.72);
  border: 1px solid var(--line-strong); border-radius: var(--r-md); padding: 0 12px;
  min-height: var(--tap); width: 100%; caret-color: var(--accent);
  box-shadow: inset 0 1px 0 var(--spec);
  transition: border-color var(--t-ui) ease, box-shadow var(--t-ui) ease, background var(--t-ui) ease;
}
input::placeholder { color: var(--faint); }
input:focus-visible, select:focus-visible { outline: none; border-color: var(--aqua); box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.16), inset 0 1px 0 var(--spec); }
input:disabled { opacity: 0.5; cursor: not-allowed; }
:root[data-theme="light"] input, :root[data-theme="light"] select,
body.theme-light input, body.theme-light select { background: #ffffff; color: var(--ink); }

button, a, [role="button"] { touch-action: manipulation; }
button { font: inherit; color: inherit; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); min-width: var(--tap); padding: 0 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent), var(--raised-2);
  color: var(--ink); border: 1px solid var(--spec-strong); border-radius: var(--r-md);
  font-weight: 560; cursor: pointer; text-decoration: none; box-shadow: var(--shadow-sm);
  transition: transform var(--t-press) var(--ease-out), background var(--t-ui) ease,
              border-color var(--t-ui) ease, box-shadow var(--t-ui) ease, opacity var(--t-ui) ease;
}
.btn { touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(120deg, #c4b5fd 0%, #a855f7 30%, #5eead4 78%, #ecfeff 100%);
  color: #0b0714; border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 12px 30px rgba(168, 85, 247, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.btn.ghost { background: transparent; border-color: transparent; color: var(--dim); box-shadow: none; }
.btn.icon-only { padding: 0; }
.btn.small { min-height: 36px; padding: 0 10px; font-size: 13px; border-radius: 9px; }
.btn[aria-pressed="false"].ghost .ico { opacity: 0.55; }
.mic-btn[aria-pressed="true"] { background: linear-gradient(135deg, var(--accent), var(--aqua)); color: var(--accent-ink); border-color: transparent; animation: listening 1.4s ease-in-out infinite; }
.claude-toggle[aria-pressed="true"] { background: linear-gradient(120deg, var(--aqua), var(--amethyst)); color: #06121a; border-color: transparent; }
@keyframes listening { 50% { box-shadow: 0 0 0 7px var(--accent-soft); } }
@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled) { background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent), var(--raised); border-color: var(--card-border); box-shadow: 0 14px 34px rgba(3, 7, 18, 0.32), 0 0 24px rgba(94, 234, 212, 0.08); transform: translateY(-1px); }
  .btn.primary:hover:not(:disabled) { filter: brightness(1.06); box-shadow: 0 18px 44px rgba(168, 85, 247, 0.45), 0 0 30px rgba(94, 234, 212, 0.22); }
  .btn.ghost:hover:not(:disabled) { background: rgba(94, 234, 212, 0.07); color: var(--ink); }
  .seg:hover:not(.is-on) { color: var(--ink); }
  .tab:hover:not(.is-on) { color: var(--ink); }
  .card.is-interactive:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-md), 0 0 24px rgba(94, 234, 212, 0.07); }
}

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; box-shadow: 0 0 0 3px rgb(125 135 152 / 0.12); }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgb(94 234 212 / 0.14), 0 0 12px rgb(94 234 212 / 0.45); animation: dot-pulse 2.4s ease-in-out infinite; }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px rgb(240 180 41 / 0.14); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 3px rgb(255 107 107 / 0.14); }
@keyframes dot-pulse { 50% { opacity: 0.55; transform: scale(0.86); } }
.pill {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px;
  background: var(--glass); border: 1px solid var(--spec); border-radius: 999px; color: var(--dim);
  cursor: pointer; font-size: 13px; backdrop-filter: blur(16px); box-shadow: inset 0 1px 0 var(--spec);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-copy { min-width: 0; }
.brand h1 { font-size: 15px; font-weight: 660; letter-spacing: 0.05em; }
.brand i { color: var(--aqua); font-style: normal; }
.brand-mark { width: 20px; height: 20px; border-radius: 6px; background: conic-gradient(from 20deg, #ecfeff, #5eead4, #a855f7, #f1f5f9, #ecfeff); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.28), 0 0 18px rgba(94, 234, 212, 0.4); }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: rgba(6, 8, 14, 0.72); border: 1px solid var(--spec); border-radius: var(--r-md); box-shadow: inset 0 1px 0 var(--spec); }
.seg { min-height: 38px; min-width: var(--tap); padding: 0 14px; border: 0; border-radius: 8px; background: transparent; color: var(--dim); font-weight: 580; cursor: pointer; transition: background var(--t-ui) ease, color var(--t-ui) ease, transform var(--t-press) var(--ease-out); }
.seg:active { transform: scale(0.97); }
.seg.is-on { background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 60%), linear-gradient(120deg, var(--amethyst), var(--aqua)); color: #0b0714; }

.emotion-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--glass); border: 1px solid var(--spec); border-radius: 999px; font: 12px/1 var(--mono); color: var(--dim); text-transform: lowercase; backdrop-filter: blur(16px); box-shadow: inset 0 1px 0 var(--spec); }
.emotion-chip .dot { background: var(--aqua); animation: dot-pulse 2s ease-in-out infinite; }

.tabs { display: flex; gap: 2px; padding: 4px; border-bottom: 1px solid var(--spec); }
.tab { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); border: 0; border-radius: var(--r-sm); background: transparent; color: var(--dim); font-weight: 580; cursor: pointer; transition: background var(--t-ui) ease, color var(--t-ui) ease; }
.tab.is-on { background: linear-gradient(180deg, rgba(94, 234, 212, 0.10), transparent), var(--raised-2); color: var(--ink); box-shadow: inset 0 1px 0 var(--spec); }
.tab .ico { width: 17px; height: 17px; }
.list { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
/* Superficie de cristal exacta pedida por Overflow. */
.card, .artifact {
  background: var(--raised);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid var(--card-spec);
  border-left: 1px solid var(--card-border);
  border-radius: var(--r-md); padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: inset 0 1px 0 var(--card-spec), var(--shadow-sm);
  transition: transform var(--t-ui) var(--ease-out), border-color var(--t-ui) ease, box-shadow var(--t-ui) ease;
}
:root[data-theme="light"] .card, :root[data-theme="light"] .artifact,
body.theme-light .card, body.theme-light .artifact {
  background: #ffffff; border: 1px solid var(--card-border);
  box-shadow: 0 12px 32px -8px rgba(24, 16, 48, 0.09);
}
.card-head { display: flex; align-items: center; gap: 10px; }
.card-title { font-weight: 620; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.card-meta { color: var(--dim); font: 12px/1.45 var(--mono); overflow-wrap: anywhere; }
.card-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { font: 11px/1 var(--mono); padding: 4px 8px; border-radius: 999px; border: 1px solid var(--spec-strong); color: var(--dim); white-space: nowrap; }
.badge.ok { color: var(--ok); border-color: rgba(94, 234, 212, 0.4); background: rgba(94, 234, 212, 0.08); animation: chip-glow 2.8s ease-in-out infinite; }
.badge.warn { color: var(--warn); border-color: rgba(240, 180, 41, 0.38); background: rgba(240, 180, 41, 0.07); }
.badge.bad { color: var(--bad); border-color: rgba(251, 113, 133, 0.38); background: rgba(251, 113, 133, 0.07); }
@keyframes chip-glow { 50% { box-shadow: 0 0 18px rgba(94, 234, 212, 0.22); } }
.section-title { color: var(--dim); font-size: 12px; font-weight: 620; text-transform: uppercase; letter-spacing: 0.07em; padding: 4px 2px 0; }
.note { color: var(--dim); font-size: 13px; padding: 4px 2px; max-width: 62ch; }
.server-log { max-height: 168px; overflow: auto; margin: 0; padding: 8px 10px; font: 11px/1.5 var(--mono); color: var(--dim); white-space: pre-wrap; overflow-wrap: anywhere; background: rgba(0, 0, 0, 0.28); border: 1px solid var(--spec); border-radius: var(--r-sm); }
.server-log.is-frozen { border-color: var(--aqua); box-shadow: 0 0 0 1px rgba(94, 234, 212, 0.35) inset; }

.log { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; overscroll-behavior: contain; padding: 18px; scroll-behavior: smooth; }
.msg { max-width: min(78ch, 92%); padding: 12px 15px; border-radius: var(--r-lg); overflow-wrap: anywhere; line-height: 1.55; animation: rise 220ms var(--ease-out); }
/* Burbuja del usuario: gradiente exacto y texto blanco puro. */
.msg.me {
  align-self: flex-end; background: var(--bubble-user); color: #f8fafc;
  border: 1px solid rgba(94, 234, 212, 0.32); border-bottom-right-radius: 5px;
  box-shadow: 0 10px 26px rgba(2, 6, 23, 0.45);
}
/* Burbuja de Aris/Codaris: cristal oscuro con barra de acento lateral de 3px. */
.msg.bot {
  align-self: flex-start; background: var(--bubble-bot); color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.08); border-left: 3px solid var(--bubble-bot-accent);
  border-bottom-left-radius: 5px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), var(--shadow-sm);
}
:root[data-theme="light"] .msg.bot, body.theme-light .msg.bot {
  background: #ffffff; border: 1px solid var(--card-border);
  border-left: 3px solid var(--bubble-bot-accent); color: var(--ink);
  box-shadow: 0 12px 32px -8px rgba(24, 16, 48, 0.09);
}
.msg.sys { align-self: center; color: var(--dim); font-size: 12.5px; padding: 4px 10px; background: transparent; }
.msg.err { color: var(--bad); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.msg-body p { margin: 0 0 0.55em; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-body h2, .msg-body h3, .msg-body h4, .msg-body h5 { margin: 0.8em 0 0.4em; line-height: 1.3; letter-spacing: -0.01em; }
.msg-body h2 { font-size: 1.12rem; } .msg-body h3 { font-size: 1.03rem; } .msg-body h4, .msg-body h5 { font-size: 0.96rem; }
.msg-body ul, .msg-body ol { margin: 0.35em 0 0.6em; padding-left: 1.35em; }
.msg-body li { margin: 0.18em 0; }
.msg-body blockquote { margin: 0.5em 0; padding: 0.5em 0.9em; border-left: 2px solid var(--aqua); color: var(--dim); background: rgba(94, 234, 212, 0.05); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.msg-body code { font-family: var(--mono); font-size: 0.88em; padding: 0.12em 0.35em; border-radius: 5px; background: rgba(0, 0, 0, 0.30); border: 1px solid var(--spec); }
.msg-body pre { overflow-x: auto; padding: 10px 12px; border-radius: var(--r-sm); background: rgba(0, 0, 0, 0.34); border: 1px solid var(--spec); }
.msg-body hr { border: 0; border-top: 1px solid var(--spec); margin: 0.8em 0; }
.table-wrap { overflow-x: auto; margin: 0.55em 0 0.8em; border: 1px solid var(--spec); border-radius: var(--r-sm); box-shadow: var(--shadow-sm); }
.msg-body table { width: 100%; border-collapse: collapse; font-size: 12.8px; }
.msg-body th, .msg-body td { padding: 7px 9px; text-align: left; border-bottom: 1px solid var(--spec); vertical-align: top; }
.msg-body th { color: var(--ink); font-weight: 640; background: rgba(94, 234, 212, 0.06); position: sticky; top: 0; }
.msg-body tr:last-child td { border-bottom: 0; }
.msg-body tr:nth-child(even) td { background: rgba(255, 255, 255, 0.018); }
.metrics { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--spec); color: var(--faint); font: 11px/1.5 var(--mono); letter-spacing: 0.01em; }
.artifact { align-self: flex-start; max-width: min(460px, 94%); animation: rise 180ms var(--ease-out); }
.artifact img, .artifact video { width: 100%; max-height: 320px; object-fit: contain; border-radius: var(--r-sm); background: #000; }
.artifact audio { width: 100%; }
.artifact-link { display: flex; align-items: center; gap: 10px; min-height: var(--tap); color: var(--ink); text-decoration: none; }
.artifact-link span { overflow-wrap: anywhere; font-size: 13px; }

.empty { display: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 32px 24px; flex: 1; }
.empty h2 { font-size: 18px; letter-spacing: -0.01em; }
.empty p { color: var(--dim); max-width: 38ch; }
.is-offline .empty { display: flex; }
.is-offline .log { display: none; }

.composer {
  position: relative; z-index: 5; min-width: 0;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px;
  border-top: 1px solid var(--spec); background: var(--glass-strong);
  backdrop-filter: blur(22px) saturate(160%); -webkit-backdrop-filter: blur(22px) saturate(160%);
  box-shadow: 0 -10px 40px rgb(0 0 0 / 0.24);
}
.composer-row input { flex: 1; min-width: 0; }

dialog.session { border: 1px solid var(--spec-strong); background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 45%), rgba(9, 12, 20, 0.82); color: var(--ink); border-radius: var(--r-xl); padding: 0; width: min(420px, calc(100vw - 24px)); box-shadow: var(--shadow-lg); backdrop-filter: blur(24px) saturate(170%); -webkit-backdrop-filter: blur(24px) saturate(170%); }
dialog.session::backdrop { background: rgb(3 5 10 / 0.72); backdrop-filter: blur(6px); }
.session-form { display: flex; flex-direction: column; gap: 14px; padding: 22px; }
.session-form h2 { font-size: 18px; letter-spacing: -0.01em; }
.field { display: flex; flex-direction: column; gap: 6px; color: var(--dim); font-size: 13px; }
.row { display: flex; gap: 8px; justify-content: flex-end; }
.hint { color: var(--bad); font-size: 13px; }
.stage-fallback { color: var(--dim); padding: 12px; text-align: center; font-size: 12px; }
.sheet-handle { display: none; justify-content: center; padding: 8px 0 2px; touch-action: none; }
.sheet-handle span { width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); }

/* Avatar Live2D como capa flotante inferior derecha. */
.avatar-fallback { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 6%; border-radius: var(--r-xl); filter: drop-shadow(0 18px 40px rgb(0 0 0 / 0.45)); }
.avatar-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center top; border-radius: var(--r-xl); background: transparent; }

/* Micro-interacciones de la Fase 31: ondas de voz y halo reactivo. */
.voice-waves { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); display: flex; align-items: flex-end; gap: 4px; height: 34px; z-index: 3; pointer-events: none; filter: drop-shadow(0 0 10px rgba(94, 234, 212, 0.5)); }
.voice-waves i { display: block; width: 4px; height: 8px; border-radius: 3px; background: linear-gradient(180deg, var(--aqua), var(--amethyst)); animation: wave 900ms ease-in-out infinite; }
.voice-waves i:nth-child(2) { animation-delay: 120ms; }
.voice-waves i:nth-child(3) { animation-delay: 240ms; }
.voice-waves i:nth-child(4) { animation-delay: 360ms; }
.voice-waves i:nth-child(5) { animation-delay: 480ms; }
@keyframes wave { 0%, 100% { height: 8px; opacity: 0.6; } 50% { height: 30px; opacity: 1; } }
body.is-speaking .stage::after {
  content: ""; position: absolute; inset: -18% -12% -6%; z-index: -2; border-radius: 50%;
  background: radial-gradient(circle, rgba(94, 234, 212, 0.22), rgba(168, 85, 247, 0.16) 48%, transparent 70%);
  animation: halo 1.8s ease-in-out infinite;
}
@keyframes halo { 50% { transform: scale(1.06); opacity: 0.78; } }
/* La cabecera editorial desaparece en cuanto hay un mensaje: el chat usa el 100 % de la altura. */
.console-hero.is-hidden { display: none !important; }
/* Fase 31: panel del Celular Admin (Nodo 4) con QR generado en Python local. */
.mobile-block { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.mobile-links { display: flex; flex-wrap: wrap; gap: 6px; }
.mobile-links .btn { display: inline-flex; align-items: center; text-decoration: none; }
.mobile-qr { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding-top: 4px; }
.mobile-qr svg { width: 168px; height: 168px; padding: 6px; border-radius: 12px; background: #fff; }

/* Tipografía de precisión: títulos equilibrados, cuerpo sin viudas y cifras tabulares. */
h1, h2, h3 { text-wrap: balance; }
.msg-body p, .card-meta, .section-lead { text-wrap: pretty; }
.stat-value, [data-counter], .metric, .ms { font-variant-numeric: tabular-nums; }

/* Fase 31: dark glass más ligero en móvil para no sacrificar batería ni FPS. */
@media (max-width: 1023.98px) {
  .topbar, .rail, .card, .composer, dialog.session {
    backdrop-filter: blur(14px) saturate(150%);
    -webkit-backdrop-filter: blur(14px) saturate(150%);
  }
}
/* Modo idle (30 min en segundo plano): congela animaciones y evita trabajo de GPU. */
body.is-idle *, body.is-idle *::before, body.is-idle *::after {
  animation-play-state: paused !important;
}
/* Las animaciones son siempre activas (decisión de Overflow). */

/* =========================================================================================
   FASE 32 · DARK AERO GLASS (Windows 7 estilizado a 2026)
   Doble bisel de vidrio tallado, brillo diagonal especular y aura cian en cada superficie.
   ========================================================================================= */
.card, .artifact, .pill, .emotion-chip, .segmented, dialog.session,
.server-log, .table-wrap, .stat, .badge {
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.20) 0%, rgba(255, 255, 255, 0.05) 36%,
    rgba(10, 18, 34, 0.36) 36.5%, rgba(7, 13, 26, 0.44) 100%);
  backdrop-filter: blur(28px) saturate(210%) brightness(1.08);
  -webkit-backdrop-filter: blur(28px) saturate(210%) brightness(1.08);
  border: 1px solid rgba(165, 243, 252, 0.38);
  border-top: 1px solid rgba(255, 255, 255, 0.65);
  border-left: 1px solid rgba(255, 255, 255, 0.46);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), inset 0 0 28px rgba(56, 189, 248, 0.16),
    0 18px 44px rgba(2, 8, 24, 0.55), 0 0 24px rgba(56, 189, 248, 0.14);
}
/* La burbuja de Aris conserva su barra de acento lateral de 3 px. */
.msg.bot {
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.05) 36%,
    rgba(10, 18, 34, 0.34) 36.5%, rgba(7, 13, 26, 0.44) 100%);
  backdrop-filter: blur(28px) saturate(210%) brightness(1.08);
  -webkit-backdrop-filter: blur(28px) saturate(210%) brightness(1.08);
  border: 1px solid rgba(165, 243, 252, 0.38);
  border-top: 1px solid rgba(255, 255, 255, 0.65);
  border-left: 3px solid var(--bubble-bot-accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), inset 0 0 28px rgba(56, 189, 248, 0.16),
    0 18px 44px rgba(2, 8, 24, 0.55), 0 0 24px rgba(56, 189, 248, 0.14);
}
/* Botones Aero: reflejo convexo superior con corte 49 % / 51 %. */
.btn { position: relative; overflow: hidden; }
.btn:not(.ghost)::after {
  content: ""; position: absolute; inset: 1px; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.36) 0%, rgba(255, 255, 255, 0.08) 49%,
    rgba(255, 255, 255, 0) 49.5%, rgba(0, 0, 0, 0.10) 51%, rgba(0, 0, 0, 0.20) 100%);
}
.btn:hover:not(:disabled), .btn:focus-visible {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 0 0 1px rgba(94, 234, 212, 0.30),
    0 0 28px rgba(56, 189, 248, 0.30), 0 16px 40px rgba(2, 6, 18, 0.55);
}
.avatar-fallback, .avatar-video { filter: drop-shadow(0 0 38px rgba(56, 189, 248, 0.42))
  drop-shadow(0 0 92px rgba(168, 85, 247, 0.22)); }

/* Modo Claro · Crystal Pearl Aero Glass (vidrio blanco hielo con bisel plateado/celeste). */
:root[data-theme="light"] .card, :root[data-theme="light"] .artifact,
:root[data-theme="light"] .pill, :root[data-theme="light"] .emotion-chip,
:root[data-theme="light"] .segmented, :root[data-theme="light"] dialog.session,
:root[data-theme="light"] .server-log, :root[data-theme="light"] .table-wrap,
body.theme-light .card, body.theme-light .artifact, body.theme-light .pill,
body.theme-light .emotion-chip, body.theme-light .segmented, body.theme-light dialog.session,
body.theme-light .server-log, body.theme-light .table-wrap {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.52) 0%, rgba(255, 255, 255, 0.30) 40%,
    rgba(240, 248, 255, 0.38) 40.5%, rgba(248, 250, 252, 0.46) 100%);
  backdrop-filter: blur(28px) saturate(210%) brightness(1.08);
  -webkit-backdrop-filter: blur(28px) saturate(210%) brightness(1.08);
  border: 1px solid rgba(125, 211, 252, 0.55);
  border-top: 1px solid rgba(255, 255, 255, 0.98);
  border-left: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 1px 0 #ffffff, inset 0 0 28px rgba(56, 189, 248, 0.12),
    0 18px 40px rgba(24, 16, 48, 0.12), 0 0 20px rgba(56, 189, 248, 0.10);
}
:root[data-theme="light"] .msg.bot, body.theme-light .msg.bot {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.56) 0%, rgba(240, 248, 255, 0.36) 44%,
    rgba(255, 255, 255, 0.50) 100%);
  border: 1px solid rgba(125, 211, 252, 0.55);
  border-left: 3px solid var(--bubble-bot-accent);
  box-shadow: inset 0 1px 0 #ffffff, 0 14px 34px rgba(24, 16, 48, 0.12);
}
@media (max-width: 1023.98px) {
  .card, .artifact, .msg.bot, .pill, .segmented, dialog.session {
    backdrop-filter: blur(18px) saturate(170%);
    -webkit-backdrop-filter: blur(18px) saturate(170%);
  }
}

/* Fase 33 · botón compacto de sonidos UI (se inyecta en la barra superior). */
.ui-sfx-toggle {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto;
  border: 1px solid rgba(165, 243, 252, 0.38); background: rgba(10, 18, 34, 0.38);
  color: var(--aqua); font: 700 15px/1 var(--mono); cursor: pointer;
  backdrop-filter: blur(18px) saturate(200%);
  transition: transform 120ms ease, border-color 120ms ease, opacity 120ms ease;
}
.ui-sfx-toggle:hover { transform: scale(1.06); border-color: var(--aqua); }
.ui-sfx-toggle:active { transform: scale(0.94); }
.ui-sfx-toggle.is-muted { opacity: 0.55; color: var(--dim); }

/* Fase 34 · descarga del APK con QR local dentro del panel de cuentas. */
.apk-card {
  display: grid; gap: 8px; margin: 12px; padding: 14px; border-radius: 14px;
  background: var(--raised); border: 1px solid var(--line);
}
.apk-card p { color: var(--dim); font-size: 12px; line-height: 1.5; }
.apk-card img {
  width: 148px; height: 148px; margin: 0 auto; padding: 6px; border-radius: 8px;
  background: #ffffff; image-rendering: pixelated;
}
.apk-card .btn { justify-self: start; }

/* Fase 33 · Consola de Tráfico multi-usuario y diagnóstico Fish Audio. */
.traffic-row { gap: 6px; }
.traffic-task { color: var(--ink); font-size: 12.5px; line-height: 1.45; overflow-wrap: anywhere; }
.fish-grid { display: grid; gap: 6px; margin-top: 8px; }
.fish-key {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px;
  padding: 7px 9px; border-radius: 14px; border: 1px solid rgba(165, 243, 252, 0.22);
  background: rgba(7, 13, 26, 0.28);
}
.fish-key .btn { grid-column: 1 / -1; justify-self: start; }

/* Fase 34.3 · memoria auditable en el panel lateral */
.memory-head { display: flex; flex-direction: column; gap: 2px; padding: 12px 12px 0; }
.memory-head strong { font-size: var(--fs-sm); }
.memory-head small { color: var(--dim); line-height: 1.35; }
.memory-form { display: flex; gap: 6px; padding: 8px 12px 4px; }
.memory-form input {
  flex: 1; min-width: 0; min-height: var(--tap); border-radius: var(--r-sm);
  border: 1px solid var(--spec); background: rgba(255, 255, 255, 0.06);
  color: var(--ink); padding: 0 10px; font: inherit;
}
.memory-form input:focus-visible { outline: 2px solid var(--mint); outline-offset: 1px; }
.memory-note { display: flex; flex-direction: column; gap: 6px; }
.memory-note p { margin: 0; line-height: 1.42; overflow-wrap: anywhere; }
.memory-note small { color: var(--dim); font-variant-numeric: tabular-nums; }
.memory-note .btn { align-self: flex-end; }
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { white-space: nowrap; }

/* Fase 34.3 · cinco pestañas y tarjetas de memoria sin recortes */
.rail, .panels, .panel, .list, .memory-note, .memory-form { min-width: 0; }
.tabs { flex-wrap: wrap; }
.tab { flex: 1 1 calc(33.333% - 4px); min-width: 0; }
.memory-note, .memory-note p { max-width: 100%; box-sizing: border-box; }
.memory-form input { width: 100%; box-sizing: border-box; }
