/* ===== Chat Layout ===== */
.chat-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 3.5rem);
    max-width: 900px;
    margin: 0 auto;
    padding: 0;
}

/* ===== Welcome Screen ===== */
.chat-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    gap: 1rem;
}

.chat-welcome-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    margin-bottom: 0.5rem;
}

.chat-welcome-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-welcome-icon--clickable {
    cursor: pointer;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.chat-welcome-icon--clickable:hover {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.35), 0 0 18px rgba(102, 126, 234, 0.2);
    transform: scale(1.06);
}

.chat-welcome-icon--clickable:active {
    transform: scale(0.97);
}

.chat-welcome h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0;
}

.chat-welcome p {
    color: #6b7280;
    max-width: 500px;
    line-height: 1.6;
    margin: 0;
}

/* ===== Suggestion Chips ===== */
.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
    max-width: 700px;
}

.suggestion-chip {
    padding: 0.6rem 1.1rem;
    border: 1px solid #e5e7eb;
    border-radius: 1.5rem;
    background: white;
    color: #374151;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.suggestion-chip:hover {
    background: #f3f4f6;
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

/* ===== Messages Area ===== */
@media (min-width: 641px) {
    .chat-page {
        height: 100vh;
    }
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
    min-height: 0;
}

.chat-message {
    display: flex;
    gap: 0.75rem;
    max-width: 85%;
    animation: messageIn 0.3s ease-out;
}

@keyframes messageIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message.assistant {
    align-self: flex-start;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
    font-weight: 600;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.chat-message.user .message-avatar {
    background: #667eea;
    color: white;
}

.chat-message.assistant .message-avatar {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.message-bubble {
    padding: 0.85rem 1.1rem;
    border-radius: 1.25rem;
    line-height: 1.6;
    font-size: 0.925rem;
    word-break: break-word;
}

.chat-message.user .message-bubble {
    background: #667eea;
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.chat-message.assistant .message-bubble {
    background: #f3f4f6;
    color: #1f2937;
    border-bottom-left-radius: 0.25rem;
}

/* Markdown content inside assistant messages */
.message-bubble p { margin: 0 0 0.5rem 0; }
.message-bubble p:last-child { margin-bottom: 0; }
.message-bubble ul, .message-bubble ol { margin: 0.25rem 0; padding-left: 1.25rem; }
.message-bubble code {
    background: rgba(0,0,0,0.06);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85em;
}
.message-bubble pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 0.5rem 0;
    white-space: pre-wrap;
    word-break: break-word;
}
.message-bubble pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* ===== Copy button inside code blocks ===== */
.message-bubble pre {
    position: relative;
}

.btn-copy-code {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.55rem;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 0.4rem;
    background: rgba(255,255,255,0.07);
    color: #94a3b8;
    font-size: 0.72rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease, color 0.2s ease;
    font-family: inherit;
    line-height: 1;
}

.message-bubble pre:hover .btn-copy-code {
    opacity: 1;
}

.btn-copy-code:hover {
    background: rgba(255,255,255,0.14);
    color: #e2e8f0;
    border-color: rgba(255,255,255,0.3);
}

.btn-copy-code--copied {
    color: #86efac !important;
    border-color: rgba(134,239,172,0.4) !important;
}
.message-bubble a {
    color: #667eea;
    text-decoration: underline;
}
.chat-message.user .message-bubble a {
    color: #c7d2fe;
}

/* ===== Copy Button ===== */
.message-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.3rem;
    padding-right: 0.1rem;
}

.btn-copy-message {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.65rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background: transparent;
    color: #9ca3af;
    font-size: 0.75rem;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.btn-copy-message:hover {
    color: #667eea;
    border-color: #667eea;
    background: #f0f1ff;
}

.btn-copy-message:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* ===== Typing Indicator ===== */
.typing-indicator {
    display: inline-flex;
    gap: 4px;
    padding: 0.5rem 0;
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typing 1.4s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ===== Botón Detener streaming ===== */
.btn-stop-streaming {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0 auto 0.5rem;
    padding: 0.35rem 1rem;
    background: transparent;
    border: 1px solid var(--color-error, #e74c3c);
    border-radius: 20px;
    color: var(--color-error, #e74c3c);
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.btn-stop-streaming:hover {
    background: var(--color-error, #e74c3c);
    color: #fff;
}

/* ===== Chat Input ===== */
.chat-input-container {
    padding: 0.75rem 1rem 1.25rem;
    background: transparent;
}

.chat-input-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.attachment-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 1rem;
    font-size: 0.8rem;
    color: #1d4ed8;
}

.attachment-badge button {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
}

.attachment-badge button:hover {
    color: #dc2626;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 1.5rem;
    padding: 0.5rem 0.5rem 0.5rem 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input-wrapper:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-input-wrapper textarea {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    outline: none;
    font-size: 0.925rem;
    line-height: 1.5;
    max-height: 120px;
    min-height: 24px;
    font-family: inherit;
    color: #1f2937;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
}

.chat-input-wrapper textarea::-webkit-scrollbar { width: 6px; }
.chat-input-wrapper textarea::-webkit-scrollbar-track { background: transparent; }
.chat-input-wrapper textarea::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
.chat-input-wrapper textarea::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

.chat-input-wrapper textarea::placeholder {
    color: #9ca3af;
}

.chat-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-btn-send {
    background: #667eea;
    color: white;
}

.chat-btn-send:hover:not(:disabled) {
    background: #5a6fd6;
    transform: scale(1.05);
}

.chat-btn-send:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

.chat-btn-attach {
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    user-select: none;
}

.chat-btn-attach:hover {
    color: #667eea;
    background: #eff6ff;
}

.chat-btn-attach.disabled {
    color: #d1d5db;
    cursor: not-allowed;
    pointer-events: none;
}

.chat-attachment-error {
    font-size: 0.78rem;
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.5rem;
    padding: 0.3rem 0.75rem;
    margin: 0 0.25rem 0.25rem;
}

/* ===== File Attachments ===== */
.message-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.4rem;
}

.message-attachment-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    background: rgba(255,255,255,0.2);
    border-radius: 0.75rem;
    font-size: 0.75rem;
}

.chat-message.assistant .message-attachment-tag {
    background: rgba(0,0,0,0.06);
}

/* ===== Disclaimer ===== */
.chat-disclaimer {
    text-align: center;
    font-size: 0.75rem;
    color: #9ca3af;
    padding: 0.6rem 1rem 0.5rem;
}

/* ===== Scrollbar ===== */
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
.chat-messages::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ===== Error Message ===== */
.chat-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    text-align: center;
    margin: 0.5rem 1rem;
}

/* ===== Conversation History Sidebar ===== */
.conv-history {
    display: flex;
    flex-direction: column;
    border-top: 1px solid #e5e7eb;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.conv-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem 0.4rem;
}

.conv-search-box {
    position: relative;
    padding: 0.25rem 0.75rem 0.4rem;
}

.conv-search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 0.7rem;
    pointer-events: none;
}

.conv-search-input {
    width: 100%;
    padding: 0.3rem 0.5rem 0.3rem 1.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #f9fafb;
    color: #374151;
    font-size: 0.75rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

.conv-search-input::placeholder {
    color: #d1d5db;
}

.conv-search-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15);
    background: #fff;
}

.conv-search-input::-webkit-search-cancel-button {
    cursor: pointer;
}

.conv-history-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #9ca3af;
}

.btn-new-chat {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
}

.btn-new-chat:hover {
    color: #667eea;
    background: #eef0fd;
}

.conv-history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 1.5rem 0.5rem;
    color: #d1d5db;
    font-size: 0.8rem;
}

.conv-storage-warning,
.conv-storage-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    margin: 0.4rem 0.5rem 0.2rem;
    padding: 0.5rem 0.65rem;
    border-radius: 0.4rem;
    font-size: 0.74rem;
    line-height: 1.35;
}

.conv-storage-warning {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

.conv-storage-notice {
    background: rgba(234, 179, 8, 0.12);
    border: 1px solid rgba(234, 179, 8, 0.35);
    color: #fde68a;
}

.conv-storage-warning .oi,
.conv-storage-notice .oi {
    flex-shrink: 0;
    margin-top: 0.05rem;
    font-size: 0.78rem;
}

.conv-history-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.25rem 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: #e5e7eb transparent;
}

.conv-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    margin-bottom: 0.15rem;
}

.conv-item:hover {
    background: #f3f4f6;
}

.conv-item--active {
    background: #eef0fd;
}

.conv-item-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.conv-item-title {
    font-size: 0.8rem;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.conv-item--active .conv-item-title {
    color: #667eea;
    font-weight: 600;
}

.conv-item-meta {
    font-size: 0.68rem;
    color: #9ca3af;
}

.conv-item-delete {
    background: none;
    border: none;
    color: #d1d5db;
    cursor: pointer;
    padding: 0.15rem 0.3rem;
    border-radius: 0.3rem;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
    line-height: 1;
    flex-shrink: 0;
}

.conv-item:hover .conv-item-delete {
    opacity: 1;
}

.conv-item-delete:hover {
    color: #ef4444;
}

.conv-history-footer {
    padding: 0.5rem 0.75rem;
    border-top: 1px solid #e5e7eb;
}

.btn-clear-history {
    width: 100%;
    background: none;
    border: 1px solid #e5e7eb;
    color: #9ca3af;
    font-size: 0.72rem;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.btn-clear-history:hover {
    border-color: #fca5a5;
    color: #ef4444;
    background: #fef2f2;
}

/* ===== Confirm dialog ===== */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: confirm-fade-in 0.15s ease;
}

@keyframes confirm-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.confirm-dialog {
    background: #ffffff;
    border-radius: 1rem;
    padding: 0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22), 0 2px 8px rgba(0,0,0,0.08);
    max-width: 400px;
    width: 92%;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
    animation: confirm-slide-up 0.18s ease;
}

@keyframes confirm-slide-up {
    from { opacity: 0; transform: translateY(10px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.confirm-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 1.75rem 1.25rem;
    border-bottom: 1px solid #f3f4f6;
}

.confirm-icon {
    flex-shrink: 0;
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
    background: #fef3c7;
    border: 1px solid #fde68a;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d97706;
    font-size: 1.125rem;
    line-height: 1;
}

.confirm-icon .oi {
    display: block;
    line-height: 1;
    position: relative;
    top: 0;
}

.confirm-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.confirm-title {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    letter-spacing: 0.01em;
    line-height: 1.3;
}

.confirm-message {
    font-size: 0.9375rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

.confirm-divider {
    display: none;
}

.confirm-actions {
    display: flex;
    gap: 0.625rem;
    justify-content: flex-end;
    padding: 1rem 1.75rem 1.25rem;
    background: #f9fafb;
}

.btn-confirm-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1.15rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #374151;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s, border-color 0.15s;
}

.btn-confirm-cancel .oi {
    font-size: 0.75rem;
    line-height: 1;
    display: block;
    position: relative;
    top: 0;
}

.btn-confirm-cancel:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.btn-confirm-ok {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1.15rem;
    border-radius: 0.5rem;
    border: none;
    background: #ef4444;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s, box-shadow 0.15s;
    box-shadow: 0 1px 4px rgba(239,68,68,0.35);
}

.btn-confirm-ok .oi {
    font-size: 0.75rem;
    line-height: 1;
    display: block;
    position: relative;
    top: 0;
}

.btn-confirm-ok:hover {
    background: #dc2626;
    box-shadow: 0 2px 8px rgba(239,68,68,0.45);
}

/* ===== Mobile ===== */
@media (max-width: 640.98px) {
    .chat-page {
        max-width: 100%;
        overflow-x: hidden;
    }

    .chat-welcome {
        padding: 1.25rem 1rem;
        gap: 0.75rem;
        align-items: stretch;
    }

    .chat-welcome-icon {
        align-self: center;
    }

    .chat-welcome p {
        font-size: 0.875rem;
    }

    .suggestion-chips {
        gap: 0.4rem;
        margin-top: 0.5rem;
        max-width: 100%;
        justify-content: stretch;
    }

    .suggestion-chip {
        font-size: 0.8rem;
        padding: 0.5rem 0.85rem;
        white-space: normal;
        text-align: center;
        width: 100%;
        border-radius: 0.75rem;
        box-sizing: border-box;
    }

    .chat-messages {
        padding: 1rem 0.75rem;
    }

    .chat-message {
        max-width: 95%;
    }

    .chat-input-container {
        padding: 0.5rem 0.75rem 1rem;
    }

    .message-bubble {
        font-size: 0.875rem;
    }
}

/* ===== Modo Matrix ===== */

/* -- Variables y fuente terminal -- */
body.matrix-mode {
    background-color: #0d0d0d !important;
    color: #00ff41 !important;
    font-family: 'Courier New', Courier, monospace !important;
}

/* -- Layout principal -- */
body.matrix-mode .page,
body.matrix-mode main,
body.matrix-mode article {
    background-color: #0d0d0d !important;
}

body.matrix-mode .chat-page {
    background-color: transparent;
    position: relative;
    z-index: 1;
}

/* -- Sidebar -- */
body.matrix-mode .sidebar {
    background: #080808 !important;
    border-right: 1px solid #00ff4133 !important;
    box-shadow: 2px 0 16px #00ff4115 !important;
}

body.matrix-mode .sidebar-header {
    border-bottom: 1px solid #00ff4133 !important;
    background: #080808 !important;
}

body.matrix-mode .sidebar-brand:hover {
    opacity: 1 !important;
}

body.matrix-mode .sidebar-brand-name {
    color: #00ff41 !important;
    -webkit-text-fill-color: #00ff41 !important;
    background: none !important;
    font-family: 'Courier New', monospace !important;
    font-size: 1.1rem !important;
    font-weight: 800 !important;
    letter-spacing: 0.14em !important;
    text-transform: uppercase;
    cursor: pointer;
    animation: matrixNeonPulse 3s ease-in-out infinite;
}

@keyframes matrixNeonPulse {
    0%, 100% {
        text-shadow:
            0 0 4px #00ff41,
            0 0 10px #00ff41,
            0 0 22px #00ff41,
            0 0 42px #00cc33,
            0 0 80px #009922;
    }
    50% {
        text-shadow:
            0 0 2px #00ff41,
            0 0 6px #00ff41,
            0 0 14px #00cc33,
            0 0 28px #00993322;
    }
}

/* -- Nav links -- */
body.matrix-mode .nav-item a {
    color: #00cc33 !important;
    font-family: 'Courier New', monospace !important;
}

body.matrix-mode .nav-item a:hover {
    background: #00ff4115 !important;
    color: #00ff41 !important;
}

body.matrix-mode .nav-item a.active {
    background: #003b0055 !important;
    color: #00ff41 !important;
    border: 1px solid #00ff4133;
}

body.matrix-mode .oi {
    color: #00cc33 !important;
}

body.matrix-mode .nav-item a:hover .oi,
body.matrix-mode .nav-item a.active .oi {
    color: #00ff41 !important;
}

body.matrix-mode .navbar-toggler {
    border-color: #00ff4155 !important;
    color: #00ff41 !important;
}

/* -- Historial de conversaciones -- */
body.matrix-mode .conv-history {
    border-top: 1px solid #00ff4133 !important;
}

body.matrix-mode .conv-history-title {
    color: #00ff4188 !important;
    font-family: 'Courier New', monospace !important;
}

body.matrix-mode .btn-new-chat {
    color: #00cc33 !important;
}

body.matrix-mode .conv-search-input {
    background: #0a120a !important;
    border-color: #00ff4133 !important;
    color: #00ff41 !important;
    font-family: 'Courier New', monospace !important;
}

body.matrix-mode .conv-search-input::placeholder {
    color: #00ff4155 !important;
}

body.matrix-mode .conv-search-input:focus {
    border-color: #00ff4188 !important;
    box-shadow: 0 0 0 2px rgba(0,255,65,0.12) !important;
    background: #0d1a0d !important;
}

body.matrix-mode .conv-search-icon {
    color: #00ff4166 !important;
}

body.matrix-mode .btn-new-chat:hover {
    color: #00ff41 !important;
    background: #00ff4120 !important;
}

body.matrix-mode .conv-item:hover {
    background: #00ff4110 !important;
}

body.matrix-mode .conv-item--active {
    background: #003b0055 !important;
}

body.matrix-mode .conv-item-title {
    color: #00cc33 !important;
    font-family: 'Courier New', monospace !important;
}

body.matrix-mode .conv-item--active .conv-item-title {
    color: #00ff41 !important;
}

body.matrix-mode .conv-item-meta {
    color: #00ff4155 !important;
}

body.matrix-mode .conv-item-delete:hover {
    color: #ff4444 !important;
}

body.matrix-mode .btn-clear-history {
    border-color: #ff444433 !important;
    color: #ff444488 !important;
}

body.matrix-mode .btn-clear-history:hover {
    border-color: #ff4444 !important;
    color: #ff4444 !important;
    background: #ff444415 !important;
}

body.matrix-mode .confirm-overlay {
    background: rgba(0, 8, 2, 0.75) !important;
    backdrop-filter: blur(4px);
}

body.matrix-mode .confirm-dialog {
    background: #0a0f0a !important;
    border: 1px solid #00ff4166 !important;
    border-radius: 1rem !important;
    box-shadow: 0 0 0 1px #00ff4122, 0 0 48px #00ff4118, 0 24px 64px rgba(0,0,0,0.7) !important;
    overflow: hidden !important;
}

body.matrix-mode .confirm-header {
    background: #0d150d !important;
    border-bottom: 1px solid #00ff4130 !important;
    padding: 1.5rem 1.75rem 1.25rem !important;
}

body.matrix-mode .confirm-icon {
    background: #00ff410d !important;
    border: 1px solid #00ff4144 !important;
    color: #00ff41 !important;
    box-shadow: 0 0 12px #00ff4122 !important;
}

body.matrix-mode .confirm-title {
    color: #00ff41 !important;
    font-family: 'Courier New', monospace !important;
    text-shadow: 0 0 8px #00ff4166 !important;
}

body.matrix-mode .confirm-message {
    color: #00cc33cc !important;
    font-family: 'Courier New', monospace !important;
}

body.matrix-mode .confirm-divider {
    display: none !important;
}

body.matrix-mode .confirm-actions {
    background: #060c06 !important;
    border-top: 1px solid #00ff4120 !important;
}

body.matrix-mode .btn-confirm-cancel {
    background: transparent !important;
    border: 1px solid #00ff4144 !important;
    color: #00ff41 !important;
    font-family: 'Courier New', monospace !important;
}

body.matrix-mode .btn-confirm-cancel:hover {
    background: #00ff410f !important;
    border-color: #00ff4199 !important;
    box-shadow: 0 0 8px #00ff4122 !important;
}

body.matrix-mode .btn-confirm-ok {
    background: #450a0a !important;
    border: 1px solid #ef444466 !important;
    box-shadow: 0 0 10px rgba(239,68,68,0.2) !important;
    color: #fca5a5 !important;
    font-family: 'Courier New', monospace !important;
}

body.matrix-mode .btn-confirm-ok:hover {
    background: #7f1d1d !important;
    border-color: #ef4444 !important;
    box-shadow: 0 0 14px rgba(239,68,68,0.4) !important;
    color: #fff !important;
}

/* -- Pantalla de bienvenida -- */
body.matrix-mode .chat-welcome h2 {
    color: #00ff41 !important;
    font-family: 'Courier New', monospace !important;
    text-shadow: 0 0 12px #00ff4188;
}

body.matrix-mode .chat-welcome p {
    color: #00cc33 !important;
    font-family: 'Courier New', monospace !important;
}

body.matrix-mode .chat-welcome-icon {
    box-shadow: 0 0 20px #00ff4166, 0 0 40px #00ff4122;
    border: 2px solid #00ff4155;
}

/* -- Chips de sugerencia -- */
body.matrix-mode .suggestion-chip {
    background: #0d0d0d !important;
    border-color: #00ff4155 !important;
    color: #00cc33 !important;
    font-family: 'Courier New', monospace !important;
}

body.matrix-mode .suggestion-chip:hover {
    background: #00ff4115 !important;
    border-color: #00ff41 !important;
    color: #00ff41 !important;
    box-shadow: 0 0 10px #00ff4155 !important;
    transform: translateY(-1px);
}

/* -- Burbujas de mensaje -- */
body.matrix-mode .chat-message.assistant .message-bubble {
    background: #0a0a0a !important;
    color: #00ff41 !important;
    border: 1px solid #00ff4133 !important;
    border-bottom-left-radius: 0.25rem;
    font-family: 'Courier New', monospace !important;
    font-size: 0.9rem !important;
    line-height: 1.7 !important;
    box-shadow: inset 0 0 20px #00ff4108;
}

body.matrix-mode .chat-message.user .message-bubble {
    background: #003b00 !important;
    color: #00ff41 !important;
    border: 1px solid #00ff4155 !important;
    font-family: 'Courier New', monospace !important;
    font-size: 0.9rem !important;
}

/* Cursor parpadeante al final del último mensaje del asistente */
body.matrix-mode .chat-message.assistant .message-bubble:last-child::after {
    content: '▮';
    color: #00ff41;
    animation: matrixBlink 1s step-start infinite;
    margin-left: 2px;
    font-size: 0.85em;
}

/* Markdown dentro de los mensajes */
body.matrix-mode .message-bubble a {
    color: #00ff41 !important;
    text-shadow: 0 0 6px #00ff4166;
}

body.matrix-mode .message-bubble code {
    background: #003b0055 !important;
    color: #00ff41 !important;
    border: 1px solid #00ff4133;
}

body.matrix-mode .message-bubble pre {
    background: #080808 !important;
    border: 1px solid #00ff4133 !important;
    box-shadow: 0 0 10px #00ff4115;
}

body.matrix-mode .message-bubble pre code {
    color: #00ff41 !important;
    background: none !important;
    border: none !important;
}

body.matrix-mode .btn-copy-code {
    border-color: #00ff4133;
    color: #00ff4166;
    background: transparent;
    font-family: 'Courier New', monospace;
}

body.matrix-mode .message-bubble pre:hover .btn-copy-code {
    opacity: 1;
}

body.matrix-mode .btn-copy-code:hover {
    background: #00ff4110;
    color: #00ff41;
    border-color: #00ff4188;
    text-shadow: 0 0 6px #00ff4166;
}

body.matrix-mode .btn-copy-code--copied {
    color: #00ff41 !important;
    border-color: #00ff4177 !important;
    text-shadow: 0 0 8px #00ff4199 !important;
}

/* -- Botón copiar Matrix -- */
body.matrix-mode .btn-copy-message--matrix {
    border-color: #00ff4133;
    color: #00ff4177;
    background: transparent;
    font-family: 'Courier New', monospace;
}

body.matrix-mode .btn-copy-message--matrix:hover {
    color: #00ff41;
    border-color: #00ff41aa;
    background: #00ff4110;
    text-shadow: 0 0 6px #00ff4166;
    box-shadow: 0 0 8px #00ff4122;
}

body.matrix-mode .btn-copy-message--matrix:focus-visible {
    outline-color: #00ff41;
}


body.matrix-mode .chat-message.user .message-avatar {
    background: #003b00 !important;
    border: 1px solid #00ff4155 !important;
    box-shadow: 0 0 8px #00ff4133;
    cursor: pointer;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

body.matrix-mode .chat-message.user .message-avatar:hover {
    border-color: #00ff41aa !important;
    box-shadow: 0 0 14px #00ff4166 !important;
}

.matrix-user-glyph {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    font-weight: 700;
    color: #00ff41;
    text-shadow: 0 0 8px #00ff41;
    animation: matrixGlyphFlicker 4s step-start infinite;
    user-select: none;
}

@keyframes matrixGlyphFlicker {
    0%, 92%  { opacity: 1; }
    93%      { opacity: 0.2; }
    94%      { opacity: 1; }
    97%      { opacity: 0.4; }
    98%      { opacity: 1; }
}

body.matrix-mode .chat-message.assistant .message-avatar img {
    box-shadow: 0 0 10px #00ff4166;
    border: 2px solid #00ff4155;
}

/* -- Input -- */
body.matrix-mode .chat-input-wrapper {
    background: #0a0a0a !important;
    border-color: #00ff4155 !important;
}

body.matrix-mode .chat-input-wrapper:focus-within {
    border-color: #00ff41 !important;
    box-shadow: 0 0 0 3px #00ff4133, 0 0 16px #00ff4122 !important;
}

body.matrix-mode .chat-input-wrapper textarea {
    color: #00ff41 !important;
    font-family: 'Courier New', monospace !important;
    caret-color: #00ff41 !important;
    background: transparent !important;
}

body.matrix-mode .chat-input-wrapper textarea::placeholder {
    color: #00ff4155 !important;
}

body.matrix-mode .chat-btn-send {
    background: #003b00 !important;
    color: #00ff41 !important;
    border: 1px solid #00ff4166 !important;
}

body.matrix-mode .chat-btn-send:hover:not(:disabled) {
    background: #005200 !important;
    box-shadow: 0 0 12px #00ff4188 !important;
    transform: scale(1.05);
}

body.matrix-mode .chat-btn-send:disabled {
    background: #1a1a1a !important;
    color: #00ff4144 !important;
    border-color: #00ff4122 !important;
}

body.matrix-mode .chat-btn-attach {
    color: #00ff4199 !important;
}

body.matrix-mode .chat-btn-attach:hover {
    color: #00ff41 !important;
    background: #00ff4120 !important;
}

/* -- Adjuntos -- */
body.matrix-mode .attachment-badge {
    background: #003b0055 !important;
    border-color: #00ff4155 !important;
    color: #00ff41 !important;
}

body.matrix-mode .message-attachment-tag {
    background: #003b0055 !important;
    color: #00ff4199 !important;
}

/* -- Disclaimer -- */
body.matrix-mode .chat-disclaimer {
    color: #00ff4155 !important;
    font-family: 'Courier New', monospace !important;
}

/* -- Error -- */
body.matrix-mode .chat-error {
    background: #1a0000 !important;
    border-color: #ff444455 !important;
    color: #ff6666 !important;
}

/* -- Scrollbar -- */
body.matrix-mode .chat-messages::-webkit-scrollbar-thumb {
    background: #00ff4155 !important;
}

body.matrix-mode .conv-history-list::-webkit-scrollbar-thumb {
    background: #00ff4133 !important;
}

body.matrix-mode .chat-input-wrapper textarea::-webkit-scrollbar-thumb {
    background: #00ff4155 !important;
}

body.matrix-mode .chat-input-wrapper textarea {
    scrollbar-color: #00ff4155 transparent;
}

/* -- Indicador "pensando" Matrix -- */
body.matrix-mode .matrix-thinking {
    color: #00ff41;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    animation: matrixBlink 1.2s step-start infinite;
    letter-spacing: 0.05em;
    text-shadow: 0 0 8px #00ff4188;
}

/* ===== Mensajes de pensamiento fuera del modo Matrix ===== */
.agent-thinking {
    font-size: 0.82rem;
    color: #667eea;
    font-style: italic;
    animation: agentThinkingFade 1.4s ease-in-out infinite;
    letter-spacing: 0.02em;
}

@keyframes agentThinkingFade {
    0%, 100% { opacity: 0.45; }
    50%       { opacity: 1; }
}

/* -- Mobile: sidebar en modo Matrix -- */
@media (max-width: 640.98px) {
    body.matrix-mode .sidebar {
        border-bottom: 1px solid #00ff4133 !important;
        border-right: none !important;
        box-shadow: 0 2px 16px #00ff4115 !important;
    }

    body.matrix-mode .navbar-toggler {
        border-color: #00ff4166 !important;
        color: #00ff41 !important;
        background: transparent !important;
        box-shadow: 0 0 8px #00ff4133 !important;
    }

    body.matrix-mode .navbar-toggler:hover {
        background: #00ff4115 !important;
        border-color: #00ff41 !important;
        box-shadow: 0 0 14px #00ff4155 !important;
    }

    body.matrix-mode .navbar-toggler-icon {
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%2300ff41' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
        filter: drop-shadow(0 0 3px #00ff4199);
    }

    body.matrix-mode .nav-scrollable:not(.collapse) {
        background: #080808 !important;
        border-bottom: 1px solid #00ff4133 !important;
        box-shadow: 0 8px 24px #00000088, 0 4px 16px #00ff4115 !important;
    }

    body.matrix-mode .nav-scrollable:not(.collapse) .nav-item ::deep a {
        color: #00cc33 !important;
        font-family: 'Courier New', monospace !important;
    }

    body.matrix-mode .nav-scrollable:not(.collapse) .nav-item ::deep a:hover {
        background: #00ff4115 !important;
        color: #00ff41 !important;
    }

    body.matrix-mode .nav-scrollable:not(.collapse) .nav-item ::deep a.active {
        background: #003b0055 !important;
        color: #00ff41 !important;
        border: 1px solid #00ff4133;
    }
}

@keyframes matrixBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ===== Toast de modo Matrix ===== */
.matrix-toast {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(-1rem);
    background: #0d0d0d;
    color: #00ff41;
    border: 1px solid #00ff41;
    box-shadow: 0 0 18px #00ff4166;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    letter-spacing: 0.05em;
    padding: 0.75rem 1.75rem;
    border-radius: 0.5rem;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.35s ease, transform 0.35s ease;
    pointer-events: none;
}

.matrix-toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== Matrix Boot Overlay ===== */
.matrix-boot-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Courier New', Courier, monospace;
}

.matrix-boot-terminal {
    width: min(560px, 90vw);
    padding: 2rem 2.5rem;
    border: 1px solid #00ff4166;
    box-shadow: 0 0 40px #00ff4122, inset 0 0 30px #00ff4108;
    background: #050505;
    border-radius: 4px;
}

.matrix-boot-header {
    font-size: 0.75rem;
    color: #00ff4188;
    letter-spacing: 0.12em;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
}

.matrix-boot-lines {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 5.5rem;
    margin-bottom: 1.25rem;
}

.matrix-boot-line {
    font-size: 0.8rem;
    color: #00cc33;
    letter-spacing: 0.04em;
    animation: bootLineFade 0.2s ease-out forwards;
}

.matrix-boot-line--ok {
    color: #00ff41;
    text-shadow: 0 0 8px #00ff4188;
}

@keyframes bootLineFade {
    from { opacity: 0; transform: translateX(-6px); }
    to   { opacity: 1; transform: translateX(0); }
}

.matrix-boot-progress-label {
    font-size: 0.72rem;
    color: #00ff4199;
    letter-spacing: 0.08em;
    margin-bottom: 0.4rem;
}

.matrix-boot-bar {
    width: 100%;
    height: 10px;
    background: #001a00;
    border: 1px solid #00ff4133;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.matrix-boot-fill {
    height: 100%;
    background: linear-gradient(90deg, #004d00, #00ff41);
    box-shadow: 0 0 8px #00ff4188;
    transition: width 0.06s linear;
}

.matrix-boot-cursor {
    color: #00ff41;
    font-size: 1rem;
    animation: matrixBlink 0.8s step-start infinite;
}

/* ===== Wake up Neo Overlay ===== */
.matrix-wakeup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.97);
    z-index: 9997;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Courier New', Courier, monospace;
    cursor: text;
}

.matrix-wakeup-content {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    padding: 2rem;
}

.wakeup-line {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    width: 0;
    color: #00ff41;
    font-weight: 600;
    text-shadow: 0 0 12px #00ff4199;
}

/* Timing sincronizado con RunWakeupDissolveAsync (Task.Delay 4400ms):
   Línea 1: empieza 0.3s, dura 0.7s → acaba 1.0s
   Línea 2: empieza 1.3s, dura 0.9s → acaba 2.2s
   Línea 3: empieza 2.5s, dura 1.1s → acaba 3.6s  */
.wakeup-line-1 {
    font-size: clamp(1.4rem, 4vw, 2rem);
    animation: wakeupType 0.7s steps(15, end) 0.3s forwards;
}

.wakeup-line-2 {
    font-size: clamp(1rem, 3vw, 1.4rem);
    color: #00cc33;
    text-shadow: none;
    animation: wakeupType 0.9s steps(21, end) 1.3s forwards;
}

.wakeup-line-3 {
    font-size: clamp(0.9rem, 2.5vw, 1.15rem);
    color: #009922;
    text-shadow: none;
    animation: wakeupType 1.1s steps(24, end) 2.5s forwards;
}

@keyframes wakeupType {
    from { width: 0; }
    to   { width: 30ch; }
}

/* ===== Agent Smith Easter Egg ===== */
.smith-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.96);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: smithFadeIn 0.4s ease-out forwards;
    cursor: pointer;
}

@keyframes smithFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.smith-content {
    display: flex;
    flex-direction: row;
    gap: 2.5rem;
    align-items: center;
    max-width: 780px;
    width: 90%;
    background: linear-gradient(135deg, #0d0d0d 60%, #1a1a1a);
    border: 1px solid #444;
    border-radius: 4px;
    padding: 2.5rem 2rem;
    box-shadow: 0 0 60px rgba(0,0,0,0.8), inset 0 0 30px rgba(0,0,0,0.4);
    cursor: default;
    animation: smithSlideIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes smithSlideIn {
    from { transform: scale(0.92) translateY(20px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}

.smith-photo-col {
    flex-shrink: 0;
}

.smith-photo {
    width: 180px;
    height: 220px;
    object-fit: cover;
    object-position: top center;
    border-radius: 3px;
    border: 1px solid #333;
    filter: grayscale(30%) contrast(1.1);
    box-shadow: 0 4px 24px rgba(0,0,0,0.7);
}

.smith-text-col {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    font-family: 'Courier New', Courier, monospace;
    min-width: 0;
    flex: 1;
}

.smith-label {
    font-size: 0.65rem;
    letter-spacing: 0.18em;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #2a2a2a;
    padding-bottom: 0.5rem;
}

.smith-line {
    margin: 0;
    color: #c8c8c8;
    font-size: clamp(0.85rem, 2vw, 1rem);
    clip-path: inset(0 100% 0 0);
}

.smith-line-1 {
    color: #e0e0e0;
    font-size: clamp(1.1rem, 2.5vw, 1.35rem);
    font-weight: 600;
    letter-spacing: 0.06em;
    animation: smithReveal 0.7s steps(40, end) 0.4s forwards;
}
.smith-line-2 { animation: smithReveal 0.7s steps(40, end) 1.3s forwards; }
.smith-line-3 { animation: smithReveal 1.1s steps(65, end) 2.2s forwards; }
.smith-line-4 { animation: smithReveal 0.9s steps(52, end) 3.5s forwards; }
.smith-line-5 { animation: smithReveal 0.5s steps(44, end) 4.6s forwards; }

@keyframes smithReveal {
    from { clip-path: inset(0 100% 0 0); }
    to   { clip-path: inset(0 0% 0 0); }
}

.smith-dismiss {
    margin-top: 1.2rem;
    align-self: flex-start;
    background: transparent;
    border: 1px solid #444;
    color: #666;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.2s ease;
    animation: smithFadeIn 0.4s ease 5.2s both;
}

.smith-dismiss:hover {
    border-color: #888;
    color: #ccc;
    background: rgba(255,255,255,0.04);
}

@media (max-width: 560px) {
    .smith-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 1.5rem 1.2rem;
    }
    .smith-photo {
        width: 120px;
        height: 148px;
    }
    .smith-dismiss {
        align-self: center;
    }
}

/* ===== Red Pill / Blue Pill Easter Egg ===== */
/* ===== MORFEO OVERLAY ===== */
.morpheus-overlay {
    position: fixed;
    inset: 0;
    z-index: 2200;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: smithFadeIn 0.5s ease;
}

.morpheus-content {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 2rem;
    background: #0a0a0a;
    border: 1px solid #444;
    border-radius: 10px;
    padding: 2rem 2.5rem;
    max-width: 720px;
    width: 90%;
    box-shadow: 0 0 60px rgba(0,0,0,0.8);
    overflow: visible;
}

.morpheus-photo-col {
    flex-shrink: 0;
}

.morpheus-photo {
    width: 160px;
    height: 200px;
    object-fit: cover;
    object-position: top center;
    border-radius: 6px;
    border: 1px solid #555;
    display: block;
}

.morpheus-text-col {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
    flex: 1;
}

.morpheus-label {
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 0.6rem;
    font-family: 'Courier New', monospace;
}

.morpheus-line {
    color: #e8e8e8;
    font-size: 1rem;
    line-height: 1.55;
    margin: 0;
    font-family: Georgia, serif;
    clip-path: inset(0 100% 0 0);
    white-space: normal;
    overflow-wrap: break-word;
}

.morpheus-line-1 { animation: smithReveal 0.8s steps(45, end) 0.4s forwards; }
.morpheus-line-2 { animation: smithReveal 0.3s steps(10, end) 1.4s forwards; }
.morpheus-line-3 { animation: smithReveal 1.1s steps(60, end) 2.1s forwards; }
.morpheus-line-4 { animation: smithReveal 0.7s steps(35, end) 3.4s forwards; }
.morpheus-line-5 { animation: smithReveal 0.6s steps(30, end) 4.3s forwards; }

.morpheus-proceed {
    margin-top: 1.5rem;
    align-self: flex-start;
    background: transparent;
    border: 1px solid #ccc;
    color: #e8e8e8;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    padding: 0.45rem 1.1rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
    clip-path: inset(0 100% 0 0);
    animation: smithReveal 0.4s steps(10, end) 5.3s forwards;
}

.morpheus-proceed:hover {
    background: #e8e8e8;
    color: #000;
}

@media (max-width: 600px) {
    .morpheus-content {
        flex-direction: column;
        align-items: center;
        padding: 1.5rem;
        gap: 1.2rem;
    }
    .morpheus-photo {
        width: 120px;
        height: 150px;
    }
}

/* ===== FIN MORFEO OVERLAY ===== */

.pill-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.97);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: smithFadeIn 0.35s ease forwards;
    cursor: pointer;
    font-family: 'Courier New', Courier, monospace;
}

.pill-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.8rem;
    max-width: 680px;
    width: 90%;
    cursor: default;
    animation: smithSlideIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.pill-question {
    margin: 0;
    color: #e0e0e0;
    font-size: clamp(1.1rem, 3vw, 1.5rem);
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.03em;
    clip-path: inset(0 100% 0 0);
    animation: pillReveal 0.7s steps(32, end) 0.2s forwards;
}

.pill-question--sub {
    color: #aaa;
    font-size: clamp(0.85rem, 2vw, 1rem);
    font-weight: 400;
    animation: pillReveal 0.6s steps(38, end) 1.1s forwards;
}

@keyframes pillReveal {
    from { clip-path: inset(0 100% 0 0); }
    to   { clip-path: inset(0 0% 0 0); }
}

.pill-buttons {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
    animation: smithFadeIn 0.4s ease 1.8s both;
}

.pill-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 240px;
    padding: 1.4rem 1.2rem;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    background: #111;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    text-align: center;
}

.pill-btn:hover {
    transform: translateY(-4px);
}

.pill-btn--blue {
    border-color: #2255cc55;
}
.pill-btn--blue:hover {
    border-color: #4488ff;
    box-shadow: 0 0 20px #4488ff44;
}

.pill-btn--red {
    border-color: #cc222255;
}
.pill-btn--red:hover {
    border-color: #ff4444;
    box-shadow: 0 0 20px #ff444444;
}

.pill-icon {
    font-size: 2rem;
    filter: grayscale(1);
    transition: filter 0.2s ease;
}
.pill-btn--blue:hover .pill-icon { filter: grayscale(0) hue-rotate(180deg); }
.pill-btn--red:hover   .pill-icon { filter: grayscale(0); }

/* Pastilla CSS con forma real */
.pill-capsule {
    width: 56px;
    height: 24px;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.pill-capsule::before,
.pill-capsule::after {
    content: '';
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
}

.pill-capsule::before { left: 0; border-radius: 12px 0 0 12px; }
.pill-capsule::after  { right: 0; border-radius: 0 12px 12px 0; }

/* Pastilla azul: mitad oscura / mitad brillante */
.pill-capsule--blue::before { background: #1a3a8f; }
.pill-capsule--blue::after  { background: #4488ff; box-shadow: inset -2px 0 6px rgba(255,255,255,0.2); }

/* Pastilla roja: mitad oscura / mitad brillante */
.pill-capsule--red::before { background: #8f1a1a; }
.pill-capsule--red::after  { background: #ff4444; box-shadow: inset -2px 0 6px rgba(255,255,255,0.2); }

.pill-btn--blue:hover .pill-capsule--blue {
    box-shadow: 0 0 16px #4488ffaa;
    transform: scale(1.08);
}
.pill-btn--red:hover .pill-capsule--red {
    box-shadow: 0 0 16px #ff4444aa;
    transform: scale(1.08);
}

.pill-label {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}
.pill-btn--blue .pill-label { color: #6699ff; }
.pill-btn--red  .pill-label { color: #ff6666; }

.pill-desc {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.82rem;
    color: #aaa;
    line-height: 1.6;
    letter-spacing: 0.01em;
}

.pill-btn--blue:hover .pill-desc { color: #ccd9ff; }
.pill-btn--red:hover  .pill-desc { color: #ffc8c8; }

@media (max-width: 520px) {
    .pill-buttons { flex-direction: column; align-items: center; }
    .pill-btn { width: 100%; max-width: 280px; }
}
