:root {
    /* Magic UI / Apple Vision Pro Colors */
    --bg-base: #000000;
    --glass-bg: rgba(20, 20, 22, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-highlight: rgba(255, 255, 255, 0.15);
    
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --text-muted: rgba(255, 255, 255, 0.4);
    
    --accent-blue: #0A84FF;
    --accent-purple: #BF5AF2;
    --accent-pink: #FF375F;
    
    --status-online: #30D158;
    --status-offline: #FF453A;
    --status-processing: #FF9F0A;
    
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow: hidden;
    display: flex;
    justify-content: center;
}

/* --- Ambient Aurora Background --- */
.ambient-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: var(--bg-base);
    overflow: hidden;
}

.aurora {
    position: absolute;
    filter: blur(80px);
    opacity: 0.5;
    border-radius: 50%;
    animation: drift 25s infinite ease-in-out alternate;
    will-change: transform;
}

.aurora-1 {
    top: -10%; left: -10%;
    width: 60vw; height: 60vw;
    background: var(--accent-blue);
}

.aurora-2 {
    bottom: -20%; right: -10%;
    width: 80vw; height: 80vw;
    background: var(--accent-purple);
    animation-delay: -5s;
}

.aurora-3 {
    top: 30%; left: 40%;
    width: 50vw; height: 50vw;
    background: var(--accent-pink);
    animation-delay: -10s;
    opacity: 0.3;
}

.noise {
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 1;
}

@keyframes drift {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(10%, 15%) scale(1.2); }
}

/* --- Main Layout --- */
.app-layout {
    width: 100%;
    max-width: 500px;
    height: 100vh;
    height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
    padding: env(safe-area-inset-top, 1rem) 1rem env(safe-area-inset-bottom, 1rem) 1rem;
    gap: 1rem;
    position: relative;
    z-index: 10;
}

/* --- Glass Panel Utility --- */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255,255,255,0.1);
}

/* --- Header --- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.5rem;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1rem;
    color: white;
    box-shadow: 0 4px 12px rgba(191, 90, 242, 0.3);
}

h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.status-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-dot.online { background-color: var(--status-online); box-shadow: 0 0 8px var(--status-online); }
.status-dot.offline { background-color: var(--status-offline); }
.status-dot.processing { background-color: var(--status-processing); animation: blink 1s infinite alternate; }

@keyframes blink { to { opacity: 0.3; } }

/* --- Canvas (Transcription Area) --- */
.canvas {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.canvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.canvas-header h2 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.canvas-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: grid;
    place-items: center;
}

.action-btn:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
}

.transcription-scroll {
    flex-grow: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.transcription-scroll::-webkit-scrollbar { width: 4px; }
.transcription-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.empty-state {
    margin: auto;
    text-align: center;
    color: var(--text-muted);
}

.empty-icon-wrap {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--glass-border);
    display: grid;
    place-items: center;
    font-size: 1.5rem;
    margin: 0 auto 1rem auto;
}

.empty-state p {
    font-size: 0.95rem;
    line-height: 1.5;
}

.transcription-scroll p {
    background: rgba(255,255,255,0.05);
    padding: 1.25rem;
    border-radius: 16px;
    font-size: 1.05rem;
    line-height: 1.5;
    animation: slideUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    border: 1px solid rgba(255,255,255,0.03);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Bottom Dock --- */
.bottom-dock {
    flex-shrink: 0;
    padding-bottom: 0.5rem;
}

.dock-container {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Text Input */
.input-area {
    display: flex;
    align-items: flex-end;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 0.4rem 0.4rem 0.4rem 1rem;
    transition: all 0.3s ease;
}

.input-area:focus-within {
    border-color: rgba(255,255,255,0.3);
    background: rgba(0, 0, 0, 0.5);
}

#text-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.4;
    padding: 0.6rem 0;
    outline: none;
    resize: none;
    max-height: 100px;
}

#text-input::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 38px;
    height: 38px;
    border-radius: 16px;
    background: var(--text-primary);
    color: var(--bg-base);
    border: none;
    font-size: 1.1rem;
    display: grid;
    place-items: center;
    cursor: pointer;
    flex-shrink: 0;
    margin-left: 0.5rem;
    transition: all 0.2s;
}

.send-btn:disabled {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.3);
}

/* Separator */
.dock-separator {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
}

.dock-separator::before, .dock-separator::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--glass-border);
}

.dock-separator span {
    padding: 0 1rem;
}

/* Mic Area */
.mic-area {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    height: 90px;
}

.mic-button-wrapper {
    position: relative;
    display: grid;
    place-items: center;
}

.mic-glow {
    position: absolute;
    width: 120%;
    height: 120%;
    background: radial-gradient(circle, var(--accent-purple) 0%, transparent 70%);
    opacity: 0;
    filter: blur(20px);
    transition: opacity 0.3s;
    pointer-events: none;
}

.huge-mic-btn {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 40px;
    background: linear-gradient(145deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--text-primary);
    font-size: 2rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3), inset 0 2px 2px rgba(255,255,255,0.2);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2;
}

.huge-mic-btn:active {
    transform: scale(0.92);
}

.huge-mic-btn.recording {
    background: var(--status-offline);
    border-color: #ff6b6b;
    box-shadow: 0 0 40px rgba(255, 69, 58, 0.6);
    animation: throb 1.5s infinite alternate ease-in-out;
}

.huge-mic-btn.recording + .mic-glow {
    opacity: 1;
    background: radial-gradient(circle, rgba(255,69,58,0.5) 0%, transparent 70%);
}

@keyframes throb {
    from { transform: scale(1); }
    to { transform: scale(1.08); }
}

.processing-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--bg-base);
    z-index: 3;
    border-radius: 20px;
    color: var(--accent-purple);
    font-weight: 600;
    font-size: 0.9rem;
    animation: fadeIn 0.2s forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(191, 90, 242, 0.2);
    border-top-color: var(--accent-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* --- Toasts --- */
.toast-container {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 100;
}

.toast {
    background: rgba(20,20,22,0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 0.8rem 1.25rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    animation: toastDown 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.toast.error { border-color: rgba(255, 69, 58, 0.5); color: #ff6b6b; }
.toast i { color: var(--status-online); font-size: 1.1rem; }
.toast.error i { color: var(--status-offline); }

@keyframes toastDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.hidden { display: none !important; }
