:root {
    --bg-color: #0f172a;
    --surface-color: #1e293b;
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.5);
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.5);
    --success: #10b981;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

header {
    padding: 20px;
    text-align: center;
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
}

h1 {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.status-badge {
    display: inline-block;
    margin-top: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.status-badge.connected {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border-color: var(--success);
}

.container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 20px;
    overflow-y: auto;
}

/* Mic Button Area */
.mic-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 250px;
}

.mic-btn {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: var(--surface-color);
    border: 2px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    font-size: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    position: relative;
}

.mic-btn::before {
    content: '';
    position: absolute;
    top: -10px; left: -10px; right: -10px; bottom: -10px;
    border-radius: 50%;
    background: transparent;
    z-index: -1;
    transition: all 0.3s ease;
}

.mic-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 40px var(--primary-glow);
}

.mic-btn.active::before {
    background: var(--primary-glow);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.4); opacity: 0; }
}

/* Controls Area */
.controls-card {
    background: var(--surface-color);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.toggle-row:last-child {
    margin-bottom: 0;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.toggle-info h3 {
    font-size: 1rem;
    margin-bottom: 4px;
}

.toggle-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Switch UI */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

input#silent-mode:checked + .slider {
    background-color: var(--danger);
}

/* History Area */
.history-card {
    background: var(--surface-color);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.history-header h3 {
    font-size: 1rem;
}

.view-all {
    color: var(--primary);
    font-size: 0.85rem;
    text-decoration: none;
}

.history-list {
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    background: rgba(0, 0, 0, 0.2);
    padding: 12px;
    border-radius: 12px;
    font-size: 0.9rem;
    border-left: 3px solid var(--danger);
}

.history-item .time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: block;
}

/* Login Overlay */
.overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.overlay.hidden {
    display: none;
}
.login-box {
    background: var(--surface-color);
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    text-align: center;
}
.login-box input {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.2);
    color: white;
}
.login-box button {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    margin-top: 15px;
    cursor: pointer;
    font-size: 1rem;
}
.error-msg {
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 10px;
}
