/* Quick Dictate — fullscreen, dark, hands-free mic capture */

* { box-sizing: border-box; }
body {
    background: #161618;
    margin: 0;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

.qd-shell {
    min-height: 100vh; min-height: 100dvh;
    display: flex; flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---- Header ---------------------------------------------------------- */
.qd-header {
    background: #0F0F11; color: #fff;
    padding: 12px 14px;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    display: flex; align-items: center; gap: 10px;
    flex: 0 0 auto;
    border-bottom: 1px solid #2A2A2D;
}
.qd-header h1 {
    margin: 0; flex: 1;
    font-size: 14pt; font-weight: 600;
}
.qd-back {
    color: #fff; text-decoration: none;
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20pt; font-weight: 300;
    border-radius: 50%;
}
.qd-back:hover { background: rgba(255,255,255,0.10); }
.qd-icon-btn {
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    background: transparent; color: inherit;
    border: none; border-radius: 50%;
    cursor: pointer; padding: 0;
}
.qd-icon-btn:hover { background: rgba(255,255,255,0.10); }

/* Auto-restart toggle pill in the header — ON pulses green, OFF is muted. */
.qd-auto-toggle {
    flex: 0 0 auto;
    display: inline-flex; align-items: center; gap: 6px;
    background: transparent;
    color: #B8B8BC;
    border: 1px solid #444448; border-radius: 999px;
    padding: 5px 11px;
    font: 600 10.5pt -apple-system, "Segoe UI", system-ui, sans-serif;
    cursor: pointer;
    -webkit-appearance: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.qd-auto-toggle .qd-auto-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #6A6A70;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}
.qd-auto-toggle[aria-pressed="true"] {
    background: rgba(20,160,140,0.18);
    color: #6FE2C8;
    border-color: rgba(20,160,140,0.55);
}
.qd-auto-toggle[aria-pressed="true"] .qd-auto-dot {
    background: #14A08C;
    box-shadow: 0 0 6px rgba(20,160,140,0.7);
}
.qd-auto-toggle:hover { background: rgba(255,255,255,0.06); }
.qd-auto-toggle[aria-pressed="true"]:hover { background: rgba(20,160,140,0.25); }

/* ---- Stage (the big middle) ------------------------------------------ */
.qd-stage {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 32px 24px;
    gap: 20px;
}

/* Mic + pulsing rings */
.qd-mic-wrap {
    position: relative;
    width: 200px; height: 200px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 12px;
}
.qd-mic {
    width: 140px; height: 140px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3C3C3C 0%, #2A2A2C 100%);
    color: #B8B8BC;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 28px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.08);
    transition: background 0.3s ease, color 0.3s ease, transform 0.2s ease;
    z-index: 2;
}
.qd-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(192,57,43,0.0);
    opacity: 0;
}
.qd-ring-1 { width: 160px; height: 160px; }
.qd-ring-2 { width: 180px; height: 180px; }
.qd-ring-3 { width: 200px; height: 200px; }

/* Recording state — red mic + pulsing rings */
.qd-shell[data-state="recording"] .qd-mic {
    background: linear-gradient(135deg, #E04E40 0%, #C0392B 100%);
    color: #fff;
    box-shadow: 0 12px 36px rgba(192,57,43,0.55), inset 0 1px 0 rgba(255,255,255,0.18);
}
.qd-shell[data-state="recording"] .qd-ring {
    border-color: rgba(192,57,43,0.55);
    animation: qd-pulse 2.2s ease-out infinite;
}
.qd-shell[data-state="recording"] .qd-ring-2 { animation-delay: 0.55s; }
.qd-shell[data-state="recording"] .qd-ring-3 { animation-delay: 1.10s; }

@keyframes qd-pulse {
    0%   { transform: scale(0.85); opacity: 0.85; }
    100% { transform: scale(1.35); opacity: 0;    }
}

/* Saving state — pulse becomes blue/teal */
.qd-shell[data-state="saving"] .qd-mic {
    background: linear-gradient(135deg, #1A73E8 0%, #0B4FA8 100%);
    color: #fff;
}
.qd-shell[data-state="saving"] .qd-ring {
    border-color: rgba(26,115,232,0.55);
    animation: qd-pulse 1.6s ease-out infinite;
}

/* Saved state — green check, no pulse */
.qd-shell[data-state="saved"] .qd-mic {
    background: linear-gradient(135deg, #14A08C 0%, #0E7A6B 100%);
    color: #fff;
}

/* ---- Audio meter ----------------------------------------------------- */
.qd-meter {
    width: 80%; max-width: 360px;
    height: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.qd-meter-fill {
    height: 100%;
    background: linear-gradient(90deg, #14A08C 0%, #E04E40 100%);
    width: 0%;
    transition: width 0.08s ease-out;
    border-radius: 3px;
}
.qd-shell[data-state="recording"] .qd-meter { opacity: 1; }

/* ---- Status text ---------------------------------------------------- */
.qd-status {
    font-size: 18pt; font-weight: 600;
    text-align: center;
    min-height: 28px;
    color: #fff;
    letter-spacing: -0.2px;
}
.qd-hint {
    font-size: 11pt; color: #999;
    text-align: center;
    max-width: 320px;
    line-height: 1.4;
    min-height: 16px;
}
.qd-timer {
    font-size: 13pt; font-weight: 600;
    color: #B8B8BC;
    font-variant-numeric: tabular-nums;
    min-height: 18px;
}

/* ---- Primary button (big touch target) ------------------------------- */
.qd-primary-btn {
    margin-top: 16px;
    padding: 18px 36px;
    min-width: 220px;
    font: inherit; font-size: 14pt; font-weight: 700;
    color: #fff;
    background: #1A73E8;
    border: none; border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(26,115,232,0.30);
    transition: background 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease;
    -webkit-appearance: none;
}
.qd-primary-btn:hover  { background: #2680F0; }
.qd-primary-btn:active { transform: scale(0.98); }

.qd-shell[data-state="recording"] .qd-primary-btn {
    background: #14A08C;
    box-shadow: 0 6px 20px rgba(20,160,140,0.35);
}
.qd-shell[data-state="recording"] .qd-primary-btn:hover { background: #18B89E; }

.qd-shell[data-state="saving"] .qd-primary-btn,
.qd-shell[data-state="saved"]  .qd-primary-btn {
    display: none;
}

.qd-shell[data-state="error"] .qd-primary-btn {
    background: #C0392B;
}
