/* ========================================
   MTKai — Cyberpunk 2077 Style
   ======================================== */

/* ========================================
   Puter.js Popup Blocker — NUCLEAR CSS
   Hides ANY element Puter injects into body
   (popups, modals, overlays, iframes)
   ======================================== */
body>*:not(.app-container):not(script):not(link):not(style):not(noscript) {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    position: fixed !important;
    top: -9999px !important;
    left: -9999px !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* Force-prevent Puter from locking body/html when showing popup */
html {
    overflow: hidden !important;
    pointer-events: auto !important;
}

body {
    overflow: hidden !important;
    pointer-events: auto !important;
    position: static !important;
}

.app-container,
.app-container * {
    pointer-events: auto;
}

:root {
    /* Cyberpunk 2077 Palette */
    --bg-primary: #050505;
    /* Deep Black */
    --bg-secondary: #0a0a0a;
    /* Off Black */
    --bg-tertiary: #121212;
    /* Panel Black */
    --bg-elevated: #1a1a1a;
    /* Hover Black */
    --bg-hover: #222222;

    --surface-1: rgba(255, 0, 60, 0.05);
    /* Red tint */
    --surface-2: rgba(10, 189, 227, 0.05);
    /* Blue tint */
    --surface-3: rgba(252, 238, 10, 0.05);
    /* Yellow tint */

    /* Cyberpunk Accents */
    --cp-red: #ff003c;
    --cp-blue: #0abde3;
    --cp-yellow: #fcee0a;
    --cp-cyan: #00f0ff;

    /* Text Colors */
    --text-primary: #e0e0e0;
    --text-secondary: #0abde3;
    /* Blue Text for UI elements */
    --text-tertiary: #ff003c;
    /* Red Text for labels */
    --text-muted: #666666;
    --text-user: #fcee0a;
    /* Yellow text for user */

    /* Semantic Colors */
    --accent-primary: var(--cp-red);
    --accent-secondary: var(--cp-blue);
    --accent-tertiary: var(--cp-yellow);
    --accent-glow: rgba(255, 0, 60, 0.5);

    /* Provider Colors (Neonified) */
    --openai-color: #00f0ff;
    --claude-color: #ff9900;
    --deepseek-color: #0abde3;
    --gemini-color: #ff003c;
    --elevenlabs-color: #fcee0a;
    --polly-color: #ff6600;

    /* State Colors */
    --success: #0abde3;
    --error: #ff003c;
    --warning: #fcee0a;

    /* Borders - Hard & Glitchy */
    --border-subtle: rgba(255, 255, 255, 0.1);
    --border-default: rgba(255, 0, 60, 0.4);
    --border-strong: #ff003c;

    /* Shadows */
    --shadow-sm: 0 0 5px rgba(255, 0, 60, 0.2);
    --shadow-md: 0 0 10px rgba(10, 189, 227, 0.3);
    --shadow-lg: 0 0 20px rgba(255, 0, 60, 0.4);
    --shadow-glow: 0 0 10px var(--accent-primary);

    /* Layout */
    --sidebar-width: 320px;
    --topbar-height: 60px;

    /* Cyberpunk radii are mostly 0 or clipped */
    --radius-sm: 0px;
    --radius-md: 0px;
    --radius-lg: 2px;
    --radius-xl: 4px;
    --radius-full: 0px;

    /* Font */
    --font-mono: 'Fira Code', 'Consolas', monospace;
    --font-body: 'Share Tech Mono', 'Rajdhani', sans-serif;
    /* Tech font */

    /* Transitions */
    --transition-fast: 100ms steps(5);
    /* Stepped for glitch feel */
    --transition-normal: 200ms ease;
}

/* ========================================
   Reset & Base
   ======================================== */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    line-height: 1.6;
    touch-action: manipulation;
    /* Grid background pattern */
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
}

a {
    color: var(--cp-blue);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--cp-cyan);
    text-shadow: 0 0 5px var(--cp-cyan);
}

::selection {
    background: var(--cp-red);
    color: white;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-left: 1px solid var(--border-subtle);
}

::-webkit-scrollbar-thumb {
    background: var(--cp-red);
    border: 1px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--cp-yellow);
}

/* ========================================
   Layout
   ======================================== */

.app-container {
    display: flex;
    height: 100vh;
    height: 100dvh;
    position: relative;
}

/* ========================================
   Sidebar
   ======================================== */

.sidebar {
    width: var(--sidebar-width);
    background: rgba(5, 5, 5, 0.95);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-normal);
    z-index: 100;
    flex-shrink: 0;
    position: relative;
}

/* Red line accent on right of sidebar */
.sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    right: -1px;
    bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, var(--cp-red), transparent, var(--cp-blue));
    box-shadow: 0 0 5px var(--cp-red);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 20px;
    border-bottom: 2px solid var(--cp-red);
    background: var(--bg-secondary);
    clip-path: polygon(0 0, 100% 0, 100% 85%, 95% 100%, 0 100%);
    margin-bottom: 2px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--cp-yellow);
    box-shadow: 0 0 5px rgba(252, 238, 10, 0.3);
}

.logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: sepia(0.5) contrast(1.2);
    /* Tech look */
}

.welcome-logo-img {
    width: 140px;
    height: 140px;
    object-fit: cover;
    border: 2px solid var(--cp-yellow);
    box-shadow: 0 0 15px rgba(252, 238, 10, 0.4);
    display: block;
    margin: 0 auto;
    clip-path: polygon(10% 0, 100% 0, 100% 90%, 90% 100%, 0 100%, 0 10%);
}

.logo-text {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--cp-yellow);
    text-transform: uppercase;
    text-shadow: 2px 2px 0px rgba(255, 0, 60, 0.5);
    font-family: 'Fira Code', monospace;
}

.sidebar-close {
    display: flex;
}

.sidebar.closed {
    margin-left: calc(var(--sidebar-width) * -1);
}

/* ========================================
   Buttons
   ======================================== */

.sidebar-toggle {
    display: flex;
}

/* ========================================
   Buttons
   ======================================== */

.btn-icon {
    width: 38px;
    height: 38px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--cp-blue);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: rgba(10, 189, 227, 0.1);
    border-color: var(--cp-blue);
    color: #fff;
    box-shadow: 0 0 8px var(--cp-blue);
}

/* ========================================
   Model Selector
   ======================================== */

.model-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.section-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--cp-red);
    margin-bottom: 12px;
    display: block;
    text-shadow: 0 0 2px var(--cp-red);
}

.model-dropdown {
    position: relative;
}

.model-dropdown-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--cp-blue);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: inset 2px 2px 0 rgba(0, 0, 0, 0.5);
    clip-path: polygon(0 0, 100% 0, 100% 85%, 95% 100%, 0 100%);
}

.model-dropdown-btn:hover {
    background: rgba(10, 189, 227, 0.1);
    box-shadow: 0 0 10px rgba(10, 189, 227, 0.3);
}

.model-dropdown-btn svg {
    margin-left: auto;
    color: var(--cp-blue);
}

.model-badge {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 6px;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Dropdown Menu - Holographic feel */
.model-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: rgba(10, 10, 10, 0.95);
    border: 1px solid var(--cp-blue);
    padding: 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1100;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
}

.model-dropdown.open .model-dropdown-menu {
    display: block;
    animation: glitchIn 0.2s steps(5);
}

@keyframes glitchIn {
    0% {
        clip-path: inset(0 100% 0 0);
        opacity: 0;
    }

    20% {
        clip-path: inset(0 60% 0 0);
        opacity: 0.4;
    }

    40% {
        clip-path: inset(0 30% 0 0);
        opacity: 0.8;
    }

    60% {
        clip-path: inset(0 10% 0 0);
        opacity: 1;
    }

    100% {
        clip-path: inset(0 0 0 0);
        opacity: 1;
    }
}

.model-group-label {
    padding: 8px 12px;
    font-size: 0.7rem;
    color: var(--cp-yellow);
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.model-option {
    width: 100%;
    display: block;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    text-align: left;
    cursor: pointer;
    text-transform: uppercase;
}

.model-option:hover {
    background: rgba(10, 189, 227, 0.2);
    color: white;
    padding-left: 20px;
    /* Slight movement on hover */
}

.model-option.active {
    background: var(--cp-blue);
    color: #000;
    font-weight: 700;
}

/* ========================================
   Chat History
   ======================================== */

.chat-history-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    min-height: 0;
}

.section-label-row {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-subtle);
}

.chat-history-list {
    padding: 10px 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.chat-history-item {
    padding: 12px 20px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    border-left: 2px solid transparent;
    transition: all 0.1s;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Hover effect like 'selecting a mission' */
.chat-history-item:hover {
    background: rgba(255, 0, 60, 0.05);
    color: var(--cp-red);
    border-left-color: var(--cp-red);
    padding-left: 24px;
}

/* Active item */
.chat-history-item.active {
    background: rgba(255, 0, 60, 0.1);
    color: var(--cp-red);
    border-left-color: var(--cp-red);
    text-shadow: 0 0 5px rgba(255, 0, 60, 0.5);
    font-weight: 700;
}

/* Add a little decorative block to right of active/hover */
.chat-history-item::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--cp-red);
    transform: scaleY(0);
    transition: transform 0.2s;
}

.chat-history-item:hover::after,
.chat-history-item.active::after {
    transform: scaleY(1);
}

.btn-delete-chat {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    opacity: 0;
    transition: all 0.2s;
    z-index: 5;
    cursor: pointer;
}

.chat-history-item:hover .btn-delete-chat {
    opacity: 1;
}

.btn-delete-chat:hover {
    color: var(--cp-red);
    transform: scale(1.1);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
}

.powered-by {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    text-align: center;
    text-transform: uppercase;
}

/* ========================================
   Main Content
   ======================================== */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
    background: #000;
}

/* CRT Scanline Effect Overlay */
.main-content::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%);
    background-size: 100% 4px;
    z-index: 90;
    pointer-events: none;
    opacity: 0.6;
}

/* ========================================
   Top Bar
   ======================================== */

.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 12px;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(5, 5, 5, 0.8);
    backdrop-filter: blur(4px);
    z-index: 95;
}

.topbar-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-model {
    font-size: 1rem;
    font-weight: 700;
    color: var(--cp-yellow);
    text-transform: uppercase;
    font-family: var(--font-mono);
    letter-spacing: 1px;
}

.topbar-mode {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--bg-primary);
    background: var(--cp-blue);
    padding: 2px 8px;
    text-transform: uppercase;
    clip-path: polygon(10% 0, 100% 0, 100% 100%, 0% 100%, 0% 20%);
}

.btn-clear {
    margin-left: auto;
    color: var(--cp-red);
    border: 1px solid rgba(255, 0, 60, 0.3);
}

.btn-clear:hover {
    background: rgba(255, 0, 60, 0.1);
    box-shadow: 0 0 10px rgba(255, 0, 60, 0.2);
}

/* ========================================
   Chat Area
   ======================================== */

.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* Score/Welcome Screen */
.welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.welcome-title {
    font-family: var(--font-body);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--cp-yellow);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 8px;
    text-shadow: 2px 2px 0 var(--cp-red);
}

.welcome-subtitle {
    font-family: var(--font-mono);
    color: var(--cp-blue);
    font-size: 0.9rem;
    margin-bottom: 40px;
}

.welcome-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    max-width: 600px;
    width: 100%;
}

.welcome-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    padding: 20px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    clip-path: polygon(0 0, 100% 0, 100% 85%, 90% 100%, 0 100%);
}

.welcome-card:hover {
    background: rgba(255, 0, 60, 0.1);
    border-color: var(--cp-red);
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 rgba(255, 0, 60, 0.2);
}

.welcome-card span {
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    text-transform: uppercase;
}

/* ========================================
   Messages
   ======================================== */

.messages-container {
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
    padding: 20px 30px;
    display: flex;
    gap: 20px;
    position: relative;
}

/* User Message: Yellow text, minimalistic */
.user-message {
    border-left: 3px solid var(--cp-yellow);
    background: linear-gradient(90deg, rgba(252, 238, 10, 0.05), transparent);
}

.user-message .message-content {
    color: var(--text-user);
    font-family: var(--font-mono);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 1px;
}

.user-message .message-avatar {
    background: transparent;
    color: var(--cp-yellow);
    border: 1px solid var(--cp-yellow);
    box-shadow: 0 0 5px var(--cp-yellow);
    font-family: var(--font-mono);
}

/* Assistant Message: Boxy, Tech */
.assistant-message {
    border-left: 3px solid var(--cp-red);
    background: rgba(255, 0, 60, 0.02);
}

.assistant-message .message-avatar {
    background: var(--cp-red);
    color: #000;
    font-weight: 800;
    clip-path: polygon(0 0, 100% 0, 100% 80%, 80% 100%, 0 100%);
}

.message-avatar {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.6;
}

.message-content strong {
    color: var(--cp-blue);
    font-weight: 700;
}

.message-content code {
    background: rgba(10, 189, 227, 0.1);
    color: var(--cp-cyan);
    padding: 2px 6px;
    font-family: var(--font-mono);
    border: 1px solid rgba(10, 189, 227, 0.3);
}

.message-content pre {
    background: #080808;
    border: 1px solid var(--border-subtle);
    padding: 16px;
    margin: 12px 0;
    border-left: 2px solid var(--cp-blue);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

/* ========================================
   Input Area - The "Cyberpunk" Message Box
   ======================================== */

.input-area {
    padding: 24px;
    background: transparent;
    position: relative;
    z-index: 100;
}

.input-wrapper {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
}

/* The "MESSAGE" Label Tab above input */
.input-wrapper::before {
    content: "MESSAGE";
    position: absolute;
    top: -12px;
    left: 0;
    background: var(--cp-red);
    color: #000;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 8px;
    letter-spacing: 1px;
    font-family: var(--font-body);
    clip-path: polygon(0 0, 100% 0, 90% 100%, 0 100%);
    z-index: 5;
}

.input-box {
    background: rgba(10, 0, 0, 0.6);
    border: 1px solid var(--cp-red);
    /* Angled corners: Top-right and bottom-left clips */
    clip-path: polygon(0% 0%,
            100% 0%,
            100% 85%,
            /* Bottom right start align */
            98% 100%,
            /* Bottom right clipped */
            0% 100%);
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 16px;
    padding-top: 20px;
    /* Space for label if inside, but label is outside */
    position: relative;
    box-shadow: 0 0 10px rgba(255, 0, 60, 0.1);
    transition: all 0.2s;
}

.input-box:focus-within {
    box-shadow: 0 0 20px rgba(255, 0, 60, 0.3);
    border-color: #ff3366;
    background: rgba(20, 0, 0, 0.8);
}

/* Decorative line on bottom right */
.input-wrapper::after {
    content: "";
    position: absolute;
    bottom: -4px;
    right: 0;
    width: 60px;
    height: 4px;
    background: var(--cp-blue);
    clip-path: polygon(10% 0, 100% 0, 100% 100%, 0 100%);
}

.input-box textarea {
    background: transparent;
    border: none;
    color: var(--cp-red);
    /* Typing in Red per CP77 terminal */
    font-family: var(--font-mono);
    font-size: 1rem;
    resize: none;
    outline: none;
    flex: 1;
    min-height: 24px;
    caret-color: var(--cp-blue);
    text-transform: uppercase;
    /* Opt: for full terminal feel */
}

.input-box textarea::placeholder {
    color: rgba(255, 0, 60, 0.4);
    text-transform: none;
}

.input-actions {
    display: flex;
    gap: 8px;
    padding-bottom: 2px;
}

.btn-send {
    width: 60px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--cp-blue);
    color: var(--cp-blue);
    clip-path: polygon(10% 0, 100% 0, 100% 70%, 90% 100%, 0 100%, 0 30%);
    transition: all 0.1s;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-send svg {
    width: 20px;
    height: 20px;
}

.btn-send:hover {
    background: var(--cp-blue);
    color: #000;
    box-shadow: 0 0 15px rgba(10, 189, 227, 0.6);
}

.btn-mic {
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--cp-red);
    color: var(--cp-red);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    clip-path: polygon(20% 0, 100% 0, 100% 100%, 0 100%, 0 20%);
    transition: all 0.2s;
}

.btn-mic:hover {
    background: rgba(255, 0, 60, 0.1);
    box-shadow: 0 0 10px rgba(255, 0, 60, 0.3);
    color: #ff3366;
}

.btn-mic.recording {
    background: var(--cp-red);
    color: #000;
    box-shadow: 0 0 15px var(--cp-red);
    animation: micPulse 1s infinite alternate;
}

@keyframes micPulse {
    from {
        box-shadow: 0 0 5px var(--cp-red);
    }

    to {
        box-shadow: 0 0 15px var(--cp-red);
    }
}

.input-hint {
    text-align: right;
    color: var(--text-muted);
    font-size: 0.65rem;
    margin-top: 6px;
    font-family: var(--font-mono);
    text-transform: uppercase;
    opacity: 0.7;
}

/* ========================================
   Responsive & Mobile
   ======================================== */

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-toggle,
    .sidebar-close {
        display: flex;
    }

    .input-area {
        padding: 12px;
    }

    .input-box {
        padding: 12px;
    }

    .message {
        padding: 16px;
    }
}

/* ========================================
   Interactive Elements (Stop, Error, etc)
   ======================================== */

.btn-stop {
    width: 60px;
    height: 36px;
    background: rgba(255, 0, 60, 0.1);
    color: var(--cp-red);
    border: 1px solid var(--cp-red);
    clip-path: polygon(10% 0, 100% 0, 100% 70%, 90% 100%, 0 100%, 0 30%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-stop:hover {
    background: var(--cp-red);
    color: #000;
    box-shadow: 0 0 15px var(--cp-red);
}

.error-text {
    color: var(--cp-red);
    background: rgba(255, 0, 60, 0.1);
    border: 1px solid var(--cp-red);
    padding: 12px 16px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    margin: 8px 0;
    border-left: 4px solid var(--cp-red);
}

/* ========================================
   Image Generation
   ======================================== */

.generated-image-wrapper {
    position: relative;
    display: inline-block;
    margin-top: 12px;
}

.generated-image-wrapper img {
    display: block;
    max-width: 100%;
    border: 1px solid var(--cp-blue);
    clip-path: polygon(0 0, 100% 0, 100% 95%, 95% 100%, 0 100%);
}

.image-download-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--cp-blue);
    color: var(--cp-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.image-download-btn:hover {
    background: var(--cp-blue);
    color: #000;
}

/* ========================================
   OCR / formatting
   ======================================== */

.ocr-upload-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(6, 182, 212, 0.05);
    /* faint cyan */
    border: 1px dashed var(--cp-cyan);
    margin: 8px 0;
    transition: all 0.2s;
}

.ocr-upload-box:hover {
    background: rgba(6, 182, 212, 0.1);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

.ocr-upload-btn {
    background: var(--cp-cyan);
    color: #000;
    border: none;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-mono);
    text-transform: uppercase;
    cursor: pointer;
    clip-path: polygon(10% 0, 100% 0, 100% 100%, 0 100%, 0 20%);
}

.ocr-result-text {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--cp-yellow);
    color: var(--cp-yellow);
    padding: 12px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    border-left: 3px solid var(--cp-yellow);
}

/* Markdown extras */
.message-content h1,
.message-content h2,
.message-content h3 {
    color: var(--cp-blue);
    text-transform: uppercase;
    margin-top: 16px;
    margin-bottom: 8px;
    font-family: var(--font-body);
    font-weight: 700;
    letter-spacing: 1px;
}

.message-content blockquote {
    border-left: 3px solid var(--cp-red);
    background: rgba(255, 0, 60, 0.05);
    color: var(--text-primary);
    padding: 8px 16px;
    margin: 12px 0;
    font-family: var(--font-mono);
    font-style: italic;
}

.message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.message-content th,
.message-content td {
    border: 1px solid rgba(255, 0, 60, 0.3);
    padding: 8px;
    text-align: left;
}

.message-content th {
    background: rgba(255, 0, 60, 0.1);
    color: var(--cp-red);
    text-transform: uppercase;
}

.message-content hr {
    border: none;
    border-top: 1px solid var(--cp-red);
    opacity: 0.3;
    margin: 20px 0;
}

/* ========================================
   Missing Components Restoration
   ======================================== */

/* Message Copy Button */
.message-actions {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.message:hover .message-actions {
    opacity: 1;
}

.btn-message-action {
    width: 28px;
    height: 28px;
    border: 1px solid var(--cp-blue);
    background: rgba(0, 0, 0, 0.6);
    color: var(--cp-blue);
    clip-path: polygon(10% 0, 100% 0, 100% 90%, 90% 100%, 0 100%, 0 10%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-message-action:hover {
    background: var(--cp-blue);
    color: #000;
    box-shadow: 0 0 8px var(--cp-blue);
}

.btn-message-action.copied {
    border-color: var(--cp-yellow);
    color: var(--cp-yellow);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 4px;
    height: 12px;
    background: var(--cp-red);
    animation: typingGlitch 1s infinite alternate;
    box-shadow: 0 0 5px var(--cp-red);
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
    height: 16px;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingGlitch {
    0% {
        opacity: 0.3;
        transform: scaleY(0.8);
    }

    50% {
        opacity: 1;
        transform: scaleY(1.2);
    }

    100% {
        opacity: 0.3;
        transform: scaleY(0.8);
    }
}

/* OCR Extras */
.ocr-filename {
    font-size: 0.75rem;
    color: var(--cp-cyan);
    font-family: var(--font-mono);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ocr-image-preview {
    max-width: 200px;
    max-height: 200px;
    border: 1px solid var(--cp-cyan);
    margin-bottom: 12px;
    opacity: 0.8;
}