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

:root {
    --bg:       #0a0a0f;
    --surface:  #13131a;
    --border:   #1e1e2e;
    --accent:   #7c6aff;
    --accent2:  #a78bfa;
    --text:     #e2e2f0;
    --muted:    #6b6b8a;
    --error:    #f87171;
    --success:  #34d399;
}

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
}

/* ── Screens ──────────────────────────────────────────────────────────── */

.screen {
    display: none;
    position: fixed;
    inset: 0;
    align-items: center;
    justify-content: center;
}
.screen.active { display: flex; }

/* ── Login ────────────────────────────────────────────────────────────── */

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px 32px;
    width: min(360px, 90vw);
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
}

.logo {
    font-size: 48px;
    margin-bottom: 16px;
}

.login-card h1 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 28px;
    color: var(--text);
}

.login-card input[type="password"] {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 16px;
    outline: none;
    margin-bottom: 14px;
    transition: border-color .2s;
}
.login-card input:focus { border-color: var(--accent); }

.login-card button {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .2s;
}
.login-card button:active { opacity: .8; }

.error { color: var(--error); font-size: 14px; margin-top: 12px; }
.hidden { display: none !important; }

#biometric-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: transparent;
    border: 1.5px solid var(--accent);
    color: var(--accent);
}
#biometric-btn:active { opacity: .8; }

.alt-link { margin-top: 16px; font-size: 14px; }
.alt-link a { color: var(--muted); text-decoration: none; }
.alt-link a:hover { color: var(--accent2); }

.setup-prompt-text { color: var(--muted); font-size: 15px; margin-bottom: 16px; }

/* ── Voice Screen ─────────────────────────────────────────────────────── */

.voice-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    padding: 24px;
    width: 100%;
    max-width: 480px;
}

.status-text {
    font-size: 17px;
    color: var(--muted);
    font-weight: 500;
    min-height: 24px;
    transition: color .3s;
}

/* ── Main voice button ────────────────────────────────────────────────── */

.voice-button {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--border);
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color .3s, color .3s, background .3s;
    -webkit-tap-highlight-color: transparent;
}
.voice-button svg { width: 36px; height: 36px; }

/* State: listening */
.voice-button.listening {
    border-color: var(--accent);
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}
.voice-button.listening .pulse-ring { animation: pulse 1.8s ease-out infinite; }

/* State: processing */
.voice-button.processing {
    border-color: var(--accent2);
    color: var(--accent2);
    background: color-mix(in srgb, var(--accent2) 10%, var(--surface));
}
.voice-button.processing .pulse-ring:nth-child(2) {
    animation: pulse 1.8s ease-out infinite .6s;
}

/* State: speaking */
.voice-button.speaking {
    border-color: var(--success);
    color: var(--success);
    background: color-mix(in srgb, var(--success) 10%, var(--surface));
}
.voice-button.speaking .pulse-ring { animation: pulse 1.2s ease-out infinite; }

/* Pulse rings */
.pulse-ring {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid currentColor;
    opacity: 0;
}

@keyframes pulse {
    0%   { transform: scale(1);    opacity: .5; }
    100% { transform: scale(1.5);  opacity: 0; }
}

/* ── Transcript / Response boxes ──────────────────────────────────────── */

.transcript, .response {
    width: 100%;
    padding: 16px 18px;
    border-radius: 14px;
    font-size: 15px;
    line-height: 1.5;
    min-height: 48px;
    word-wrap: break-word;
    transition: opacity .3s;
}

.transcript {
    background: color-mix(in srgb, var(--accent) 8%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
    color: var(--accent2);
}
.transcript:empty { display: none; }

.response {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
}
.response:empty { display: none; }

/* ── Pause / Play button ──────────────────────────────────────────────── */

.pause-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--surface);
    border: 1.5px solid var(--border);
    color: var(--muted);
    cursor: pointer;
    transition: border-color .2s, color .2s, background .2s;
    -webkit-tap-highlight-color: transparent;
    margin-top: -12px;
}
.pause-button svg { width: 22px; height: 22px; }
.pause-button:active { opacity: .7; }

.pause-button.paused {
    border-color: var(--accent);
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

/* ── Safe area insets for iPhone ──────────────────────────────────────── */
.voice-container {
    padding-bottom: max(24px, env(safe-area-inset-bottom));
    padding-top: max(24px, env(safe-area-inset-top));
}
