:root {
    --bg: #08080f;
    --bg2: #12121e;
    --card: rgba(255,255,255,0.03);
    --border: rgba(255,255,255,0.07);
    --text: #eef0f8;
    --text2: #6b6b88;
    --accent: #7c6cf0;
    --accent-g: linear-gradient(135deg, #7c6cf0, #a78bfa);
    --green: #34d399;
    --red: #ef4444;
    --radius: 20px;
}
* { margin:0; padding:0; box-sizing:border-box; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    overflow: hidden;
}

.container {
    width: 100%;
    max-width: 440px;
    height: 100dvh;
    max-height: 820px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Header */
header { text-align: center; padding: 8px 0 0; }
.top-bar { display: flex; justify-content: center; align-items: center; gap: 10px; position: relative; }
.logo { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.5px; }
.logo span { background: var(--accent-g); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.tagline { color: var(--text2); font-size: 0.78rem; margin-top: 2px; }
.icon-btn {
    position: absolute;
    right: 0;
    background: none;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: border-color 0.2s;
}
.icon-btn:hover { border-color: var(--accent); }

/* Settings */
.settings-panel {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px 16px;
    display: none;
    flex-direction: column;
    gap: 10px;
    animation: slideDown 0.2s ease;
}
.settings-panel.open { display: flex; }
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.setting-group { display: flex; flex-direction: column; gap: 4px; }
.setting-group label { font-size: 0.75rem; color: var(--text2); }
.setting-group select {
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
}
.setting-group select:focus { border-color: var(--accent); }
.settings-actions { display: flex; gap: 8px; }
.btn-apply {
    flex: 1;
    padding: 8px;
    border-radius: 10px;
    border: none;
    background: var(--accent-g);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}
.btn-clear {
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: none;
    color: var(--text2);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
}
.btn-clear:hover { border-color: var(--red); color: var(--red); }

/* Chat */
.chat {
    flex: 1;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.msg {
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 0.85rem;
    line-height: 1.5;
    max-width: 88%;
    animation: pop 0.25s ease;
}
@keyframes pop {
    from { opacity: 0; transform: scale(0.95) translateY(6px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.msg.user { background: var(--accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.agent { background: var(--card); border: 1px solid var(--border); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.system { color: var(--text2); font-size: 0.76rem; text-align: center; align-self: center; background: none; }
.msg .label { font-size: 0.68rem; color: var(--text2); margin-bottom: 2px; display: block; }

/* Controls */
.controls { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mic-btn {
    width: 68px; height: 68px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg2);
    color: var(--text2);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}
.mic-btn:hover { border-color: var(--accent); color: var(--accent); }
.mic-btn:active, .mic-btn.recording {
    border-color: var(--red); color: #fff;
    background: var(--red);
    transform: scale(1.08);
    box-shadow: 0 0 0 8px rgba(239,68,68,0.15);
}
.mic-btn.processing {
    border-color: var(--accent); color: var(--accent);
    animation: pulse-a 1.2s ease infinite;
}
@keyframes pulse-a { 0%,100%{box-shadow:0 0 0 0 rgba(124,108,240,0.3)} 50%{box-shadow:0 0 0 12px rgba(124,108,240,0)} }

.hint { font-size: 0.73rem; color: var(--text2); }
.status { font-size: 0.7rem; color: var(--text2); display: flex; align-items: center; gap: 5px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text2); transition: background 0.3s; }
.status.connected .dot { background: var(--green); }
.status.error .dot { background: var(--red); }

/* Text input */
.text-input-area { display: flex; gap: 8px; }
#textInput {
    flex: 1; padding: 10px 16px;
    border-radius: 50px;
    border: 1px solid var(--border);
    background: var(--bg2);
    color: var(--text);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
}
#textInput:focus { border-color: var(--accent); }
.send-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--accent-g);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
