/* ============================================================
   VB Lina — styles.css
   v9.2 — Producción lista
   · Añadido: búsqueda en drawer, rename inline, modal eliminar,
     spinner de carga, error con retry, focus trap visual.
   · Bump de todas las clases .conv-* para coherencia.
   ============================================================ */

:root {
    --bg-0: #05060d;
    --bg-1: #070912;
    --bg-2: #0a0d1a;

    --line: rgba(255, 255, 255, 0.04);
    --line-strong: rgba(255, 255, 255, 0.08);
    --line-focus: rgba(120, 150, 255, 0.3);

    --text: #d5dbf0;
    --text-soft: #a8b3d3;
    --text-dim: #8b97b8;
    --muted: #5a6588;

    --user-bg: rgba(99, 102, 241, 0.14);
    --user-bg-hover: rgba(99, 102, 241, 0.18);
    --brain-txt: #e6ebf7;

    --accent-online:   #5ee8b8;
    --accent-thinking: #a17bff;
    --accent-offline:  #ff6b8a;

    --violet: #a17bff;
    --blue: #5468c9;

    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 999px;

    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

    --drawer-w: 340px;
    --drawer-z: 45;
    --drawer-backdrop-z: 44;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    overflow: hidden;
    background: var(--bg-0);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    font-weight: 400;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

[hidden] { display: none !important; }

/* ============================================================
   SR-ONLY
   ============================================================ */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ============================================================
   CANVAS (Ser)
   ============================================================ */
#being {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    display: block;
    z-index: 0;
    background:
        radial-gradient(1200px 800px at 50% 30%, rgba(40, 30, 90, 0.35), transparent 60%),
        radial-gradient(900px 700px at 50% 90%, rgba(0, 120, 160, 0.10), transparent 60%),
        var(--bg-0);
    transition: filter 2s ease, opacity 2s ease, transform 0.6s var(--ease);
}

body.offline #being { filter: grayscale(0.85) brightness(0.55); opacity: 0.75; }
body.thinking #being { filter: brightness(1.06) saturate(1.08); }
body.chat-open #being { transform: translateY(-10vh) scale(0.85); }
body.conv-drawer-open #being { transform: translateX(12vw) scale(0.94); filter: brightness(0.72) blur(2px); }

/* ============================================================
   WHISPERS
   ============================================================ */
.whisper-layer {
    position: fixed;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s var(--ease);
}
body.chat-open .whisper-layer { opacity: 0; }
body.conv-drawer-open .whisper-layer { opacity: 0; }

.whisper {
    position: absolute;
    max-width: min(640px, 82vw);
    padding: 16px 24px;
    font-family: 'Instrument Serif', serif;
    font-size: clamp(18px, 2.4vw, 28px);
    line-height: 1.4;
    color: #eaf0ff;
    text-align: center;
    text-shadow: 0 0 30px rgba(160, 200, 255, 0.35), 0 0 60px rgba(120, 90, 255, 0.25);
    opacity: 0;
    transform: translateY(14px) scale(0.96);
    animation: whisperIn 0.8s var(--ease) forwards;
    pointer-events: none;
    word-wrap: break-word;
}
.whisper.user {
    font-style: italic;
    font-size: clamp(14px, 1.7vw, 18px);
    color: #b9c6e6;
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.2);
    top: 64%;
    max-width: min(560px, 78vw);
}
.whisper.brain { top: 28%; }
.whisper.fade-out { animation: whisperOut 1s var(--ease) forwards; }

@keyframes whisperIn {
    from { opacity: 0; transform: translateY(16px) scale(0.94); filter: blur(10px); }
    to   { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
@keyframes whisperOut {
    to { opacity: 0; transform: translateY(-18px) scale(1.03); filter: blur(8px); }
}

/* ============================================================
   CHAT PILL
   ============================================================ */
.chat-pill {
    position: fixed;
    left: 50%;
    bottom: calc(30px + env(safe-area-inset-bottom, 0));
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 22px 12px 18px;
    border-radius: var(--radius-full);
    background: rgba(16, 22, 44, 0.72);
    border: 1px solid var(--line-strong);
    backdrop-filter: blur(24px) saturate(140%);
    -webkit-backdrop-filter: blur(24px) saturate(140%);
    color: #c8d3ee;
    font-family: inherit;
    font-size: 14px;
    font-style: italic;
    cursor: pointer;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    transition: all 0.35s var(--ease);
    opacity: 0.9;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.chat-pill:hover, .chat-pill:focus-visible {
    opacity: 1;
    border-color: rgba(120, 150, 255, 0.4);
    color: #eaf0ff;
    transform: translateX(-50%) translateY(-2px);
}
.chat-pill-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-online);
    box-shadow: 0 0 10px var(--accent-online);
    animation: pillDot 2.4s ease-in-out infinite;
}
@keyframes pillDot { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
body.chat-open .chat-pill {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(20px);
}
body.conv-drawer-open .chat-pill {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(20px);
}

/* ============================================================
   BOTONES SUPERIORES
   ============================================================ */
.install-btn, .world-btn, .reset-btn, .tuning-trigger, .lang-btn, .auth-btn,
.hamburger-btn {
    position: fixed;
    z-index: 25;
    background: rgba(16, 22, 44, 0.6);
    border: 1px solid var(--line-strong);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: #c8d3ee;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s var(--ease);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.install-btn {
    top: calc(18px + env(safe-area-inset-top, 0));
    left: 18px;
    padding: 8px 12px;
    border-radius: var(--radius-full);
    gap: 6px;
    font-size: 12px;
}
.install-btn svg { color: rgba(161, 123, 255, 0.9); }
.install-btn .install-btn-text { display: none; }

.hamburger-btn {
    top: calc(18px + env(safe-area-inset-top, 0));
    left: 18px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    padding: 0;
}
.hamburger-btn svg { color: rgba(201, 184, 255, 0.95); }
.hamburger-btn:hover {
    color: #f5f7ff;
    border-color: rgba(161, 123, 255, 0.5);
    background: rgba(30, 26, 60, 0.8);
    transform: translateY(-1px);
}
.hamburger-btn[aria-expanded="true"] {
    background: rgba(161, 123, 255, 0.15);
    border-color: rgba(161, 123, 255, 0.55);
    color: #eaf0ff;
}

body.is-authed .install-btn {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(-15px);
}

.world-btn, .reset-btn, .tuning-trigger, .lang-btn, .auth-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}
.world-btn  { top: calc(64px  + env(safe-area-inset-top, 0)); left: 18px; }
.auth-btn   { top: calc(110px + env(safe-area-inset-top, 0)); left: 18px; }

.reset-btn       { top: calc(18px + env(safe-area-inset-top, 0)); right: 18px; }
.tuning-trigger  { top: calc(18px + env(safe-area-inset-top, 0)); right: 68px; }
.lang-btn {
    top: calc(18px + env(safe-area-inset-top, 0));
    right: 118px;
    width: auto;
    min-width: 40px;
    padding: 0 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    appearance: none;
    -webkit-appearance: none;
}

.world-btn:hover, .reset-btn:hover, .tuning-trigger:hover,
.lang-btn:hover, .auth-btn:hover, .install-btn:hover {
    color: #f5f7ff;
    border-color: rgba(161, 123, 255, 0.5);
    background: rgba(30, 26, 60, 0.8);
    transform: translateY(-1px);
}

.world-btn-dot {
    position: absolute;
    top: 4px; right: 4px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--accent-online);
    box-shadow: 0 0 10px var(--accent-online);
    animation: pillDot 2.4s infinite;
}
.world-btn-dot[hidden] { display: none !important; }

.lang-btn option { background: var(--bg-0); color: var(--text); }

body.chat-open .install-btn, body.chat-open .world-btn, body.chat-open .auth-btn,
body.chat-open .reset-btn, body.chat-open .tuning-trigger, body.chat-open .lang-btn,
body.chat-open .voice-top-btn,
body.chat-open .hamburger-btn,
body.voice-mode-active .install-btn, body.voice-mode-active .world-btn,
body.voice-mode-active .auth-btn, body.voice-mode-active .reset-btn,
body.voice-mode-active .tuning-trigger, body.voice-mode-active .lang-btn,
body.voice-mode-active .hamburger-btn,
body.conv-drawer-open .install-btn, body.conv-drawer-open .world-btn,
body.conv-drawer-open .auth-btn, body.conv-drawer-open .reset-btn,
body.conv-drawer-open .tuning-trigger, body.conv-drawer-open .lang-btn,
body.conv-drawer-open .voice-top-btn {
    opacity: 0;
    pointer-events: none !important;
    transform: translateY(-15px);
}

/* ============================================================
   BOTÓN DE VOZ (Top Centro)
   ============================================================ */
.voice-top-btn {
    position: fixed;
    top: calc(18px + env(safe-area-inset-top, 0));
    left: 50%;
    transform: translateX(-50%);
    z-index: 25;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px 10px 18px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(161, 123, 255, 0.35);
    background: linear-gradient(180deg, rgba(30, 26, 60, 0.85), rgba(16, 22, 44, 0.78));
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    color: #d5dbf0;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s var(--ease);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
    touch-action: manipulation;
}
.voice-top-btn:hover {
    border-color: rgba(161, 123, 255, 0.65);
    transform: translateX(-50%) translateY(-1px);
}

/* ============================================================
   INSTALL BANNER
   ============================================================ */
.install-banner {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 55;
    padding: 16px 20px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0));
    background: rgba(16, 22, 44, 0.96);
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    border-top: 1px solid var(--line-strong);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateY(100%);
    transition: transform 0.4s var(--ease-out);
    pointer-events: none;
    box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.5);
}
.install-banner.visible {
    transform: translateY(0);
    pointer-events: auto;
}
.install-banner-inner {
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 640px;
    margin: 0 auto;
}
.install-banner-icon { flex-shrink: 0; }
.install-banner-icon img {
    display: block;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}
.install-banner-body {
    flex: 1;
    min-width: 0;
}
.install-banner-body h2 {
    font-family: 'Instrument Serif', serif;
    font-weight: 400;
    font-size: 17px;
    color: #eaf0ff;
    line-height: 1.2;
    margin-bottom: 3px;
}
.install-banner-body p {
    font-size: 12.5px;
    color: var(--text-dim);
    line-height: 1.45;
}
.install-banner-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.install-banner-btn {
    padding: 8px 14px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s var(--ease);
    white-space: nowrap;
    touch-action: manipulation;
}
.install-banner-btn.primary {
    background: linear-gradient(135deg, #5468c9, #7a58b5);
    color: #f5f7ff;
    box-shadow: 0 4px 12px rgba(84, 104, 201, 0.3);
}
.install-banner-btn.ghost {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--line-strong);
    color: var(--text-soft);
}
.install-banner-btn:hover { filter: brightness(1.12); }

.install-banner.ios .install-banner-body p {
    font-size: 12px;
    line-height: 1.55;
}
.install-banner.ios .share-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    vertical-align: middle;
    margin: 0 2px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
@media (max-width: 520px) {
    .install-banner-inner { flex-wrap: wrap; }
    .install-banner-actions { width: 100%; justify-content: flex-end; }
}

/* ============================================================
   CONVERSATION DRAWER
   ============================================================ */
.conv-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: var(--drawer-backdrop-z);
    background: rgba(3, 4, 10, 0.62);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.3s var(--ease);
    pointer-events: none;
}
.conv-drawer-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

.conv-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: var(--drawer-z);
    width: var(--drawer-w);
    max-width: 88vw;
    display: flex;
    flex-direction: column;
    background: rgba(10, 13, 26, 0.97);
    border-right: 1px solid var(--line-strong);
    backdrop-filter: blur(28px) saturate(150%);
    -webkit-backdrop-filter: blur(28px) saturate(150%);
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.55);
    transform: translateX(-105%);
    transition: transform 0.35s var(--ease-out), opacity 0.25s var(--ease);
    opacity: 0;
    pointer-events: none;
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.conv-drawer.visible {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

/* Head */
.conv-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 18px 14px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}
.conv-drawer-head h2 {
    font-family: 'Instrument Serif', serif;
    font-weight: 400;
    font-size: 19px;
    color: #eaf0ff;
    letter-spacing: 0.1px;
}
.conv-drawer-close {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-dim);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    touch-action: manipulation;
}
.conv-drawer-close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #eaf0ff;
}
.conv-drawer-close:focus-visible {
    outline: 2px solid rgba(161, 123, 255, 0.6);
    outline-offset: 2px;
}

/* ── NUEVO v9.2: búsqueda ── */
.conv-drawer-search {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}
.conv-search-input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    background: rgba(20, 25, 45, 0.6);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    outline: none;
    transition: all 0.2s var(--ease);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b97b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='M21 21l-4.35-4.35'/></svg>");
    background-repeat: no-repeat;
    background-position: 12px center;
    background-size: 16px;
}
.conv-search-input::placeholder {
    color: var(--muted);
    font-style: italic;
}
.conv-search-input:focus {
    border-color: var(--line-focus);
    background-color: rgba(25, 30, 55, 0.8);
    box-shadow: 0 0 0 3px rgba(120, 150, 255, 0.08);
}
.conv-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

/* Actions */
.conv-drawer-actions {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}
.conv-new-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(161, 123, 255, 0.35);
    background: rgba(161, 123, 255, 0.10);
    color: #eaf0ff;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    touch-action: manipulation;
}
.conv-new-btn:hover {
    background: rgba(161, 123, 255, 0.18);
    border-color: rgba(161, 123, 255, 0.55);
    transform: translateY(-1px);
}
.conv-new-btn svg { color: rgba(201, 184, 255, 0.95); flex-shrink: 0; }

/* List */
.conv-drawer-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(140, 180, 255, 0.15) transparent;
    -webkit-overflow-scrolling: touch;
}
.conv-drawer-list::-webkit-scrollbar { width: 6px; }
.conv-drawer-list::-webkit-scrollbar-thumb {
    background: rgba(140, 180, 255, 0.15);
    border-radius: 3px;
}

.conv-drawer-empty {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    font-style: italic;
    padding: 32px 16px;
    line-height: 1.5;
}

/* ── NUEVO v9.2: loading spinner ── */
.conv-drawer-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 16px;
    color: var(--muted);
    font-size: 13px;
}
.conv-spinner {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(161, 123, 255, 0.2);
    border-top-color: var(--violet);
    animation: convSpin 0.9s linear infinite;
}
@keyframes convSpin {
    to { transform: rotate(360deg); }
}

/* ── NUEVO v9.2: error con retry ── */
.conv-drawer-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px 16px;
    text-align: center;
    color: #ffa8b8;
}
.conv-drawer-error svg {
    color: #ffa8b8;
    opacity: 0.8;
}
.conv-drawer-error p {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-soft);
    max-width: 220px;
}
.conv-retry-btn {
    padding: 8px 18px;
    border-radius: 8px;
    border: 1px solid rgba(161, 123, 255, 0.4);
    background: rgba(161, 123, 255, 0.12);
    color: #eaf0ff;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    touch-action: manipulation;
}
.conv-retry-btn:hover {
    background: rgba(161, 123, 255, 0.22);
    border-color: rgba(161, 123, 255, 0.6);
}

.conv-item {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 2px;
    border-radius: 10px;
    transition: background 0.15s var(--ease);
}
.conv-item:hover { background: rgba(255, 255, 255, 0.04); }
.conv-item.active {
    background: rgba(161, 123, 255, 0.12);
    box-shadow: inset 2px 0 0 rgba(161, 123, 255, 0.6);
}
.conv-item.archived .conv-item-title {
    color: var(--text-soft);
}

.conv-item-open {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    color: var(--text);
    border-radius: 10px;
    transition: color 0.15s var(--ease);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.conv-item-open:hover { color: #eaf0ff; }
.conv-item-open:focus-visible {
    outline: 2px solid rgba(161, 123, 255, 0.55);
    outline-offset: -2px;
    border-radius: 10px;
}

.conv-item-title {
    display: block;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.35;
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.conv-item-time {
    display: block;
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── NUEVO v9.2: renombrar inline ── */
.conv-item-rename-input {
    width: 100%;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 500;
    color: #f0f3ff;
    background: rgba(20, 25, 45, 0.9);
    border: 1px solid var(--line-focus);
    border-radius: 6px;
    padding: 4px 8px;
    outline: none;
    box-shadow: 0 0 0 3px rgba(120, 150, 255, 0.1);
    line-height: 1.35;
}

.conv-item-rename {
    flex-shrink: 0;
    width: 32px;
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    border-radius: 8px;
    display: grid;
    place-items: center;
    opacity: 0;
    transition: all 0.15s var(--ease);
    touch-action: manipulation;
}
.conv-item:hover .conv-item-rename,
.conv-item:focus-within .conv-item-rename { opacity: 1; }
.conv-item-rename:hover {
    background: rgba(161, 123, 255, 0.12);
    color: #c9b8ff;
}

.conv-item-delete {
    flex-shrink: 0;
    width: 32px;
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    border-radius: 8px;
    display: grid;
    place-items: center;
    opacity: 0;
    transition: all 0.15s var(--ease);
    touch-action: manipulation;
}
.conv-item:hover .conv-item-delete,
.conv-item:focus-within .conv-item-delete { opacity: 1; }
.conv-item-delete:hover {
    background: rgba(255, 107, 138, 0.12);
    color: #ffa8b8;
}
@media (hover: none) {
    .conv-item-delete,
    .conv-item-rename { opacity: 0.6; }
}

/* Foot */
.conv-drawer-foot {
    flex-shrink: 0;
    padding: 12px 14px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}
.conv-drawer-foot a {
    color: var(--text-dim);
    text-decoration: none;
    transition: color 0.2s var(--ease);
}
.conv-drawer-foot a:hover { color: #eaf0ff; }

/* ── NUEVO v9.2: modal custom de eliminar ── */
.conv-delete-modal {
    position: fixed;
    inset: 0;
    z-index: 95;
    display: grid;
    place-items: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s var(--ease);
    pointer-events: none;
}
.conv-delete-modal.visible {
    opacity: 1;
    pointer-events: auto;
}
.conv-delete-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 4, 10, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.conv-delete-content {
    position: relative;
    z-index: 1;
    width: min(400px, 100%);
    padding: 28px 24px 20px;
    background: rgba(16, 22, 44, 0.98);
    border: 1px solid rgba(255, 107, 138, 0.25);
    border-radius: var(--radius-lg);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    text-align: center;
    transform: translateY(10px) scale(0.96);
    transition: transform 0.3s var(--ease-out);
}
.conv-delete-modal.visible .conv-delete-content { transform: translateY(0) scale(1); }
.conv-delete-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 107, 138, 0.12);
    color: #ffa8b8;
    border: 1px solid rgba(255, 107, 138, 0.3);
}
.conv-delete-title {
    font-family: 'Instrument Serif', serif;
    font-weight: 400;
    font-size: 22px;
    color: #f0f3ff;
    margin-bottom: 10px;
    letter-spacing: -0.01em;
    line-height: 1.2;
}
.conv-delete-body {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-soft);
    margin-bottom: 22px;
    word-break: break-word;
}
.conv-delete-actions {
    display: flex;
    gap: 8px;
}
.conv-delete-btn {
    flex: 1;
    padding: 11px 18px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s var(--ease);
    touch-action: manipulation;
}
.conv-delete-btn.ghost {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--line-strong);
    color: var(--text);
}
.conv-delete-btn.ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #eaf0ff;
}
.conv-delete-btn.danger {
    background: linear-gradient(135deg, #d94a6b, #b53a8f);
    color: #fff;
    box-shadow: 0 8px 20px rgba(217, 74, 107, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.conv-delete-btn.danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(217, 74, 107, 0.4);
}

/* ============================================================
   CHAT — CONTENEDOR
   ============================================================ */
.chat {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: min(80vh, 800px);
    z-index: 30;
    display: flex;
    flex-direction: column;
    background: rgba(8, 11, 22, 0.85);
    border-top: 1px solid var(--line-strong);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    backdrop-filter: blur(40px) saturate(150%);
    -webkit-backdrop-filter: blur(40px) saturate(150%);
    box-shadow: 0 -24px 60px rgba(0, 0, 0, 0.5);
    transform: translateY(100%);
    transition: transform 0.45s var(--ease-out);
    will-change: transform;
    pointer-events: none;
}
.chat.open {
    transform: translateY(0);
    pointer-events: auto;
}
.chat:not(.open) > * {
    pointer-events: none !important;
}

@media (min-width: 900px) {
    .chat {
        left: 50%;
        transform: translate(-50%, 100%);
        width: min(800px, 90vw);
        border: 1px solid var(--line-strong);
        border-bottom: none;
    }
    .chat.open { transform: translate(-50%, 0); }
}

/* ============================================================
   HEADER DEL CHAT
   ============================================================ */
.chat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 14px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
    position: relative;
    z-index: 50;
    pointer-events: auto;
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}
.chat-title-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.chat-avatar {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: conic-gradient(from 200deg, #5468c9, #7a58b5, #5468c9);
    box-shadow: 0 0 16px rgba(84, 104, 201, 0.3);
    flex-shrink: 0;
}
.chat-avatar::after {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 50%;
    background: var(--bg-0);
}
.chat-avatar::before {
    content: '';
    position: absolute;
    right: -2px; bottom: -2px;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--accent-online);
    border: 2px solid var(--bg-0);
    box-shadow: 0 0 8px rgba(94, 232, 184, 0.6);
    z-index: 1;
    transition: all 0.3s var(--ease);
}
body.offline  .chat-avatar::before { background: var(--accent-offline); }
body.thinking .chat-avatar::before { background: var(--accent-thinking); }

.chat-title h2 {
    font-family: 'Instrument Serif', serif;
    font-weight: 400;
    font-size: 18px;
    color: #eaf0ff;
    line-height: 1.1;
    letter-spacing: 0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chat-status {
    display: block;
    font-size: 10px;
    color: var(--muted);
    letter-spacing: 1.4px;
    text-transform: uppercase;
    margin-top: 4px;
    font-weight: 500;
    white-space: nowrap;
}
.chat-status.online   { color: rgba(94, 232, 184, 0.75); }
.chat-status.thinking { color: rgba(161, 123, 255, 0.9); }
.chat-status.offline  { color: rgba(255, 107, 138, 0.85); }

.chat-head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    position: relative;
    z-index: 60;
    pointer-events: auto;
}

.usage-badge {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.03em;
    color: rgba(160, 175, 210, 0.75);
    background: rgba(20, 25, 45, 0.7);
    border: 1px solid rgba(120, 150, 255, 0.15);
    padding: 3px 8px;
    border-radius: 999px;
    pointer-events: none;
}
.usage-badge.warn   { color: rgba(255, 200, 120, 0.95); border-color: rgba(255, 200, 120, 0.3); background: rgba(255, 200, 120, 0.08); }
.usage-badge.danger { color: #ffa8b8; border-color: rgba(255, 107, 138, 0.4); background: rgba(255, 107, 138, 0.1); }

.chat-user-name {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    color: rgba(161, 123, 255, 0.9);
    font-weight: 500;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(161, 123, 255, 0.08);
    border: 1px solid rgba(161, 123, 255, 0.2);
    pointer-events: none;
}

.chat-guest-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    padding: 0 14px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #05060d;
    background: var(--accent-online);
    border-radius: var(--radius-full);
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s var(--ease);
    box-shadow: 0 2px 8px rgba(94, 232, 184, 0.2);
    pointer-events: auto;
    touch-action: manipulation;
}
.chat-guest-login:hover {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(94, 232, 184, 0.35);
}

.chat-close {
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    width: 44px;
    height: 44px;
    margin: -6px -10px -6px 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--text-dim);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.2s var(--ease);
    pointer-events: auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.chat-close:hover  { color: #eaf0ff; background: rgba(255, 255, 255, 0.08); }
.chat-close:active { transform: scale(0.90); }
.chat-close svg    { display: block; pointer-events: none; }

/* ============================================================
   BODY DEL CHAT
   ============================================================ */
.chat-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 24px 22px 12px;
    display: flex;
    flex-direction: column;
    gap: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(140, 180, 255, 0.15) transparent;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 1;
}
.chat-body::-webkit-scrollbar { width: 6px; }
.chat-body::-webkit-scrollbar-thumb {
    background: rgba(140, 180, 255, 0.15);
    border-radius: 3px;
}

.chat-empty {
    position: relative;
    text-align: center;
    color: rgba(160, 180, 220, 0.5);
    font-family: 'Instrument Serif', serif;
    font-size: 18px;
    font-style: italic;
    padding: 80px 24px;
    line-height: 1.6;
}
.chat-empty::before {
    content: '';
    display: block;
    width: 54px;
    height: 54px;
    margin: 0 auto 24px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(161, 123, 255, 0.3), rgba(84, 104, 201, 0.05));
    border: 1px solid rgba(161, 123, 255, 0.25);
    box-shadow: 0 0 30px rgba(161, 123, 255, 0.2);
    animation: emptyOrb 4s ease-in-out infinite;
}
@keyframes emptyOrb {
    0%, 100% { transform: scale(1); opacity: 0.85; }
    50%      { transform: scale(1.08); opacity: 1; }
}

/* ============================================================
   MENSAJES
   ============================================================ */
.bubble {
    position: relative;
    font-size: 15.5px;
    line-height: 1.65;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    animation: bubbleIn 0.35s var(--ease-out);
    will-change: transform, opacity;
    margin-top: 22px;
    transition: margin-top 0.25s var(--ease);
}
.bubble:first-child  { margin-top: 0; }
.bubble.continues    { margin-top: 8px; }

@keyframes bubbleIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.bubble.user {
    align-self: flex-end;
    max-width: min(80%, 620px);
    padding: 10px 16px;
    background: var(--user-bg);
    color: #f5f7ff;
    border-radius: 18px;
    border-bottom-right-radius: 6px;
    font-weight: 400;
    letter-spacing: 0.1px;
    transition: background 0.2s var(--ease);
}
.bubble.user:hover { background: var(--user-bg-hover); }
.bubble.user.continues { border-top-right-radius: 6px; }
.bubble.user:has(+ .bubble.continues) { border-bottom-right-radius: 6px; }

.bubble.brain {
    align-self: stretch;
    max-width: 100%;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    color: var(--brain-txt);
    font-family: 'Instrument Serif', serif;
    font-size: 18px;
    line-height: 1.68;
    letter-spacing: 0.15px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.bubble-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-top: 10px;
    opacity: 0;
    transition: opacity 0.2s var(--ease);
}
.bubble:hover .bubble-actions,
.bubble-actions:focus-within { opacity: 1; }

.bubble-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: rgba(160, 175, 210, 0.55);
    cursor: pointer;
    transition: background 0.15s var(--ease), color 0.15s var(--ease);
    touch-action: manipulation;
}
.bubble-action-btn:hover     { background: rgba(255, 255, 255, 0.08); color: #eaf0ff; }
.bubble-action-btn.copied    { color: var(--accent-online); background: rgba(94, 232, 184, 0.10); }
.bubble-action-btn.active    { color: var(--accent-online); }
.bubble-action-btn.active:hover { background: rgba(94, 232, 184, 0.15); }

@media (hover: none) { .bubble-actions { opacity: 0.85; } }

.bubble.error {
    align-self: center;
    background: rgba(255, 107, 138, 0.10);
    border: 1px solid rgba(255, 107, 138, 0.22);
    color: #ffa8b8;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    border-radius: 12px;
    padding: 10px 16px;
    max-width: 80%;
}

.bubble-images {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.bubble-images img {
    display: block;
    max-width: 200px;
    max-height: 200px;
    border-radius: 12px;
}

/* ============================================================
   TYPING INDICATOR
   ============================================================ */
.chat-typing {
    align-self: flex-start;
    padding: 6px 2px;
    display: inline-flex;
    gap: 5px;
    align-items: center;
    margin-top: 14px;
    animation: bubbleIn 0.3s var(--ease-out);
}
.chat-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(200, 210, 240, 0.55);
    animation: typingDot 1.4s infinite ease-in-out;
}
.chat-typing span:nth-child(2) { animation-delay: 0.18s; }
.chat-typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes typingDot {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
    30%           { transform: translateY(-3px); opacity: 1; }
}

/* ============================================================
   COMPOSER
   ============================================================ */
.chat-composer {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px 20px 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0));
    background: transparent;
    position: relative;
    z-index: 2;
}
.composer-input-row {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 6px 8px 6px 6px;
    background: rgba(20, 25, 45, 0.6);
    border: 1px solid var(--line-strong);
    border-radius: 28px;
    transition: all 0.3s var(--ease);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}
.composer-input-row:focus-within {
    border-color: var(--line-focus);
    background: rgba(25, 30, 55, 0.8);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3), 0 0 0 3px rgba(120, 150, 255, 0.05);
}
.attach-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: rgba(160, 175, 210, 0.7);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.2s var(--ease);
    touch-action: manipulation;
}
.attach-btn:hover:not(:disabled) { color: #fff; background: rgba(255, 255, 255, 0.05); }
.attach-btn:disabled              { opacity: 0.4; cursor: not-allowed; }

#input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    color: #eaf0ff;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    padding: 10px 8px;
    min-height: 44px;
    max-height: 150px;
}
#input::placeholder { color: var(--muted); font-style: italic; }

#send {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.25s var(--ease);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
    touch-action: manipulation;
}
#send:hover:not(:disabled) { transform: scale(1.05); filter: brightness(1.1); }
#send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(0.5);
    box-shadow: none;
}

/* ============================================================
   ADJUNTOS
   ============================================================ */
.chat-attachments {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    max-height: 120px;
    overflow-y: auto;
}
.attachment-thumb {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    background: rgba(8, 12, 24, 0.7);
    animation: attachIn 0.25s var(--ease-out);
}
.attachment-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.attachment-remove {
    position: absolute;
    top: 4px; right: 4px;
    width: 20px; height: 20px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 0.2s;
}
.attachment-remove:hover { background: rgba(217, 74, 107, 0.9); }

@keyframes attachIn {
    from { opacity: 0; transform: scale(0.8); }
    to   { opacity: 1; transform: scale(1); }
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
    position: fixed;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    z-index: 999;
    padding: 12px 20px;
    border-radius: var(--radius-full);
    background: rgba(16, 22, 44, 0.9);
    border: 1px solid var(--line-strong);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    font-size: 13px;
    color: #fff;
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s var(--ease);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    max-width: min(90vw, 480px);
    text-align: center;
    line-height: 1.4;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.toast.error { border-color: rgba(255, 107, 138, 0.4); color: #ffa8b8; }
body.chat-open .toast { bottom: calc(min(80vh, 800px) + 20px); }

/* ============================================================
   VOICE MODE
   ============================================================ */
.voice-mode {
    position: fixed;
    inset: 0;
    z-index: 60;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s var(--ease);
    background: radial-gradient(circle at 50% 50%, rgba(5, 6, 13, 0) 0%, rgba(5, 6, 13, 0.7) 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.voice-mode.visible {
    opacity: 1;
    pointer-events: auto;
}
.voice-mode button { pointer-events: auto; }

.voice-mode-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(24px + env(safe-area-inset-top, 0)) 24px 24px;
}
.voice-glass-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(20, 25, 45, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: var(--text-soft);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.2s var(--ease);
    touch-action: manipulation;
}
.voice-glass-btn:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.voice-glass-btn.exit:hover {
    background: rgba(217, 74, 107, 0.2);
    color: #fff;
    border-color: rgba(217, 74, 107, 0.4);
}

.voice-mode-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0));
    gap: 30px;
}
.voice-status-text {
    font-family: 'Instrument Serif', serif;
    font-size: 24px;
    color: #eaf0ff;
    text-shadow: 0 0 20px rgba(161, 123, 255, 0.6);
    opacity: 0.8;
    transition: opacity 0.3s;
    animation: pulseText 2.5s infinite;
}
@keyframes pulseText {
    0%, 100% { opacity: 0.5; transform: scale(0.98); }
    50%      { opacity: 1; transform: scale(1.02); }
}

.voice-mic-wrapper { position: relative; display: grid; place-items: center; }
.voice-mic-ring {
    position: absolute;
    inset: -20px;
    border-radius: 50%;
    border: 1px solid rgba(217, 74, 107, 0.4);
    animation: ringPulse 2.5s infinite;
    pointer-events: none;
}
.voice-mic-ring:nth-child(2) { animation-delay: 1.25s; }
@keyframes ringPulse {
    0%   { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(1.6); opacity: 0; }
}

.voice-mic {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #d94a6b, #b53a8f);
    color: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
    box-shadow: 0 0 30px rgba(217, 74, 107, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.3);
    z-index: 2;
    transition: transform 0.2s;
    touch-action: manipulation;
}
.voice-mic:active { transform: scale(0.95); }

body.voice-mode-active #being { transform: scale(1.08); filter: brightness(1.05); }
body.voice-mode-active .chat,
body.voice-mode-active .chat-pill,
body.voice-mode-active .whisper-layer,
body.voice-mode-active .toast {
    opacity: 0;
    pointer-events: none;
}

/* ============================================================
   SENSORY PANEL (Tuning)
   ============================================================ */
.tuning-panel {
    position: fixed;
    top: 72px;
    right: 18px;
    width: min(340px, calc(100vw - 36px));
    max-height: calc(100vh - 100px);
    background: rgba(16, 22, 44, 0.92);
    backdrop-filter: blur(30px) saturate(150%);
    -webkit-backdrop-filter: blur(30px) saturate(150%);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    z-index: 50;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
    transition: all 0.3s var(--ease);
    pointer-events: none;
}
.tuning-panel.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.tuning-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
}
.tuning-head h3 {
    font-family: 'Instrument Serif', serif;
    font-size: 18px;
    font-weight: 400;
    color: #eaf0ff;
}
.tuning-close {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
}
.tuning-close:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.tuning-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
}
.tuning-section { display: flex; flex-direction: column; gap: 12px; }
.tuning-slider { display: flex; flex-direction: column; gap: 8px; }
.tuning-slider-head {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-soft);
}
.tuning-value { color: var(--violet); font-weight: 500; }
.tuning-panel input[type="range"] {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
}
.tuning-panel input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--violet);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(161, 123, 255, 0.5);
}
.tuning-panel input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: none;
    border-radius: 50%;
    background: var(--violet);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(161, 123, 255, 0.5);
}
.tuning-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}
.tuning-toggle input { display: none; }
.tuning-toggle-track {
    width: 36px;
    height: 20px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}
.tuning-toggle-thumb {
    position: absolute;
    top: 2px; left: 2px;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
}
.tuning-toggle input:checked + .tuning-toggle-track { background: var(--violet); }
.tuning-toggle input:checked + .tuning-toggle-track .tuning-toggle-thumb { transform: translateX(16px); }
.tuning-toggle-label { font-size: 13px; color: var(--text-soft); }
.tuning-desc {
    font-size: 11.5px;
    color: var(--muted);
    line-height: 1.4;
    margin-top: -4px;
}
.tuning-subtitle {
    font-family: 'Instrument Serif', serif;
    font-size: 16px;
    color: #eaf0ff;
    margin-bottom: 4px;
}
.tuning-lang-select {
    width: 100%;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    cursor: pointer;
}
.tuning-lang-select option { background: var(--bg-0); color: var(--text); }

/* ============================================================
   ECHO MAP
   ============================================================ */
.echo-map-container {
    width: 100%;
    height: 220px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    overflow: hidden;
    position: relative;
}
.echo-map {
    width: 100%;
    height: 100%;
    display: block;
}
.echo-empty {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    font-size: 12px;
    color: var(--muted);
    font-style: italic;
    text-align: center;
    pointer-events: none;
    line-height: 1.5;
}
.echo-edge {
    stroke: rgba(161, 123, 255, 0.18);
    stroke-width: 0.7;
    fill: none;
}
.echo-node {
    cursor: pointer;
    transition: filter 0.2s var(--ease);
}
.echo-node:focus { outline: none; }
.echo-node:focus-visible .echo-node-circle {
    stroke: var(--violet);
    stroke-width: 2;
}
.echo-node:hover .echo-node-circle {
    filter: brightness(1.25) drop-shadow(0 0 4px rgba(161, 123, 255, 0.6));
}
.echo-node-circle {
    transition: filter 0.2s var(--ease), stroke 0.2s var(--ease);
}
.echo-node-label {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 500;
    fill: rgba(201, 184, 255, 0.75);
    pointer-events: none;
    user-select: none;
}

/* ============================================================
   WORLD PANEL
   ============================================================ */
.world-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}
.world-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}

.world-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -45%) scale(0.95);
    width: min(440px, calc(100vw - 32px));
    background: rgba(16, 22, 44, 0.95);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    z-index: 41;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s var(--ease);
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    max-height: calc(100dvh - 32px);
}
.world-panel.visible {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
}
.world-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}
.world-panel-head h2 {
    font-family: 'Instrument Serif', serif;
    font-size: 20px;
    font-weight: 400;
    color: #eaf0ff;
    line-height: 1.2;
}
.world-panel-close {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-dim);
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    touch-action: manipulation;
}
.world-panel-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}
.world-panel-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-height: 70vh;
    overflow-y: auto;
}
.world-section { display: flex; flex-direction: column; gap: 12px; }
.world-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.world-section-head h3 {
    font-size: 15px;
    color: #eaf0ff;
    font-weight: 500;
    line-height: 1.3;
}
.world-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-dim);
    flex-shrink: 0;
}
.world-badge.active {
    background: rgba(94, 232, 184, 0.15);
    color: var(--accent-online);
}
.world-section-desc {
    font-size: 13px;
    color: var(--text-soft);
    line-height: 1.5;
}
.world-location-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.world-btn-action {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.2s var(--ease);
    touch-action: manipulation;
}
.world-btn-action.primary { background: var(--blue); color: #fff; }
.world-btn-action.primary:hover { filter: brightness(1.15); }
.world-btn-action.ghost {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    border: 1px solid var(--line-strong);
}
.world-btn-action.ghost:hover { background: rgba(255, 255, 255, 0.1); }
.world-btn-action:disabled { opacity: 0.5; cursor: not-allowed; }

.world-location-info {
    font-size: 12px;
    color: var(--text-dim);
    background: rgba(0, 0, 0, 0.2);
    padding: 12px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.world-location-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; }
.world-location-value { color: var(--text); }

.world-insights {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.world-insight {
    background: rgba(0, 0, 0, 0.2);
    padding: 12px;
    border-radius: 8px;
    border-left: 2px solid var(--violet);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.world-insight-text { font-size: 13px; color: var(--text); line-height: 1.4; }
.world-insight-when { font-size: 11px; color: var(--muted); align-self: flex-end; }
.world-empty {
    font-size: 13px;
    color: var(--muted);
    text-align: center;
    padding: 20px 0;
    font-style: italic;
    list-style: none;
}

/* ============================================================
   TUTORIAL OVERLAY
   ============================================================ */
.tutorial-overlay {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(5, 6, 13, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s var(--ease);
    pointer-events: none;
    padding: 20px;
}
.tutorial-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}
.tutorial-modal {
    background: rgba(16, 22, 44, 0.95);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    width: min(400px, 100%);
    padding: 32px 24px 24px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.tutorial-skip {
    position: absolute;
    top: 16px; right: 16px;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.2s;
}
.tutorial-skip:hover { color: #fff; }
.tutorial-slide-container {
    margin-bottom: 24px;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.tutorial-icon-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(161, 123, 255, 0.1);
    color: var(--violet);
    display: grid;
    place-items: center;
    margin-bottom: 16px;
}
.tutorial-icon-wrapper svg { width: 32px; height: 32px; }
.tutorial-slide-title {
    font-family: 'Instrument Serif', serif;
    font-size: 22px;
    color: #eaf0ff;
    margin-bottom: 8px;
    line-height: 1.2;
}
.tutorial-slide-desc {
    font-size: 14px;
    color: var(--text-soft);
    line-height: 1.5;
}
.tutorial-footer { display: flex; flex-direction: column; gap: 16px; width: 100%; }
.tutorial-dots { display: flex; justify-content: center; gap: 6px; }
.tutorial-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.3s;
}
.tutorial-dot.active { background: var(--violet); transform: scale(1.3); }
.tutorial-actions { display: flex; justify-content: space-between; gap: 12px; }
.tutorial-btn {
    flex: 1;
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    touch-action: manipulation;
}
.tutorial-btn.ghost { background: transparent; color: var(--text-dim); }
.tutorial-btn.ghost:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.tutorial-btn.primary {
    background: linear-gradient(135deg, var(--blue), var(--violet));
    color: #fff;
    font-weight: 500;
}
.tutorial-btn.primary:hover { filter: brightness(1.1); }

/* ============================================================
   GUEST LIMIT MODAL
   ============================================================ */
.guest-limit-modal {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    place-items: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s var(--ease);
    pointer-events: none;
}
.guest-limit-modal.visible {
    opacity: 1;
    pointer-events: auto;
}
.guest-limit-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 4, 10, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.guest-limit-content {
    position: relative;
    z-index: 1;
    width: min(400px, 100%);
    padding: 32px 26px 24px;
    background: rgba(16, 22, 44, 0.98);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    text-align: center;
    transform: translateY(10px) scale(0.96);
    transition: transform 0.3s var(--ease-out);
}
.guest-limit-modal.visible .guest-limit-content { transform: translateY(0) scale(1); }
.guest-limit-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(161, 123, 255, 0.12);
    color: var(--violet);
    border: 1px solid rgba(161, 123, 255, 0.3);
}
.guest-limit-title {
    font-family: 'Instrument Serif', serif;
    font-weight: 400;
    font-size: 24px;
    color: #f0f3ff;
    margin-bottom: 10px;
    letter-spacing: -0.01em;
    line-height: 1.2;
}
.guest-limit-body {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-soft);
    margin-bottom: 22px;
}
.guest-limit-actions { display: flex; flex-direction: column; gap: 8px; }
.guest-limit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.25s var(--ease);
    touch-action: manipulation;
}
.guest-limit-btn.primary {
    background: linear-gradient(135deg, #5468c9, #7a58b5);
    color: #f5f7ff;
    box-shadow: 0 8px 20px rgba(84, 104, 201, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.guest-limit-btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(84, 104, 201, 0.4);
}
.guest-limit-btn.ghost {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--line-strong);
    color: var(--text);
}
.guest-limit-btn.ghost:hover { background: rgba(255, 255, 255, 0.1); color: #eaf0ff; }
.guest-limit-close {
    position: absolute;
    top: 12px; right: 12px;
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-dim);
    font-size: 22px;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.2s var(--ease);
}
.guest-limit-close:hover { background: rgba(255, 255, 255, 0.06); color: #eaf0ff; }

/* ============================================================
   AUTH PAGES (login, register, reset-password)
   ============================================================ */
.auth-page-body {
    background: var(--bg-0);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    position: relative;
}
.auth-bg-animated {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.auth-bg-animated span {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: authDrift 12s ease-in-out infinite alternate;
}
.auth-bg-animated span:nth-child(1) {
    width: 60vmin; height: 60vmin;
    background: rgba(161, 123, 255, 0.5);
    top: -10%; left: -10%;
}
.auth-bg-animated span:nth-child(2) {
    width: 50vmin; height: 50vmin;
    background: rgba(94, 232, 184, 0.3);
    bottom: -10%; right: -10%;
    animation-delay: -4s;
}
.auth-bg-animated span:nth-child(3) {
    width: 40vmin; height: 40vmin;
    background: rgba(84, 104, 201, 0.5);
    top: 40%; left: 50%;
    animation-delay: -8s;
}
@keyframes authDrift {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(10%, 15%) scale(1.2); }
}

.auth-page-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin: auto;
    animation: authFadeInUp 0.7s var(--ease-out) both;
}
@keyframes authFadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}
.auth-page-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-family: 'Instrument Serif', serif;
    font-size: 32px;
    color: #eaf0ff;
    text-decoration: none;
    text-shadow: 0 0 20px rgba(161, 123, 255, 0.4);
}
.auth-page-logo .brand-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #c9b8ff, var(--violet));
    box-shadow: 0 0 20px var(--violet);
    animation: pulseLogo 2.5s infinite;
}
@keyframes pulseLogo {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(0.85); opacity: 0.7; }
}

.auth-modal-panel {
    position: relative;
    z-index: 1;
    width: 100%;
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    background: rgba(16, 22, 44, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    padding: 34px 28px 24px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
.auth-view { display: block; }
.auth-header { text-align: center; margin-bottom: 20px; }
.auth-title {
    font-family: 'Instrument Serif', serif;
    font-weight: 400;
    font-size: 26px;
    line-height: 1.15;
    color: #f0f3ff;
    letter-spacing: -0.01em;
    margin-bottom: 6px;
}
.auth-subtitle {
    font-size: 13.5px;
    color: var(--text-dim);
    line-height: 1.5;
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-label {
    font-size: 12px;
    color: var(--text-soft);
    font-weight: 500;
    letter-spacing: 0.02em;
}
.auth-field input {
    padding: 11px 14px;
    background: rgba(20, 25, 45, 0.7);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    color: #eaf0ff;
    font-family: inherit;
    font-size: 15px;
    outline: none;
    transition: all 0.2s var(--ease);
    width: 100%;
}
.auth-field input::placeholder { color: var(--muted); }
.auth-field input:focus {
    border-color: var(--line-focus);
    background: rgba(25, 30, 55, 0.9);
    box-shadow: 0 0 0 3px rgba(120, 150, 255, 0.08);
}
.auth-hint { font-size: 11px; color: var(--muted); line-height: 1.4; margin-top: 2px; }
.auth-submit {
    margin-top: 6px;
    padding: 12px 18px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #5468c9, #7a58b5);
    color: #f5f7ff;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(84, 104, 201, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transition: all 0.25s var(--ease);
    touch-action: manipulation;
}
.auth-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(84, 104, 201, 0.4);
}
.auth-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-links { text-align: center; margin-top: 4px; }
.auth-link {
    font-size: 12.5px;
    color: rgba(201, 184, 255, 0.85);
    text-decoration: none;
    transition: color 0.2s var(--ease);
}
.auth-link:hover {
    color: #e0d4ff;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.auth-error {
    background: rgba(255, 107, 138, 0.08);
    border: 1px solid rgba(255, 107, 138, 0.3);
    color: #ffa8b8;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12.5px;
    line-height: 1.5;
    margin-top: 6px;
}
.auth-success {
    background: rgba(94, 232, 184, 0.08);
    border: 1px solid rgba(94, 232, 184, 0.3);
    color: #a8f0d4;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12.5px;
    line-height: 1.5;
    margin-top: 6px;
}

/* ── NUEVO v9.2: caja de éxito del reset ── */
.auth-success-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    margin-top: 16px;
    background: rgba(94, 232, 184, 0.06);
    border: 1px solid rgba(94, 232, 184, 0.25);
    border-radius: 10px;
    animation: authFadeInUp 0.4s var(--ease-out) both;
}
.auth-success-box svg {
    color: var(--accent-online);
    flex-shrink: 0;
    margin-top: 2px;
}
.auth-success-box p {
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--text-soft);
    margin: 0;
}
.auth-success-box:focus { outline: none; }
.auth-success-box:focus-visible {
    outline: 2px solid rgba(94, 232, 184, 0.5);
    outline-offset: 2px;
}

.auth-back-chat {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 10px;
    background: transparent;
    border: none;
    color: var(--muted);
    font-family: inherit;
    font-size: 12.5px;
    cursor: pointer;
    transition: color 0.2s var(--ease);
    text-align: center;
    text-decoration: none;
}
.auth-back-chat:hover { color: #eaf0ff; }

/* ============================================================
   ACCOUNT PANEL
   ============================================================ */
.account-panel {
    position: fixed;
    inset: 0;
    z-index: 75;
    display: grid;
    place-items: center;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.25s var(--ease);
}
.account-panel.visible { opacity: 1; }
.account-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 4, 10, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.account-content {
    position: relative;
    z-index: 1;
    width: min(560px, 100%);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    background: rgba(16, 22, 44, 0.96);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    padding: 30px 26px 22px;
    transform: translateY(8px) scale(0.98);
    transition: transform 0.3s var(--ease-out);
}
.account-panel.visible .account-content { transform: translateY(0) scale(1); }
.account-close {
    position: absolute;
    top: 14px; right: 14px;
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-dim);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.2s var(--ease);
}
.account-close:hover { background: rgba(255, 255, 255, 0.06); color: #eaf0ff; }
.account-title {
    font-family: 'Instrument Serif', serif;
    font-weight: 400;
    font-size: 26px;
    color: #f0f3ff;
    letter-spacing: -0.01em;
    margin-bottom: 22px;
}
.account-section {
    padding: 18px 0;
    border-top: 1px solid var(--line);
}
.account-section:first-of-type { border-top: 0; padding-top: 0; }
.account-section h3 {
    font-family: 'Instrument Serif', serif;
    font-weight: 400;
    font-size: 17px;
    color: #eaf0ff;
    margin-bottom: 12px;
    letter-spacing: 0.01em;
}
.account-info {
    display: grid;
    grid-template-columns: minmax(100px, 30%) 1fr;
    gap: 8px 16px;
    font-size: 13.5px;
    margin-bottom: 12px;
}
.account-info dt { color: var(--text-dim); font-weight: 400; }
.account-info dd { color: #eaf0ff; word-break: break-word; }
.account-usage {
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(84, 104, 201, 0.08);
    border: 1px solid rgba(84, 104, 201, 0.2);
    border-radius: 8px;
    font-size: 12.5px;
    color: var(--text-soft);
    font-variant-numeric: tabular-nums;
}
.account-desc {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.55;
    margin-bottom: 12px;
}
.account-form { display: flex; flex-direction: column; gap: 12px; }
.account-btn {
    align-self: flex-start;
    padding: 10px 18px;
    border-radius: 10px;
    border: 1px solid rgba(84, 104, 201, 0.4);
    background: rgba(84, 104, 201, 0.15);
    color: #eaf0ff;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    touch-action: manipulation;
}
.account-btn:hover {
    background: rgba(84, 104, 201, 0.28);
    border-color: rgba(84, 104, 201, 0.6);
}
.account-btn.ghost {
    background: transparent;
    border-color: var(--line-strong);
    color: var(--text-soft);
}
.account-btn.ghost:hover {
    color: #eaf0ff;
    border-color: rgba(161, 123, 255, 0.4);
    background: rgba(255, 255, 255, 0.04);
}
.account-btn.danger {
    background: rgba(255, 107, 138, 0.12);
    border-color: rgba(255, 107, 138, 0.4);
    color: #ffa8b8;
}
.account-btn.danger:hover {
    background: rgba(255, 107, 138, 0.22);
    border-color: rgba(255, 107, 138, 0.6);
}
.account-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.account-section-danger {
    background: rgba(255, 107, 138, 0.03);
    margin: 0 -26px;
    padding: 18px 26px;
    border-top: 1px solid rgba(255, 107, 138, 0.15);
    border-bottom: 1px solid rgba(255, 107, 138, 0.15);
}
.account-section-danger h3 { color: #ffa8b8; }

/* ============================================================
   SILENT MODE
   ============================================================ */
body.silent-mode .chat-pill,
body.silent-mode .chat,
body.silent-mode .chat-typing,
body.silent-mode .whisper-layer,
body.silent-mode .install-btn,
body.silent-mode .install-banner,
body.silent-mode .reset-btn,
body.silent-mode .voice-top-btn,
body.silent-mode .world-btn,
body.silent-mode .toast,
body.silent-mode .lang-btn,
body.silent-mode .auth-btn,
body.silent-mode .hamburger-btn,
body.silent-mode .conv-drawer,
body.silent-mode .conv-drawer-backdrop {
    opacity: 0 !important;
    pointer-events: none !important;
}
body.silent-mode #being { transform: none !important; }
body.silent-mode .tuning-trigger { opacity: 0.55; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 720px) {
    .chat {
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
        top: 0;
        bottom: 0;
        padding-top: env(safe-area-inset-top, 0);
    }
    .chat-body { padding: 20px 16px 8px; }
    .bubble { font-size: 15px; }
    .bubble.user { padding: 9px 14px; max-width: 86%; }
    .bubble.brain { font-size: 17px; line-height: 1.65; }
    .chat-composer {
        padding: 10px 16px 16px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0));
    }
    .composer-input-row { border-radius: 24px; }

    .voice-top-btn {
        top: calc(64px + env(safe-area-inset-top, 0));
        padding: 8px 14px;
        font-size: 12px;
    }
    .world-btn {
        top: calc(58px + env(safe-area-inset-top, 0));
        left: 14px;
        width: 38px; height: 38px;
    }
    .auth-btn {
        top: calc(102px + env(safe-area-inset-top, 0));
        left: 14px;
        width: 38px; height: 38px;
    }
    .reset-btn {
        top: calc(14px + env(safe-area-inset-top, 0));
        right: 14px;
        width: 38px; height: 38px;
    }
    .tuning-trigger {
        top: calc(14px + env(safe-area-inset-top, 0));
        right: calc(60px + env(safe-area-inset-top, 0));
        width: 38px; height: 38px;
    }
    .lang-btn {
        top: calc(14px + env(safe-area-inset-top, 0));
        right: calc(106px + env(safe-area-inset-top, 0));
        width: auto;
        min-width: 38px;
        height: 38px;
    }
    .install-btn {
        top: calc(14px + env(safe-area-inset-top, 0));
        left: 14px;
        padding: 7px 10px;
    }
    .hamburger-btn {
        top: calc(14px + env(safe-area-inset-top, 0));
        left: 14px;
        width: 38px; height: 38px;
    }

    .conv-drawer {
        width: min(86vw, 340px);
    }
    .conv-item-delete,
    .conv-item-rename {
        width: 36px;
        opacity: 0.7;
    }

    body.chat-open .install-btn,
    body.chat-open .world-btn,
    body.chat-open .auth-btn,
    body.chat-open .reset-btn,
    body.chat-open .tuning-trigger,
    body.chat-open .lang-btn,
    body.chat-open .voice-top-btn,
    body.chat-open .hamburger-btn,
    body.chat-open .chat-pill,
    body.chat-open .whisper-layer,
    body.chat-open #being {
        opacity: 0 !important;
        pointer-events: none !important;
    }

    body.chat-open .toast {
        bottom: calc(100px + env(safe-area-inset-bottom, 0));
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    .chat-empty::before,
    .voice-mic-ring,
    .voice-status-text,
    .conv-spinner { animation: none; }
}

/* ============================================================
   TIPOGRAFÍA CHINA
   ============================================================ */
html[lang="zh"] body,
html[lang="zh"] input,
html[lang="zh"] textarea,
html[lang="zh"] button {
    font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont,
                 system-ui, 'PingFang SC', 'Hiragino Sans GB',
                 'Microsoft YaHei', sans-serif;
    letter-spacing: 0.02em;
}
html[lang="zh"] .chat-title h2,
html[lang="zh"] .chat-empty,
html[lang="zh"] .bubble.brain,
html[lang="zh"] .conv-drawer-head h2,
html[lang="zh"] .conv-delete-title,
html[lang="zh"] .auth-title {
    font-family: 'Noto Sans SC', 'Instrument Serif', serif;
    font-weight: 500;
    letter-spacing: 0.04em;
}
html[lang="zh"] .chat-empty { font-style: normal; }
