:root {
    --bg-dark: #030305;
    --bg-panel: rgba(255, 255, 255, 0.03);
    --border-light: rgba(255, 255, 255, 0.08);

    --primary-glow: #4f46e5;
    --secondary-glow: #ec4899;

    --text-main: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.6);

    --mode-functiondrive: #6366f1;
    --mode-rest: #f59e0b;
    --mode-mech: #ef4444;
    --mode-dent: #06b6d4;

    --font-stack: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    font-family: var(--font-stack);
    color: var(--text-main);
    height: 100vh;
    /* Fallback */
    height: var(--app-height, 100dvh);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* --- Background Effects --- */
.background-effects {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.glow-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
    animation: floatBlob 20s infinite alternate ease-in-out;
}

.blob-1 {
    width: 600px;
    height: 600px;
    background: var(--primary-glow);
    top: -10%;
    left: -10%;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: var(--secondary-glow);
    bottom: -10%;
    right: -10%;
    animation-delay: -5s;
}

.grid-overlay {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--border-light) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-light) 1px, transparent 1px);
    background-size: 50px 50px;
    mask-image: radial-gradient(circle at center, black 40%, transparent 80%);
    opacity: 0.2;
}

@keyframes floatBlob {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(50px, 50px) scale(1.1);
    }
}

/* --- Main Interface --- */
.glass-interface {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 1200px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2rem;
}

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

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-img {
    width: 40px;
    height: auto;
    object-fit: contain;
}

.logo-text {
    font-weight: 600;
    font-size: 1.25rem;
    letter-spacing: 1px;
}

.status-pill {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-light);
    padding: 8px 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(10px);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    /* Ready Green */
    border-radius: 50%;
    box-shadow: 0 0 10px #4ade80;
    transition: all 0.3s ease;
}

.status-text {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* Status States */
.status-pill.active .status-dot {
    background: #f472b6;
    box-shadow: 0 0 15px #f472b6;
    animation: pulseDot 1.5s infinite;
}

.status-pill.listening .status-dot {
    background: #60a5fa;
    /* Blue */
    box-shadow: 0 0 15px #60a5fa;
    animation: bounce 1s infinite;
}

/* --- Active Area (Orb & Text) --- */
.active-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

.orb-stage {
    position: relative;
    width: 300px;
    height: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.orb-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.orb-core {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #fff, var(--mode-functiondrive));
    box-shadow:
        0 0 60px var(--mode-functiondrive),
        inset 0 0 20px rgba(255, 255, 255, 0.5);
    z-index: 2;
    transition: all 0.5s ease;
}

.orb-flux {
    position: absolute;
    width: 180px;
    height: 180px;
    border-radius: 40%;
    background: var(--mode-functiondrive);
    opacity: 0.3;
    filter: blur(30px);
    animation: spinFlux 8s linear infinite;
    z-index: 1;
    transition: background 0.5s ease;
}

.orb-ring {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.05);
}

.ring-1 {
    width: 240px;
    height: 240px;
    animation: expandRing 4s infinite ease-out;
}

.ring-2 {
    width: 320px;
    height: 320px;
    animation: expandRing 4s infinite ease-out 1s;
    opacity: 0;
}

/* Orb States */
.orb-container.speaking .orb-core {
    animation: speakPulse 0.3s infinite alternate;
    box-shadow: 0 0 100px var(--mode-functiondrive), inset 0 0 30px #fff;
}

.orb-container.listening .orb-core {
    transform: scale(0.9);
    filter: brightness(0.8);
}

.orb-container.listening .orb-flux {
    animation: spinFlux 2s linear infinite;
    /* Speed up flux */
    width: 200px;
    height: 200px;
}

/* Generic Animations */
@keyframes spinFlux {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes speakPulse {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }

    100% {
        transform: scale(1.15);
        filter: brightness(1.3);
    }
}

@keyframes expandRing {
    0% {
        width: 120px;
        height: 120px;
        opacity: 0.8;
    }

    100% {
        width: 400px;
        height: 400px;
        opacity: 0;
    }
}

/* Transcription Overlay */
.transcription-overlay {
    position: absolute;
    top: 0;
    width: 100%;
    text-align: center;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    z-index: 20;
}

.text-ai,
.text-user {
    max-width: 600px;
    padding: 1rem 1.5rem;
    border-radius: 20px;
    font-size: 1.1rem;
    line-height: 1.5;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.text-ai.visible,
.text-user.visible {
    opacity: 1;
    transform: translateY(0);
}

.text-ai {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.text-user {
    color: var(--text-muted);
    font-size: 1rem;
    font-style: italic;
}


/* --- Footer / Dock --- */
.control-dock {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding-top: 2rem;
}

.mode-selector {
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    padding: 6px;
    border-radius: 16px;
    border: 1px solid var(--border-light);
    backdrop-filter: blur(20px);
}

.mode-btn {
    background: transparent;
    border: none;
    padding: 10px 20px;
    border-radius: 12px;
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 80px;
}

.mode-btn .icon {
    font-size: 1.2rem;
    filter: grayscale(1);
    transition: all 0.3s;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.mode-btn.active {
    background: var(--bg-panel);
    color: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-light);
}

.mode-btn.active .icon {
    filter: grayscale(0);
    transform: scale(1.1);
}

/* Action Button */
.main-action {
    perspective: 1000px;
}

.action-btn {
    background: linear-gradient(135deg, var(--text-main), #aaa);
    color: #000;
    border: none;
    padding: 16px 48px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 30px rgba(255, 255, 255, 0.15);
}

.action-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 15px 40px rgba(255, 255, 255, 0.25);
}

.action-btn:active {
    transform: translateY(1px) scale(0.98);
}

.action-btn.stop {
    background: linear-gradient(135deg, #ef4444, #991b1b);
    color: white;
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.3);
}

.action-btn.stop:hover {
    box-shadow: 0 15px 40px rgba(239, 68, 68, 0.5);
}

/* --- Mobile Responsiveness --- */

@media (max-width: 768px) {
    .glass-interface {
        height: 100vh;
        /* Fallback */
        height: var(--app-height, 100dvh);
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        padding: 1.5rem;
    }

    .orb-stage {
        transform: scale(0.8);
    }
}

@media (max-width: 480px) {
    .glass-interface {
        padding: 1rem;
    }

    /* Header adjustments */
    header {
        margin-bottom: 0.5rem;
    }

    .logo-text {
        font-size: 1rem;
    }

    .status-pill {
        padding: 6px 12px;
    }

    .status-text {
        font-size: 0.75rem;
    }

    /* Transcription scaling */
    .transcription-overlay {
        gap: 0.5rem;
    }

    .text-ai,
    .text-user {
        font-size: 0.95rem;
        padding: 0.8rem 1rem;
        max-width: 90%;
    }

    /* Orb adjustment for small screens */
    .orb-stage {
        transform: scale(0.9);
        margin: 3rem 0;
    }

    /* Footer/Dock scaling */
    .control-dock {
        padding-top: 1rem;
        gap: 16px;
        width: 100%;
    }

    .mode-selector {
        width: 100%;
        justify-content: space-between;
        gap: 4px;
        padding: 4px;
        overflow-x: auto;
        /* Just in case */
    }

    .mode-btn {
        min-width: auto;
        flex: 1;
        padding: 8px 4px;
        font-size: 0.75rem;
    }

    .mode-btn .icon {
        font-size: 1rem;
    }

    .mode-btn .label {
        font-size: 0.7rem;
    }

    .main-action {
        width: 100%;
    }

    .action-btn {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
        font-size: 1rem;
    }
}

/* --- Login Overlay --- */
.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(3, 3, 5, 0.85);
    backdrop-filter: blur(20px);
    transition: opacity 0.5s ease;
}

.login-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.glass-interface.blurred {
    filter: blur(10px);
    transform: scale(0.95);
    opacity: 0.5;
    pointer-events: none;
    transition: all 0.5s ease;
}

.login-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    padding: 3rem;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.login-box h2 {
    font-size: 1.8rem;
    font-weight: 600;
}

.login-box p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.login-box input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-light);
    padding: 1rem;
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    text-align: center;
    outline: none;
    transition: all 0.3s;
}

.login-box input:focus {
    border-color: var(--primary-glow);
    background: rgba(0, 0, 0, 0.5);
}

.logo-img.large {
    width: 120px;
    height: auto;
    margin-bottom: 0.5rem;
}

.error-text {
    color: #ef4444;
    font-size: 0.9rem;
    height: 1.2rem;
}

.error-text.hidden {
    visibility: hidden;
}