:root {
    --bg-color: #08080a;
    --accent-color: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.4);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --system-msg: rgba(30, 41, 59, 0.5);
    --user-msg: #6366f1;
    --error-red: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-color);
    background-image: 
        radial-gradient(circle at 0% 0%, #1e1b4b 0%, transparent 40%),
        radial-gradient(circle at 100% 100%, #1e1b4b 0%, transparent 40%);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.glass-container {
    width: 100%;
    max-width: 600px;
    height: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

header {
    padding: 24px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 2px;
}

.logo span {
    color: var(--accent-color);
    font-weight: 300;
    font-size: 0.8rem;
    vertical-align: super;
}

.status-indicator {
    font-size: 0.75rem;
    color: #10b981;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-indicator::before {
    content: "";
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 10px #10b981;
}

main {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

/* Scrollbar */
main::-webkit-scrollbar { width: 4px; }
main::-webkit-scrollbar-track { background: transparent; }
main::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 10px; }

.message {
    max-width: 90%;
    padding: 14px 18px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.6;
    animation: fadeIn 0.3s ease-out;
    position: relative;
}

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

.message.user {
    align-self: flex-end;
    background: var(--user-msg);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.message.system {
    align-self: flex-start;
    background: var(--system-msg);
    border: 1px solid var(--glass-border);
    border-bottom-left-radius: 4px;
}

.message.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-red);
    border: 1px solid var(--error-red);
}

/* Markdown Styles */
.content pre {
    background: #000;
    padding: 12px;
    border-radius: 8px;
    margin: 10px 0;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    border: 1px solid var(--glass-border);
}

.content code {
    font-family: 'JetBrains Mono', monospace;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 0.9em;
}

#action-monitor {
    margin: 0 24px;
    padding: 12px 18px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px dashed var(--accent-color);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.monitor-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--accent-color);
}

.hidden { display: none !important; }

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--accent-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

footer {
    padding: 24px;
    background: rgba(0, 0, 0, 0.3);
}

.input-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#access-key {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.8rem;
    outline: none;
    transition: border-color 0.2s;
}

#access-key:focus { border-color: var(--accent-color); }

.chat-input-wrapper {
    display: flex;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
}

textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    padding: 8px;
    border-radius: 0;
    resize: none;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    max-height: 120px;
}

#send-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    flex-shrink: 0;
}

#send-btn:active { transform: scale(0.92); }
#send-btn:hover { background: #4f46e5; }
