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

:root {
    --bg: #1a1a2e;
    --surface: #16213e;
    --surface2: #0f3460;
    --accent: #e94560;
    --accent-dim: #a83249;
    --text: #eee;
    --text-dim: #999;
    --user-bg: #0f3460;
    --assistant-bg: #1a1a3e;
    --radius: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100dvh;
    overflow: hidden;
}

#app {
    height: 100dvh;
    display: flex;
    flex-direction: column;
}

.screen { display: flex; flex-direction: column; height: 100%; }
.hidden { display: none !important; }

/* Auth */
.auth-box {
    margin: auto;
    text-align: center;
    padding: 2rem;
}

.auth-box h1 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: var(--accent);
}

.auth-box input {
    display: block;
    width: 300px;
    max-width: 90vw;
    padding: 0.75rem 1rem;
    margin: 0 auto 1rem;
    border: 1px solid var(--surface2);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 1rem;
}

.auth-box button {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: var(--radius);
    background: var(--accent);
    color: white;
    font-size: 1rem;
    cursor: pointer;
}

.auth-box button:hover { background: var(--accent-dim); }

/* Header */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--surface2);
}

header h1 {
    font-size: 1.1rem;
    color: var(--accent);
}

.header-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

#project-picker {
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    border: 1px solid var(--surface2);
    background: var(--bg);
    color: var(--text);
    font-size: 0.85rem;
}

#new-conv-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: var(--surface2);
    color: var(--text);
    font-size: 1.2rem;
    cursor: pointer;
}

#new-conv-btn:hover { background: var(--accent); }

/* Chat */
#chat {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.msg {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.msg.user {
    align-self: flex-end;
    background: var(--user-bg);
    border-bottom-right-radius: 4px;
}

.msg.assistant {
    align-self: flex-start;
    background: var(--assistant-bg);
    border-bottom-left-radius: 4px;
}

.msg.system {
    align-self: center;
    background: transparent;
    color: var(--text-dim);
    font-size: 0.85rem;
    font-style: italic;
}

/* Status bar */
#status-bar {
    text-align: center;
    padding: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* Footer */
footer {
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-top: 1px solid var(--surface2);
}

.input-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

#text-input {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 1px solid var(--surface2);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 0.95rem;
}

#text-input:focus { outline: 1px solid var(--accent); }

#send-btn {
    padding: 0.6rem 1rem;
    border: none;
    border-radius: var(--radius);
    background: var(--accent);
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
}

#send-btn:hover { background: var(--accent-dim); }

.controls-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.mic-button {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.mic-button:hover { background: rgba(233, 69, 96, 0.15); }
.mic-button.recording {
    background: var(--accent);
    color: white;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(233, 69, 96, 0.4); }
    50% { box-shadow: 0 0 0 12px rgba(233, 69, 96, 0); }
}

.vad-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-dim);
    cursor: pointer;
}

.vad-toggle input { cursor: pointer; }

/* Scrollbar */
#chat::-webkit-scrollbar { width: 6px; }
#chat::-webkit-scrollbar-track { background: transparent; }
#chat::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 3px; }
