:root {
    --bg: #0a0a0c;
    --surface: #141418;
    --border: #2a2a30;
    --text: #e0e0ff;
    --dim: #888899;
    --accent: #ff00ff;
    --secondary: #39ff14;
}

[data-theme="light"] {
    --bg: #f5f5f7;
    --surface: #ffffff;
    --border: #d1d1e0;
    --text: #1a1a1a;
    --dim: #666680;
    --accent: #d000d0;
    --secondary: #228b22;
}

* {
    box-sizing: border-box;
}

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

body {
    font-family: 'SF Mono', 'Fira Code', monospace;
    display: flex;
    flex-direction: column;
}

#loader {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s;
}

.progress-container {
    width: 150px;
    height: 2px;
    background: var(--border);
    margin: 20px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    position: absolute;
    width: 50%;
    height: 100%;
    background: var(--accent);
    animation: progress 2s infinite linear;
}

@keyframes progress {
    0% { left: -50%; }
    100% { left: 100%; }
}

header {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    flex-shrink: 0;
}

.header-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--secondary);
}

.header-titles {
    flex: 1;
    min-width: 0;
}

header h1 {
    font-size: 14px;
    margin: 0;
    color: var(--secondary);
}

header h2 {
    font-size: 11px;
    margin: 2px 0 0 0;
    color: var(--accent);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
}

#chat {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    -webkit-overflow-scrolling: touch;
}

.msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    word-wrap: break-word;
}

.msg.user {
    align-self: flex-end;
    background: var(--surface);
    border-right: 4px solid var(--secondary);
    color: var(--secondary);
}

.msg.cyb {
    align-self: flex-start;
    background: var(--surface);
    border-left: 4px solid var(--accent);
    color: var(--accent);
}

.msg-header {
    font-size: 9px;
    margin-bottom: 4px;
    opacity: 0.7;
}

#input-area {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 12px 15px env(safe-area-inset-bottom);
    flex-shrink: 0;
}

.control-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    overflow-x: auto;
}

.mode-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--dim);
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 10px;
    white-space: nowrap;
    cursor: pointer;
}

.mode-btn.active {
    border-color: var(--accent);
    color: var(--accent);
}

#expert-selector {
    display: none;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.exp-chip {
    padding: 4px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    font-size: 10px;
    cursor: pointer;
}

.exp-chip.active {
    border-color: var(--secondary);
    color: var(--secondary);
}

#input-row {
    display: flex;
    gap: 10px;
}

input {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 15px;
    border-radius: 20px;
    outline: none;
    min-width: 0;
}

#send-btn {
    background: var(--accent);
    color: #000;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
}

#edit-footer {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--secondary);
    color: #000;
    padding: 10px 15px;
    display: none;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: bold;
    z-index: 1000;
}

.edit-actions button {
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    background: #000;
    color: var(--secondary);
}
