        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        :root {
            --oxygen-light: #E3F2FD;
            --oxygen-pale: #BBDEFB;
            --oxygen-medium: #90CAF9;
            --oxygen-vivid: #64B5F6;
            --oxygen-deep: #42A5F5;
            --oxygen-intense: #2196F3;
            --oxygen-dark: #1E88E5;
            --oxygen-darker: #1976D2;
            --oxygen-deepest: #1565C0;

            --accent-red-light: #FFCDD2;
            --accent-red: #EF5350;
            --accent-red-dark: #E53935;

            --bg-primary: #FFFFFF;
            --bg-secondary: #F5F9FF;
            --bg-card: rgba(255, 255, 255, 0.9);

            --text-primary: #263238;
            --text-secondary: #546E7A;
            --text-light: #78909C;

            --border-color: rgba(33, 150, 243, 0.3);
            --border-light: rgba(33, 150, 243, 0.15);

            --glass-blur: 12px;
            --shadow-color: rgba(33, 150, 243, 0.15);

            --waveform-color: #90CAF9;
            --waveform-cursor: #2196F3;
                /* Small extra spacing applied to header offset; editable in CSS for designers
                    Set to a negative value to move anchors slightly closer to the header. */
     --anchor-extra-spacing: -75px;
     /* Approximate fixed header height used for scroll-padding and section sizing.
         Adjust if header changes. Applied only on larger viewports. */
     --header-height: 72px;
    /* Placeholder visual tweak (opacity) for consistent UI across forms */
    --placeholder-opacity: 0.8;
    /* Agent-specific placeholder font size so designers can tune without editing rules */
    --placeholder-agent-size: 0.825rem;
        }

        [data-theme="dark"] {
            --bg-primary: #0A1929;
            --bg-secondary: #001E3C;
            --bg-card: rgba(20, 40, 65, 0.9);

            --text-primary: #FFFFFF;
            --text-secondary: #B2BAC2;
            --text-light: #8A919A;

            --border-color: rgba(100, 181, 246, 0.4);
            --disabled-text: rgba(255, 255, 255, 0.7);
            --disabled-bg: rgba(255, 255, 255, 0.15);
            --disabled-border: rgba(255, 255, 255, 0.4);
            --disabled-glow: rgba(255, 255, 255, 0.1);
            --border-light: rgba(100, 181, 246, 0.2);

            --shadow-color: rgba(0, 0, 0, 0.5);

            --waveform-color: #64B5F6;
            --waveform-cursor: #90CAF9;
        }

        html {
            scroll-behavior: smooth;
        }

        body {
            background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
            color: var(--text-primary);
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
            font-weight: 300;
            line-height: 1.6;
            overflow-x: hidden;
            position: relative;
            transition: background 0.3s ease, color 0.3s ease;
            min-height: 100vh;
        }

        /* On larger viewports, snap each top-level <section> to the viewport so
           only one section is visible at a time. This helps UHD/4K screens where
           multiple sections may otherwise be partially visible. */
        @media (min-width: 1200px) {
            html, body { height: 100%; }
            body {
                scroll-snap-type: y mandatory;
                scroll-behavior: smooth;
                scroll-padding-top: var(--header-height);
            }

            /* Make each section fill the viewport minus the fixed header height */
            section {
                scroll-snap-align: start;
                min-height: calc(100vh - var(--header-height));
                display: flex;
                flex-direction: column;
                justify-content: flex-start;
                box-sizing: border-box;
            }
        }
        
                /* Light Theme Gradient Background with Waveform */
        body::before {
            content: '';
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(180deg, #E3F2FD 0%, #BBDEFB 25%, #90CAF9 50%, #BBDEFB 75%, #E3F2FD 100%);
            z-index: -2;
            transition: opacity 0.3s ease;
        }

        /* Waveform Pattern */
        body::after {
            content: '';
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-image: 
                repeating-linear-gradient(
                    90deg,
                    transparent,
                    transparent 50px,
                    rgba(33, 150, 243, 0.03) 50px,
                    rgba(33, 150, 243, 0.03) 51px
                ),
                repeating-linear-gradient(
                    0deg,
                    transparent,
                    transparent 50px,
                    rgba(33, 150, 243, 0.03) 50px,
                    rgba(33, 150, 243, 0.03) 51px
                );
            z-index: -1;
            opacity: 1;
            transition: opacity 0.3s ease;
        }

        /* Waveform SVG Pattern */
        .waveform-container {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 0;
            pointer-events: none;
            overflow: hidden;
            opacity: 1;
            transition: opacity 0.3s ease;
        }

        .waveform-layer {
            position: absolute;
            width: 200%;
            height: 100%;
            left: -50%;
        }

        .wave-path {
            stroke: rgba(33, 150, 243, 0.08);
            stroke-width: 2;
            fill: none;
            stroke-linecap: round;
        }

        .wave-path-2 {
            stroke: rgba(66, 165, 245, 0.06);
            stroke-width: 3;
            fill: none;
        }

        /* Dark theme adjustments */
        [data-theme="dark"] body::before {
            background: linear-gradient(180deg, #0A1929 0%, #001E3C 100%);
        }

        [data-theme="dark"] body::after {
            opacity: 0;
        }

        [data-theme="dark"] .waveform-container {
            opacity: 0;
        }

        /* Parallax effect on scroll */
        .parallax-section {
            position: relative;
            z-index: 10;
        }

        .bubble-container {
            position: fixed;
            width: 100%;
            height: 100%;
            overflow: hidden;
            z-index: 1;
            pointer-events: none;
        }

        .bubble {
            position: absolute;
            border-radius: 50%;
            background: radial-gradient(circle at 30% 30%, 
                rgba(33, 150, 243, 0.3), 
                rgba(239, 83, 80, 0.1));
            backdrop-filter: blur(2px);
            animation: float-up 20s infinite;
            border: 1px solid rgba(255, 255, 255, 0.1);
        }

        [data-theme="dark"] .bubble {
            background: radial-gradient(circle at 30% 30%, 
                rgba(100, 181, 246, 0.2), 
                rgba(239, 83, 80, 0.05));
        }

        @keyframes float-up {
            0% {
                transform: translateY(100vh) translateX(0) scale(0);
                opacity: 0;
            }
            10% {
                opacity: 0.4;
                transform: translateY(90vh) translateX(10px) scale(1);
            }
            50% {
                opacity: 0.6;
                transform: translateY(50vh) translateX(-20px) scale(1.1);
            }
            90% {
                opacity: 0.3;
                transform: translateY(10vh) translateX(10px) scale(0.9);
            }
            100% {
                transform: translateY(-10vh) translateX(0) scale(0.5);
                opacity: 0;
            }
        }

        .bubble:nth-child(1) { width: 80px; height: 80px; left: 10%; animation-duration: 25s; }
        .bubble:nth-child(2) { width: 120px; height: 120px; left: 25%; animation-duration: 30s; animation-delay: 2s; }
        .bubble:nth-child(3) { width: 60px; height: 60px; left: 40%; animation-duration: 22s; animation-delay: 4s; }
        .bubble:nth-child(4) { width: 100px; height: 100px; left: 60%; animation-duration: 28s; animation-delay: 1s; }
        .bubble:nth-child(5) { width: 70px; height: 70px; left: 75%; animation-duration: 24s; animation-delay: 3s; }
        .bubble:nth-child(6) { width: 90px; height: 90px; left: 85%; animation-duration: 26s; animation-delay: 5s; }

        .glass-card {
            background: var(--bg-card);
            backdrop-filter: blur(20px);
            border: 2px solid var(--border-color);
            border-radius: 20px;
            padding: 2rem;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
            box-shadow: 0 8px 32px var(--shadow-color);
        }

        .glass-card:hover {
            transform: translateY(-5px);
            border-color: var(--oxygen-vivid);
            box-shadow: 0 12px 40px var(--shadow-color);
        }

        .btn-primary {
            display: inline-block;
            padding: 0.75rem 2rem;
            background: linear-gradient(135deg, var(--oxygen-deep) 0%, var(--accent-red) 100%);
            border: none;
            border-radius: 999px;
            color: white;
            font-weight: 500;
            font-size: 0.925rem;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
            box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
            background-origin: border-box;
            vertical-align: middle;
            line-height: 1.5;
            text-align: center;
        }

        .btn-primary::before {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
            transform: rotate(45deg);
            animation: shimmer 3s infinite;
        }

        @keyframes shimmer {
            0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
            100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
        }

        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
        }

        .btn-secondary {
            display: inline-block;
            padding: 0.75rem 2rem;
            background: var(--bg-card);
            border: none;
            border-radius: 999px;
            color: var(--text-primary);
            font-weight: 500;
            font-size: 0.925rem;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
            box-shadow: inset 0 0 0 1.5px var(--border-color);
            background-origin: border-box;
            vertical-align: middle;
            line-height: 1.5;
            text-align: center;
        }

        .btn-secondary::before {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: linear-gradient(45deg, transparent, rgba(33, 150, 243, 0.1), transparent);
            transform: rotate(45deg);
            animation: shimmer 3s infinite;
        }

        .btn-secondary:hover {
            background: linear-gradient(135deg, rgba(33, 150, 243, 0.08), rgba(239, 83, 80, 0.08));
            box-shadow: inset 0 0 0 1.5px var(--oxygen-vivid);
            transform: translateY(-2px);
        }

        /* Disabled button states */
        .btn-primary:disabled,
        .btn-primary.disabled {
            cursor: not-allowed;
            opacity: 0.6;
            transform: none !important;
            box-shadow: 0 0 0 rgba(0,0,0,0);
            background: linear-gradient(135deg, rgba(33,150,243,0.35) 0%, rgba(239,83,80,0.35) 100%);
            color: rgba(255,255,255,0.9);
            pointer-events: none; /* prevent hover effects */
        }

        .btn-primary:disabled::before,
        .btn-primary.disabled::before {
            animation: none;
            opacity: 0;
        }

        .btn-secondary:disabled,
        .btn-secondary.disabled {
            cursor: not-allowed;
            opacity: 0.8;
            transform: none !important;
            box-shadow: inset 0 0 0 1.5px var(--border-color);
        }

        [data-theme="dark"] .btn-secondary:disabled,
        [data-theme="dark"] .btn-secondary.disabled {
            color: var(--disabled-text);
            background: var(--disabled-bg);
            box-shadow: inset 0 0 0 1.5px var(--disabled-border), 0 0 10px var(--disabled-glow);
        }

        [data-theme="dark"] .btn-secondary:disabled::before,
        [data-theme="dark"] .btn-secondary.disabled::before {
            background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
            animation: none;
        }

        [data-theme="dark"] .btn-primary:disabled,
        [data-theme="dark"] .btn-primary.disabled {
            color: var(--disabled-text);
            background: rgba(76, 156, 246, 0.4);
            opacity: 0.8;
            transform: none !important;
            box-shadow: 0 0 10px rgba(76, 156, 246, 0.2);
        }

        .theme-toggle {
            padding: 0.5rem;
            background: var(--bg-card);
            border: 2px solid var(--border-color);
            border-radius: 50%;
            color: var(--text-primary);
            cursor: pointer;
            transition: all 0.3s;
            width: 44px;
            height: 44px;
            display: flex;
            align-items: center;
            justify-content: center;
            align-self: flex-end; /* Align bottom edge with avatar */
        }

        .theme-toggle:hover {
            transform: rotate(180deg);
            border-color: var(--oxygen-vivid);
        }

        .header-actions {
            display: flex;
            align-items: flex-end;
            gap: 1rem;
        }

        .logo {
            font-size: 2.5rem;
            font-weight: 400;
            font-family:"Poppins",sans-serif;
            background: linear-gradient(135deg, var(--oxygen-deepest) 0%, var(--oxygen-vivid) 25%, var(--accent-red-dark) 100%);
            -webkit-background-clip: text;
               -webkit-text-fill-color: transparent;
            background-clip: text;
            letter-spacing: -0.02em;
            text-decoration: none;
            display: inline-flex;
        }

        .nav-toggle {
            display: none;
            width: 44px;
            height: 44px;
            border-radius: 50%;
            border: 2px solid var(--border-color);
            background: var(--bg-card);
            color: var(--text-primary);
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .nav-toggle:hover {
            border-color: var(--oxygen-vivid);
            transform: rotate(90deg);
        }

        .nav-toggle i {
            font-size: 1.1rem;
            pointer-events: none;
        }

        .sr-only {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            white-space: nowrap;
            border: 0;
        }

        header nav.open {
            display: flex !important;
        }

        header {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 1000;
            padding: 1rem 2rem;
            background: var(--bg-card);
            backdrop-filter: blur(20px);
            border-bottom: 2px solid var(--border-light);
            transition: all 0.3s ease;
        }

        /* Ensure anchored sections are scrolled into view below the fixed
           header so their titles aren't occluded. Use a slightly larger
           offset specifically for the Features section to keep its title
           comfortably visible. */
        section {
            scroll-margin-top: calc(var(--header-height, 72px) + 12px);
        }

        /* Larger offset for the #features anchor to provide extra spacing */
        #features {
            scroll-margin-top: calc(var(--header-height, 72px) + 36px);
        }
        
        /* Apply similar larger offsets to other main anchors so their
           headings are visible below the fixed header when navigated to. */
        #demo,
        #voices,
        #pricing,
        #api {
            scroll-margin-top: calc(var(--header-height, 72px) + 36px);
        }

        .header-content {
            max-width: 1400px;
            margin: 0 auto;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        nav {
            display: none;
            gap: 2.5rem;
            align-items: center;
        }

        @media (min-width: 768px) {
            nav { display: flex; }
            .nav-toggle { display: none; }
            .header-actions { flex-wrap: nowrap; justify-content: flex-end; }
        }

        @media (max-width: 1024px) {
            section {
                padding: 2.5rem 1.75rem;
            }

            #demo {
                padding-top: 0.9rem;
            }

            #voices {
                padding-top: 0.9rem;
            }

            #pricing {
                padding-top: 0.9rem;
            }

            .hero {
                padding: 7.5rem 1.75rem 3.5rem;
            }

            .header-actions {
                gap: 0.75rem;
            }
        }

        @media (max-width: 767px) {
            header {
                padding: 0.75rem 1.25rem;
            }

            .header-content {
                position: relative;
                align-items: center;
                gap: 0.75rem;
                flex-wrap: wrap;
            }

            .nav-toggle {
                display: flex;
            }

            nav {
                position: absolute;
                top: calc(100% + 0.75rem);
                right: 0;
                width: min(280px, calc(100vw - 2.5rem));
                flex-direction: column;
                align-items: flex-start;
                gap: 0.75rem;
                background: var(--bg-card);
                border: 2px solid var(--border-light);
                border-radius: 16px;
                padding: 1rem;
                box-shadow: 0 18px 40px var(--shadow-color);
                z-index: 1001;
            }

            nav a {
                width: 100%;
                padding: 0.4rem 0;
            }

            nav a::after {
                display: none;
            }

            .logo {
                font-size: 2.2rem;
            }

            .header-actions {
                order: 3;
                width: 100%;
                justify-content: flex-end;
                flex-wrap: wrap;
                gap: 0.5rem;
            }

            .header-actions .btn-primary,
            .header-actions .btn-link {
                flex: 1 1 auto;
                min-width: 140px;
                text-align: center;
            }

            section {
                padding: 2rem 1.25rem;
            }

            #demo {
                padding-top: 1.25rem;
            }

            #voices {
                padding-top: 1.25rem;
            }

            #pricing {
                padding-top: 1rem;
            }

            .hero {
                padding: 6.5rem 1.25rem 3rem;
            }

            .feature-card,
            .pricing-card,
            .demo-section {
                padding: 1.75rem;
            }

            .pad {
                padding: 1.5rem;
            }

            .demo-row {
                flex-direction: column;
                align-items: stretch;
            }

            .code-wrapper {
                padding-bottom: 0.5rem;
            }

            .line-numbers {
                display: none;
            }

            .code-content {
                font-size: 0.9rem;
                padding: 1.25rem;
            }
        }

        @media (max-width: 540px) {
            .logo {
                font-size: 2rem;
            }

            .hero {
                padding: 6rem 1rem 2.75rem;
            }

            section {
                padding: 3.5rem 1rem;
            }

            .language-selector {
                grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
            }

            .header-actions .btn-primary,
            .header-actions .btn-link {
                min-width: 120px;
            }
        }

        nav a {
            color: var(--text-secondary);
            text-decoration: none;
            font-size: 0.925rem;
            font-weight: 400;
            transition: color 0.3s;
            position: relative;
        }

        nav a::after {
            content: '';
            position: absolute;
            bottom: -4px;
            left: 0;
            width: 0;
            height: 2px;
            background: linear-gradient(90deg, var(--oxygen-vivid), var(--accent-red));
            transition: width 0.3s ease;
        }

        nav a:hover {
            color: var(--oxygen-deep);
        }

        nav a:hover::after {
            width: 100%;
        }

        .hero {
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 8rem 2rem 4rem;
            position: relative;
            z-index: 10;
        }

        h1 {
            font-family: 'Poppins', sans-serif;
            font-size: clamp(2.5rem, 7vw, 4rem);
            font-weight: 200;
            line-height: 1.2;
            margin-bottom: 1.5rem;
            letter-spacing: -0.03em;
        }

        .gradient-text {
            background: linear-gradient(135deg, var(--oxygen-intense), var(--accent-red));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            font-weight: 400;
        }

        .feature-card {
            background: var(--bg-card);
            backdrop-filter: blur(10px);
            border: 2px solid var(--border-color);
            border-radius: 16px;
            padding: 2rem;
            transition: all 0.3s ease;
            cursor: pointer;
            box-shadow: 0 4px 20px var(--shadow-color);
        }

        .feature-card:hover {
            transform: translateY(-8px) scale(1.02);
            border-color: var(--oxygen-vivid);
            box-shadow: 0 8px 30px var(--shadow-color);
        }

        .demo-section {
            background: var(--bg-card);
            border: 1px solid var(--border-light);
            border-radius: 16px;
            /* base padding — specific modes may override */
            padding: 1.5rem;
            /* Reduced vertical gap between mode-toggle and demo card */
            margin: 0.5rem 0;
            box-shadow: 0 6px 20px var(--shadow-color);
        }

        .demo-text-box {
            background: var(--bg-secondary);
            border: 2px solid var(--border-light);
            border-radius: 12px;
            padding: 1.5rem;
            margin: 1rem 0;
            font-size: 1rem;
            line-height: 1.6;
            color: var(--text-primary);
        }

        /* Compact TTS demo overrides to reduce vertical height and improve balance */
        /* Make TTS demo card match the voice agent card spacing and padding */
        .demo-section.tts-content {
            padding: 2rem; /* match .pad */
            border: 1px solid var(--border-light);
            border-radius: 16px;
            box-shadow: 0 6px 20px var(--shadow-color);
            background: var(--bg-card);
            margin: 1rem 0;
            overflow-x: hidden;
        }

        .demo-section.tts-content .demo-text-box {
            padding: 0.75rem; /* smaller inner padding */
            margin: 0.6rem 0; /* tighter spacing between blocks */
            font-size: 1.35rem;
            line-height: 1.7;
            border-radius: 10px;
        }

        /* Use inline placeholder labels inside the text boxes to save vertical space */
        .demo-section.tts-content .demo-text-box {
            position: relative;
        }

        .demo-section.tts-content .demo-text-box::before {
            content: attr(data-label);
            display: block;
            font-size: 0.825rem;
            color: var(--text-secondary);
            margin-bottom: 0.35rem;
            line-height: 1;
        }

        /* Fixed height with overflow to reduce the card's vertical footprint */
        .demo-section.tts-content .demo-text-box {
            max-height: 84px; /* compact fixed height */
            overflow: auto;
        }

        /* Word highlighting for audio synchronization */
        .demo-text-box .word {
            display: inline;
            transition: all 0.2s ease;
            padding: 2px 1px;
            border-radius: 3px;
        }

        .demo-text-box .word.highlight {
            background: linear-gradient(90deg, rgba(33,150,243,0.3), rgba(239,83,80,0.2));
            color: var(--primary-color);
            /* avoid changing font-weight to prevent layout shift/jumpiness */
            transform: scale(1.02);
        }

        [data-theme="dark"] .demo-text-box .word.highlight {
            background: linear-gradient(90deg, rgba(66,165,245,0.4), rgba(239,83,80,0.3));
            color: #42A5F5;
        }

        .demo-section.tts-content h3 {
            margin-top: 0.25rem;
            margin-bottom: 0.5rem;
            font-size: 1rem;
        }

        /* Make toolbar and controls denser */
        .demo-section.tts-content .demo-row { gap: 0.5rem; }
        .demo-section.tts-content .country-dropdown .toggle,
        .demo-section.tts-content .select-trigger,
        .demo-section.tts-content .input-field { padding: 0.45rem 0.65rem; }

        .demo-section.tts-content .language-selector { gap: 0.5rem; }

        /* Smaller primary button in the compact demo card */
        .demo-section.tts-content .btn-primary {
            padding: 0.55rem 1.2rem;
            font-size: 0.95rem;
        }

        .language-selector {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
            gap: 0.75rem;
            margin: 1rem 0;
        }

        .language-selector .lang-btn {
            width: 100%;
            justify-content: center;
            text-align: center;
        }

        /* Country selector (flag + name) - custom dropdown */
        .demo-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 1rem;
        }

        .country-select {
            margin: 0;
            max-width: 420px;
            width: 100%;
            display: flex;
            justify-content: flex-end;
        }

        .country-dropdown {
            position: relative;
            min-width: 220px;
            max-width: 420px;
            width: 100%;
            display: inline-block;
            text-align: left;
        }

        /* When header layout is in use, make dropdown sit inline and compact */
        .country-header .country-dropdown { max-width: 280px; }

        /* Group container for label + dropdown so they share width and alignment */
        .country-field { display: grid; grid-template-rows: auto auto; gap: 0.35rem; }
    /* Match Agent "input-label" styling for consistency */
    .country-field .country-label { font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 0.5rem; text-align: left; font-weight: 500; line-height:1.2; }
    /* Translation label should match country/agent label */
    .translation-label { font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 0.5rem; text-align: left; font-weight: 500; line-height:1.2; }
        .country-field .country-select { width: 100%; }
        /* ensure the grouped field sits in the right column */
        .country-header > .country-field { justify-self: end; max-width: 280px; }

        @media (max-width: 640px) {
            .country-header { grid-template-columns: 1fr; grid-auto-rows: auto; gap: 0.5rem; }
            .country-header .country-label { grid-column: 1 / -1; justify-self: start; }
            .country-header .country-select { justify-self: start; max-width: 100%; }
        }

        /* Very small screens: collapse dropdown to icon-only (hide label text inside the toggle) */
        @media (max-width: 420px) {
            .country-dropdown .toggle .label { display: none; }
            .country-dropdown .toggle { padding-left: 0.4rem; padding-right: 0.4rem; }
            .country-dropdown .toggle img { width: 28px; height: 18px; }
        }

        .country-dropdown .toggle {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            justify-content: space-between;
            width: 100%;
            padding: 0.6rem 0.9rem;
            border-radius: 12px;
            border: 2px solid var(--border-light);
            background: var(--bg-secondary);
            cursor: pointer;
        }

        .country-dropdown .toggle img {
            width: 22px;
            height: 16px;
            object-fit: cover;
            border-radius: 2px;
            display: inline-block;
        }

        .country-dropdown .toggle .label {
            flex: 1;
            color: var(--text-primary);
            font-size: 0.95rem;
            margin-right: 0.5rem;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .country-dropdown .list {
            position: absolute;
            right: 0;
            top: calc(100% + 8px);
            width: 100%;
            max-height: 280px;
            overflow-y: auto;
            background: var(--bg-card);
            border: 2px solid var(--border-light);
            border-radius: 12px;
            box-shadow: 0 10px 30px var(--shadow-color);
            z-index: 1200;
            display: none;
        }

        .country-dropdown.open .list {
            display: block;
        }

        .country-item {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            padding: 0.5rem 0.75rem;
            cursor: pointer;
            transition: background 0.12s ease;
        }

        .country-item:hover {
            background: linear-gradient(90deg, rgba(33,150,243,0.04), rgba(239,83,80,0.02));
        }

        .country-item img { width: 26px; height: 18px; object-fit: cover; border-radius: 2px; }

        .country-item .name { color: var(--text-primary); font-size: 0.95rem; }

        .country-dropdown .search {
            width: 100%;
            padding: 0.5rem 0.75rem;
            border-bottom: 1px solid var(--border-light);
            background: transparent;
        }

        .country-dropdown .search input {
            width: 100%;
            padding: 0.5rem 0.5rem;
            border-radius: 8px;
            border: 1px solid var(--border-light);
            background: var(--bg-secondary);
        }

        /* Dark mode: make country dropdown caret icon white */
        [data-theme="dark"] .country-dropdown .toggle .fa-caret-down {
            color: #ffffff;
        }

        /* Custom scrollbar for country dropdown list */
        .country-dropdown .list::-webkit-scrollbar {
            width: 8px;
        }

        .country-dropdown .list::-webkit-scrollbar-track {
            background: rgba(0, 0, 0, 0.05);
            border-radius: 4px;
        }

        .country-dropdown .list::-webkit-scrollbar-thumb {
            background: rgba(0, 0, 0, 0.3);
            border-radius: 4px;
        }

        .country-dropdown .list::-webkit-scrollbar-thumb:hover {
            background: rgba(0, 0, 0, 0.4);
        }

        /* Dark mode scrollbar for country dropdown */
        [data-theme="dark"] .country-dropdown .list::-webkit-scrollbar-track {
            background: rgba(255, 255, 255, 0.08);
        }

        [data-theme="dark"] .country-dropdown .list::-webkit-scrollbar-thumb {
            background: rgba(255, 255, 255, 0.25);
        }

        [data-theme="dark"] .country-dropdown .list::-webkit-scrollbar-thumb:hover {
            background: rgba(255, 255, 255, 0.35);
        }

        .lang-btn {
            padding: 0.75rem 1rem;
            background: var(--bg-card);
            border: none;
            border-radius: 999px;
            color: var(--text-secondary);
            cursor: pointer;
            transition: all 0.3s;
            font-size: 0.875rem;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.25rem;
            box-shadow: inset 0 0 0 1.5px var(--border-light);
            background-origin: border-box;
            overflow: hidden;
        }

        .lang-btn-label {
            font-size: 0.75rem;
            font-weight: 500;
            color: var(--text-secondary);
        }

        .lang-btn-script {
            font-size: 0.65rem;
            font-weight: 400;
        }

        .lang-btn.active {
            background: linear-gradient(135deg, var(--oxygen-deep), var(--accent-red));
            color: white;
            box-shadow: none;
        }

        .lang-btn.active .lang-btn-label,
        .lang-btn.active .lang-btn-script {
            color: white;
        }

        /* Code Block with Line Numbers */
        .code-container {
            position: relative;
            background: linear-gradient(135deg, #1b1d24 0%, #13151b 100%);
            border: 2px solid rgba(100, 181, 246, 0.35);
            border-radius: 14px;
            overflow: hidden;
            box-shadow: 0 16px 45px rgba(5, 12, 22, 0.45);
            display: none;
        }

        .code-container.active {
            display: block;
        }

        [data-theme="dark"] .code-container {
            background: linear-gradient(135deg, #0f141d 0%, #080b11 100%);
            border-color: rgba(100, 181, 246, 0.45);
            box-shadow: 0 18px 55px rgba(0, 0, 0, 0.6);
        }

        .code-wrapper {
            display: flex;
            overflow-x: auto;
            overflow-y: hidden;
            height: auto;
            font-variant-ligatures: none;
            background: radial-gradient(circle at top left, rgba(100, 181, 246, 0.12), transparent 55%);
        }

        .line-numbers {
            background: rgba(9, 13, 22, 0.78);
            color: #a0adc2;
            padding: 1rem 0.5rem 1rem 0.75rem;
            text-align: right;
            font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
            font-size: 0.8rem;
            line-height: 1.5;
            user-select: none;
            border-right: 1px solid rgba(148, 163, 184, 0.18);
            min-width: 45px;
            height: auto;
            overflow: hidden;
            flex-shrink: 0;
        }

        [data-theme="dark"] .line-numbers {
            background: rgba(4, 7, 12, 0.82);
            color: #9aa6bf;
            border-right-color: rgba(148, 163, 184, 0.22);
        }

        .line-numbers span {
            display: block;
            padding: 0;
            opacity: 0.95;
            line-height: 1.5;
            height: 1.5em;
        }

        #api .line-numbers span {
            line-height: 1.5;
            height: 1.5em;
        }

        .code-content {
            flex: 1;
            padding: 1rem 1.25rem;
            font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
            font-size: 0.8rem;
            line-height: 1.5;
            letter-spacing: 0;
            white-space: pre;
            overflow-x: auto;
            overflow-y: hidden;
            height: auto;
            color: #f8fafc;
            text-shadow: 0 1px 2px rgba(3, 6, 12, 0.45);
            font-feature-settings: "liga" 0;
        }

        .code-keyword { color: #9aa7ff; font-weight: 600; }
        .code-string { color: #c8f7a0; }
        .code-comment { color: #8a94b3; font-style: italic; }
        .code-function { color: #7fd3ff; }
        .code-number { color: #f7a16c; }
        .code-operator { color: #9cdcfe; }
        .code-punctuation { color: #9cdcfe; opacity: 0.9; }
        .code-class { color: #ffdf8d; }
        .code-variable { color: #f8fafc; }

        .pricing-card {
            background: var(--bg-card);
            border: 2px solid var(--border-color);
            border-radius: 20px;
            padding: 2rem;
            transition: all 0.3s ease;
            position: relative;
            box-shadow: 0 4px 20px var(--shadow-color);
        }

        .pricing-card.highlight {
            border: 3px solid var(--oxygen-vivid);
            transform: scale(1.05);
            box-shadow: 0 8px 40px var(--shadow-color);
        }

        .pricing-badge {
            position: absolute;
            top: -12px;
            left: 50%;
            transform: translateX(-50%);
            background: linear-gradient(135deg, var(--oxygen-deep), var(--accent-red));
            padding: 0.3rem 1.2rem;
            border-radius: 50px;
            font-size: 0.75rem;
            font-weight: 600;
            color: white;
        }

        /* Compact layout for Developer API section: reduce trailing space and line gaps */
        #api {
            padding-top: 1.5rem;
            padding-bottom: 1.5rem;
        }

        #api .card.pad {
            padding: 0.75rem 0.9rem;
        }

        /* Make the language toggles denser */
        #api .lang-btn {
            padding: 0.45rem 0.6rem;
            gap: 0.15rem;
            font-size: 0.78rem;
            min-height: 36px;
        }

        /* Reduce gaps around code containers and make code blocks more compact */
        #api .code-container {
            margin-bottom: 0.4rem;
            border-radius: 10px;
            box-shadow: 0 8px 20px rgba(5,12,22,0.25);
        }

        #api .code-wrapper {
            padding-bottom: 0.15rem;
            /* Limit visible lines exactly to 21 lines. Line height is 1.5em, so set
               the wrapper height accordingly and enable vertical scroll for overflow. */
            max-height: calc(1.5em * 21);
            overflow-y: auto;
            display: flex;
            align-items: flex-start;
        }

        /* Ensure the line-number column doesn't extend past 21 visible lines */
        #api .line-numbers {
            max-height: calc(1.5em * 21);
            overflow: hidden;
        }

        #api .code-content {
            padding-top: 0.45rem;
            padding-bottom: 0.45rem;
            padding-left: 0.6rem;
            padding-right: 0.6rem;
            font-size: 0.85rem;
            line-height: 1.5;
            font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
            white-space: pre;
            overflow-x: auto;
            flex: 1;
        }

        #api .line-numbers {
            padding-top: 0.45rem;
            padding-bottom: 0.45rem;
            padding-left: 0.75rem;
            padding-right: 0.5rem;
            min-width: 38px;
            font-size: 0.85rem;
            line-height: 1.5;
            font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
            flex-shrink: 0;
            position: sticky;
            left: 0;
            background: rgba(9, 13, 22, 0.95);
            z-index: 1;
        }

        #api .line-numbers span {
            display: block;
            line-height: 1.5;
            height: 1.5em;
            margin: 0;
            padding: 0;
        }

        /* Tighten headings and paragraph spacing inside API card */
        #api h2, #api p {
            margin-top: 0;
            margin-bottom: 0.4rem;
        }

        /* Ensure direct-tts and with-translate spans don't introduce vertical gaps */
        #api .with-translate, #api .direct-tts {
            display: inline-block;
            margin: 0;
            padding: 0;
        }

        /* Reduce line-height for inline code-comments inside API examples to avoid trailing blank lines */
        #api .code-comment { line-height: 1.2; }

        /* Reduce top padding for demo section */
        #demo {
            padding-top: 0.5rem;
        }

        /* Reduce gap between heading and description in demo section */
        #demo h2 {
            margin-bottom: 0.5rem;
        }

        /* Reduce top padding for voices section */
        #voices {
            padding-top: 0.5rem;
        }

        /* Reduce gap between heading and description in voices section */
        #voices h2 {
            margin-bottom: 0.2rem;
        }

        /* Reduce top padding for pricing section */
        #pricing {
            padding-top: 1.5rem;
        }

        section {
            position: relative;
            padding: 3rem 2rem;
            max-width: 1400px;
            margin: 0 auto;
            z-index: 10;
            /* Ensure anchored headings offset below the fixed header.
               This value is updated at runtime to match the header height. */
            scroll-margin-top: var(--header-offset, 84px);
        }

        h2 {
            font-family: 'Poppins', sans-serif;
            font-size: clamp(2rem, 5vw, 3rem);
            font-weight: 200;
            margin-bottom: 1rem;
            letter-spacing: -0.02em;
        }

        h3 {
            font-family: 'Poppins', sans-serif;
            font-weight: 500;
        }

        .stat-card {
            background: var(--bg-card);
            border: 2px solid var(--border-light);
            border-radius: 16px;
            padding: 1.5rem;
            text-align: center;
            transition: all 0.3s ease;
            box-shadow: 0 4px 20px var(--shadow-color);
        }

        .stat-card:hover {
            transform: translateY(-5px);
            border-color: var(--oxygen-vivid);
        }

        .stat-number {
            font-size: 2rem;
            font-weight: 600;
            background: linear-gradient(135deg, var(--oxygen-intense), var(--accent-red));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .card {
            background: var(--bg-card);
            border: 1px solid var(--border-light);
            border-radius: 16px;
            box-shadow: 0 6px 20px var(--shadow-color);
        }

        .pad {
            padding: 2rem;
        }

        .toolbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 1rem;
            margin-bottom: 0.75rem;
            flex-wrap: wrap;
        }

        /* Compact tweaks specifically for the Voices section */
        #voices .card.pad { padding: 1.25rem; }
        #voices .toolbar { margin-bottom: 0.5rem; }
        #voices .chip { padding: 0.3rem 0.65rem; font-size: 0.9rem; }

        .chip {
            box-shadow: inset 0 0 0 1.5px var(--border-light);
            border: none;
            padding: 0.35rem 0.8rem;
            border-radius: 999px;
            background: var(--bg-card);
            cursor: pointer;
            transition: all 0.3s ease;
            background-origin: border-box;
        }

        .chip.active {
            background: linear-gradient(135deg, var(--oxygen-deep), var(--accent-red));
            color: white;
            box-shadow: none;
        }

        [data-theme="dark"] .chip {
            color: rgba(255, 255, 255, 0.92);
            box-shadow: inset 0 0 0 1.5px rgba(144, 202, 249, 0.35);
        }

        [data-theme="dark"] .chip:hover {
            color: #ffffff;
            box-shadow: inset 0 0 0 1.5px rgba(144, 202, 249, 0.6);
        }

        .currency-toggle {
            display: inline-flex;
            gap: 0.6rem;
            align-items: center;
        }

        .currency-btn {
            padding: 0.5rem 1.2rem;
            border-radius: 999px;
            border: none;
            background: var(--bg-card);
            color: var(--text-primary);
            cursor: pointer;
            font-weight: 600;
            transition: all 0.25s ease;
            box-shadow: inset 0 0 0 1.5px var(--border-color);
            background-origin: border-box;
            overflow: hidden;
        }

        .currency-btn:hover {
            box-shadow: inset 0 0 0 1.5px var(--oxygen-deep);
        }

        .currency-btn.active {
            background: linear-gradient(135deg, var(--oxygen-deep), var(--accent-red));
            color: #ffffff;
            box-shadow: 0 6px 16px rgba(33, 150, 243, 0.25);
        }

        [data-theme="dark"] .currency-btn {
            color: rgba(255, 255, 255, 0.9);
            box-shadow: inset 0 0 0 1.5px rgba(144, 202, 249, 0.35);
        }

        [data-theme="dark"] .currency-btn:hover {
            box-shadow: inset 0 0 0 1.5px rgba(144, 202, 249, 0.7);
        }

        [data-theme="dark"] .currency-btn.active {
            box-shadow: 0 6px 16px rgba(21, 101, 192, 0.45);
        }

        .voices-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); /* narrower cards */
            gap: 0.75rem; /* tighter gap */
        }

        .voices-list {
            display: flex;
            flex-direction: column;
            gap: 0.5rem; /* tighter vertical spacing */
        }

        .voice {
            display: flex;
            gap: 0.75rem; /* reduced internal gap */
            padding: 0.65rem 0.75rem; /* more compact padding */
            border: 1px solid var(--border-light);
            border-radius: 12px; /* slightly smaller radius */
            background: var(--bg-card);
            align-items: center;
            cursor: pointer;
            transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
            min-height: 76px; /* Ensure consistent height regardless of gender text */
        }

        .voice:hover {
            border-color: var(--oxygen-vivid);
            transform: translateY(-3px);
            box-shadow: 0 6px 16px var(--shadow-color);
        }

        .voice.active {
            border: 2px solid var(--oxygen-vivid);
        }

        .avatar {
            width: 44px; /* smaller avatar size */
            height: 44px;
            min-width: 44px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 1px solid var(--border-light);
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
            color: white;
            font-weight: 600;
            font-size: 1.05rem; /* smaller initial text */
            letter-spacing: 0.02em;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
        }

        .v-name {
            font-weight: 600;
            color: var(--text-primary);
            font-size: 0.9rem;
        }

        .v-meta {
            color: var(--text-secondary);
            font-size: 0.85rem; /* slightly smaller persona text */
            line-height: 1.25;
        }

        /* Alternative Design: Minimalist Ghost Button with Glow */
        .voice-play-btn {
            width: 38px;
            height: 38px;
            min-width: 38px;
            border-radius: 50%;
            border: 1.5px solid rgba(123, 31, 162, 0.25);
            background: transparent;
            color: var(--oxygen-vivid);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
            font-size: 0.95rem;
            position: relative;
            overflow: visible;
        }

        /* Pulsating aura ring for light mode */
        .voice-play-btn::after {
            content: '';
            position: absolute;
            inset: -2px;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.6);
            opacity: 0;
            transition: opacity 0.35s ease;
            z-index: -1;
        }

        /* Light mode styles */
        .voice-play-btn:hover {
            border-color: var(--oxygen-vivid);
            background: transparent;
            transform: scale(1.08);
            box-shadow: 
                0 0 0 3px rgba(123, 31, 162, 0.06),
                0 3px 12px rgba(123, 31, 162, 0.2);
        }

        .voice-play-btn:hover::after {
            opacity: 0.8;
            animation: pulse 1.2s ease-in-out infinite;
        }

        /* Playing state - white circle with pulsating aura */
        .voice-play-btn.playing {
            background: transparent;
            border-color: var(--oxygen-vivid);
            color: var(--oxygen-vivid);
            box-shadow: 
                0 0 0 2px rgba(123, 31, 162, 0.15),
                0 4px 12px rgba(123, 31, 162, 0.3);
            transform: scale(1.08);
        }

        /* Show pulsating aura while playing */
        .voice-play-btn.playing::after {
            opacity: 0.9;
            animation: pulse 1.2s ease-in-out infinite;
        }

        .voice-play-btn.playing:hover {
            transform: scale(1.1);
            box-shadow: 
                0 0 0 3px rgba(123, 31, 162, 0.12),
                0 5px 16px rgba(123, 31, 162, 0.35);
        }

        /* Dark mode styles - ethereal glow effect */
        [data-theme="dark"] .voice-play-btn {
            border-color: rgba(186, 104, 200, 0.3);
            color: rgba(186, 104, 200, 0.9);
        }

        [data-theme="dark"] .voice-play-btn::after {
            background: rgba(186, 104, 200, 0.3);
        }

        [data-theme="dark"] .voice-play-btn:hover {
            border-color: rgba(186, 104, 200, 0.8);
            background: rgba(186, 104, 200, 0.12);
            box-shadow: 
                0 0 0 3px rgba(186, 104, 200, 0.1),
                0 0 16px rgba(186, 104, 200, 0.3),
                0 0 32px rgba(186, 104, 200, 0.15);
            color: rgba(255, 255, 255, 0.95);
        }

        [data-theme="dark"] .voice-play-btn:hover::after {
            opacity: 0.8;
            animation: pulse 1.2s ease-in-out infinite;
        }

        [data-theme="dark"] .voice-play-btn.playing {
            background: transparent;
            border-color: rgba(186, 104, 200, 0.8);
            color: rgba(255, 255, 255, 0.95);
            box-shadow: 
                0 0 0 2px rgba(186, 104, 200, 0.2),
                0 0 16px rgba(186, 104, 200, 0.5),
                0 4px 12px rgba(123, 31, 162, 0.4);
            transform: scale(1.08);
        }

        /* Show pulsating aura while playing in dark mode */
        [data-theme="dark"] .voice-play-btn.playing::after {
            opacity: 0.9;
            animation: pulse 1.2s ease-in-out infinite;
        }

        [data-theme="dark"] .voice-play-btn.playing:hover {
            transform: scale(1.1);
            box-shadow: 
                0 0 0 3px rgba(186, 104, 200, 0.18),
                0 0 20px rgba(186, 104, 200, 0.5),
                0 0 40px rgba(186, 104, 200, 0.25),
                0 5px 16px rgba(123, 31, 162, 0.4);
        }

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

        @keyframes pulse {
            0%, 100% {
                transform: scale(1);
                opacity: 0.6;
            }
            50% {
                transform: scale(1.15);
                opacity: 0.3;
            }
        }

        .voice-play-btn:active {
            transform: scale(0.95);
            transition-duration: 0.1s;
        }

        /* Custom play icon - centered triangle */
        .voice-play-btn .play-icon {
            width: 0;
            height: 0;
            border-style: solid;
            border-width: 6px 0 6px 10px;
            border-color: transparent transparent transparent currentColor;
            margin-left: 1px;
            transition: all 0.3s ease;
            filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
        }

        /* Custom pause icon - two bars */
        .voice-play-btn .pause-icon {
            display: flex;
            gap: 4px;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
            color: inherit;
            transform: translateZ(0); /* Force hardware acceleration for consistent rendering */
        }

        .voice-play-btn .pause-icon::before,
        .voice-play-btn .pause-icon::after {
            content: '';
            width: 3px;
            height: 13px;
            background-color: currentColor;
            border-radius: 0.5px;
            transform: translateZ(0); /* Force hardware acceleration */
            will-change: transform;
        }

        /* Hide icons by default */
        .voice-play-btn .pause-icon {
            display: none;
        }

        /* Show appropriate icon based on state */
        .voice-play-btn.playing .play-icon {
            display: none;
        }

        .voice-play-btn.playing .pause-icon {
            display: flex;
            color: inherit;
        }

        /* Ensure consistent icon colors in all states */
        .voice-play-btn.playing .pause-icon::before,
        .voice-play-btn.playing .pause-icon::after {
            background-color: currentColor;
        }

        .voice-play-btn i {
            pointer-events: none;
        }
        
        /* Modal Styles */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(8px);
            z-index: 1000;
            align-items: center;
            justify-content: center;
            padding: 2rem;
            opacity: 0;
            visibility: hidden;
            display: flex;
            transition: all 0.3s ease-in-out;
        }

        .modal-overlay.active {
            opacity: 1;
            visibility: visible;
        }

        .modal-content {
            transform: translateY(20px);
            opacity: 0;
            transition: all 0.3s ease-in-out;
        }

        .modal-overlay.active .modal-content {
            transform: translateY(0);
            opacity: 1;
        }

        .modal-content {
            background: var(--bg-card);
            border: 2px solid var(--border-color);
            border-radius: 24px;
            padding: 3rem;
            max-width: 480px;
            width: 100%;
            max-height: 90vh;
            overflow-y: auto;
            box-shadow: 0 20px 60px var(--shadow-color);
            animation: slideUp 0.4s ease;
            position: relative;
        }

        /* Increase layout height for sign-up modal so it fits without vertical scrollbar */
        #signUpModal .modal-content {
            /* allow the modal to occupy more vertical space while keeping a small margin */
            max-height: 92vh;
            padding: 2rem 1.5rem;
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
        }

        /* Reduce spacing for input groups inside sign-up modal */
        #signUpModal .input-group { margin-bottom: 0.7rem; }
        #signUpModal .input-field { padding: 0.7rem 0.9rem 0.7rem 3rem; font-size: 0.95rem; }

        /* Make SSO button slightly more compact */
        #signUpModal .sso-btn { padding: 0.75rem 0.75rem; font-size: 0.95rem; }

        /* Slightly smaller title/logo/subtitle inside sign-up so content fits */
        #signUpModal .modal-logo { margin-bottom: 1rem; }
        #signUpModal .modal-logo-text { 
            font-size: 2.5rem; 
            font-weight: 300; 
            font-family: 'Poppins', sans-serif; 
            background: linear-gradient(135deg, var(--oxygen-deepest) 0%, var(--oxygen-vivid) 25%, var(--accent-red-dark) 100%);
            -webkit-background-clip: text; 
            -webkit-text-fill-color: transparent; 
            background-clip: text;  
        }
        #signUpModal .modal-title { font-size: 1.15rem; margin-bottom: 0.35rem; }
        #signUpModal .modal-subtitle { margin-bottom: 1rem; font-size: 0.95rem; }

        /* Compact divider and small helper link spacing */
        #signUpModal .divider { margin: 1rem 0; }
        #signUpModal .signup-link { margin-top: 0.6rem; font-size: 0.9rem; }

        /* Responsive: for very short viewports, tighten further so scrollbar is unlikely */
        @media (max-height: 720px) {
            /* on very short viewports allow slightly less height but still avoid extreme shrink */
            #signUpModal .modal-content { max-height: 84vh; padding: 1rem; }
            #signUpModal .modal-logo-text { 
                font-size: 2.5rem; 
                font-weight: 300; 
                font-family: 'Poppins', sans-serif; 
            background: linear-gradient(135deg, var(--oxygen-deepest) 0%, var(--oxygen-vivid) 25%, var(--accent-red-dark) 100%);
                -webkit-background-clip: text; 
                -webkit-text-fill-color: transparent; 
                background-clip: text;  
             }
            #signUpModal .modal-title { font-size: 1.05rem; }
            #signUpModal .modal-subtitle { font-size: 0.9rem; }
            #signUpModal .input-field { padding: 0.6rem 0.8rem 0.6rem 3rem; }
            #signUpModal .sso-btn { padding: 0.6rem 0.6rem; }

            /* Forgot Password Modal specific styles */
            #forgotPasswordModal .modal-content {
                max-width: 440px;
                max-height: 92vh;
                width: 100%;
                margin: 1.5rem;
                padding: 1.5rem;
                border-radius: 20px;
                background: var(--bg-card);
                box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
            }

            #forgotPasswordModal .input-group { margin-bottom: 0.7rem; }
            #forgotPasswordModal .input-field { 
                padding: 0.7rem 0.9rem 0.7rem 3rem; 
                font-size: 0.95rem; 
            }
            #forgotPasswordModal .sso-btn { 
                padding: 0.75rem 0.75rem; 
                font-size: 0.95rem; 
            }
            #forgotPasswordModal .modal-logo { margin-bottom: 1rem; }
            #forgotPasswordModal .modal-logo-text { 
                font-size: 2.5rem; 
                font-weight: 300; 
                font-family: 'Poppins', sans-serif; 
                background: linear-gradient(135deg, var(--oxygen-deepest) 0%, var(--oxygen-vivid) 25%, var(--accent-red-dark) 100%);
                -webkit-background-clip: text; 
                -webkit-text-fill-color: transparent; 
                background-clip: text;  
            }
            #forgotPasswordModal .modal-title { 
                font-size: 1.15rem; 
                margin-bottom: 0.35rem; 
            }
            #forgotPasswordModal .modal-subtitle { 
                margin-bottom: 1rem; 
                font-size: 0.95rem; 
            }
            /* Status message styles */
            .status-message {
                padding: 0.75rem 1rem;
                border-radius: 8px;
                font-size: 0.9rem;
                animation: fadeIn 0.3s ease;
            }
            .status-message.success {
                background: var(--success-bg, rgba(0, 200, 83, 0.1));
                color: var(--success-text, rgb(0, 150, 62));
            }
            .status-message.error {
                background: var(--error-bg, rgba(255, 59, 48, 0.1));
                color: var(--error-text, rgb(255, 59, 48));
            }
            @keyframes fadeIn {
                from { opacity: 0; transform: translateY(-10px); }
                to { opacity: 1; transform: translateY(0); }
            }

            /* Toast notifications */
            .toast-container {
                position: fixed;
                right: 1rem;
                top: 1rem;
                z-index: 9999;
                display: flex;
                flex-direction: column;
                gap: 0.5rem;
                pointer-events: none;
            }
            .toast {
                pointer-events: auto;
                min-width: 220px;
                max-width: 360px;
                padding: 0.6rem 0.9rem;
                border-radius: 8px;
                box-shadow: 0 6px 18px rgba(0,0,0,0.12);
                background: #fff;
                color: #222;
                font-size: 0.95rem;
                animation: slideIn 0.25s ease;
            }
            .toast.success { border-left: 4px solid #0a8a00; }
            .toast.error { border-left: 4px solid #b00020; }

            /* Dark mode toast styling */
            [data-theme="dark"] .toast {
                background: #2a2a2a;
                color: #e0e0e0;
                box-shadow: 0 6px 18px rgba(0,0,0,0.4);
            }
            [data-theme="dark"] .toast.success { border-left: 4px solid #10c010; }
            [data-theme="dark"] .toast.error { border-left: 4px solid #ff4444; }

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

            /* Header user avatar */
            .user-avatar {
                display: inline-flex;
                align-items: center;
                justify-content: center;
                width: 24px;
                height: 24px;
                border-radius: 50%;
                /* default header gradient (fallback) */
                background: linear-gradient(135deg, var(--oxygen-vivid), var(--oxygen-deep));
                color: #fff;
                font-weight: 600;
                cursor: pointer;
                border: 2px solid rgba(255,255,255,0.06);
                position: relative;
                overflow: hidden; /* Ensure image fits within circle */
                padding: 0; /* Remove any button padding */
                align-self: flex-end; /* Align bottom edge with theme toggle */
            }
            
            /* Profile picture styling */
            .user-avatar img {
                width: 100%;
                height: 100%;
                border-radius: 50%;
                object-fit: cover;
                border: 2px solid var(--border-color);
                box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
                display: block; /* Ensure image is displayed as block */
            }
            
            /* Dark mode - keeps same border style as theme toggle */
            [data-theme="dark"] .user-avatar img {
                border: 2px solid var(--border-color);
                box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
            }
            
            /* Tooltip for full name on hover */
            .user-avatar[data-fullname]:hover::after {
                content: attr(data-fullname);
                position: absolute;
                bottom: -35px;
                left: 50%;
                transform: translateX(-50%);
                background: var(--bg-card);
                color: var(--text-primary);
                padding: 6px 12px;
                border-radius: 8px;
                font-size: 0.875rem;
                font-weight: 500;
                white-space: nowrap;
                box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
                border: 1px solid var(--border-light);
                z-index: 1001;
                pointer-events: none;
            }
            
            /* When header avatar also has the shared .avatar class, enforce
               exact parity with the voice avatars (size, border, shadow, font) */
            .user-avatar.avatar {
                width: 30px;
                height: 30px;
                min-width: 30px;
                border-radius: 50%;
                border: 1px solid var(--border-light);
                box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
                color: white;
                font-weight: 600;
                font-size: 0.9rem;
                letter-spacing: 0.02em;
                text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
            }
            
            .user-avatar.avatar img {
                border: 2px solid var(--oxygen-intense);
                box-shadow: 0 2px 8px rgba(33, 150, 243, 0.4);
            }
            
            .user-avatar.small { width:28px; height:28px; font-size:0.9rem }
            .user-dropdown {
                position: absolute;
                right: 0;
                top: 44px;
                background: linear-gradient(180deg, rgba(255,255,255,0.02), var(--bg-card));
                border: 1px solid rgba(255,255,255,0.04);
                border-radius: 12px;
                padding: 6px;
                box-shadow: 0 10px 30px rgba(0,0,0,0.16);
                min-width: 180px;
                z-index: 1000;
                display: flex;
                flex-direction: column;
                gap: 6px;
            }

            /* Compact sign-out button that sits to the right of the header avatar */
            .signout-btn {
                display: inline-flex;
                align-items: center;
                justify-content: center;
                width: 36px;
                height: 36px;
                border-radius: 50%;
                border: none;
                background: transparent;
                color: var(--text-secondary);
                cursor: pointer;
                transition: background 0.12s ease, color 0.12s ease;
                font-size: 0.95rem;
            }

            .signout-btn:hover {
                background: linear-gradient(90deg, rgba(33,150,243,0.04), rgba(239,83,80,0.02));
                color: var(--text-primary);
            }

            /* When we want the dropdown to appear to the right of the avatar (desktop)
               place it horizontally adjacent and vertically centered to the avatar. */
            .user-dropdown.right-of-avatar {
                left: calc(100% + 8px);
                right: auto;
                top: 50%;
                transform: translateY(-50%);
                min-width: 160px;
            }

            /* On small screens, revert to the below-avatar placement for better fit */
            @media (max-width: 767px) {
                .user-dropdown.right-of-avatar {
                    left: auto;
                    right: 0;
                    top: 44px;
                    transform: none;
                }
            }

            .user-dropdown .user-name {
                padding: 8px 12px;
                font-weight: 600;
                border-radius: 8px;
                background: transparent;
                color: var(--text-primary);
            }
            .user-dropdown button {
                background: transparent;
                border: none;
                text-align: left;
                padding: 8px 12px;
                border-radius: 8px;
                cursor: pointer;
                transition: background 0.12s ease;
                color: var(--text-primary);
            }
            .user-dropdown button:hover { background: rgba(255,255,255,0.02); }

            @media (max-width: 480px) {
                #forgotPasswordModal .modal-content { 
                    max-height: 84vh; 
                    padding: 1rem; 
                }
                #forgotPasswordModal .modal-logo-text { 
                    font-size: 2.5rem; 
                    font-weight: 300; 
                    font-family: 'Poppins', sans-serif; 
                    background: linear-gradient(135deg, var(--oxygen-deepest) 0%, var(--oxygen-vivid) 25%, var(--accent-red-dark) 100%);
                    -webkit-background-clip: text; 
                    -webkit-text-fill-color: transparent; 
                    background-clip: text;
                 }
                #forgotPasswordModal .modal-title { font-size: 1.05rem; }
                #forgotPasswordModal .modal-subtitle { font-size: 0.9rem; }
                #forgotPasswordModal .input-field { 
                    padding: 0.6rem 0.8rem 0.6rem 3rem; 
                }
                #forgotPasswordModal .sso-btn { padding: 0.6rem 0.6rem; }
            }
        }

        /* Reset Password Page styles */
        #resetPage {
            min-height: 100vh;
            display: flex;
            /* Align to top so the reset card is immediately visible and easy to access */
            align-items: flex-start;
            justify-content: center;
            padding: 4.5rem 2rem 2rem; /* Slightly larger top padding so card sits lower below header */
            position: relative;
            box-sizing: border-box;
        }
        
        #resetPage .glass-card {
            width: 100%;
            max-width: 500px;
            margin: 0 auto; /* Extra insurance for horizontal centering */
        }
        
        /* Ensure the card doesn't get too close to edges on small screens */
        @media (max-width: 640px) {
            #resetPage {
                padding: 6rem 1rem 2rem;
            }
        }
        
        /* On very short screens, allow scrolling and adjust alignment */
        @media (max-height: 700px) {
            #resetPage {
                /* Keep top-aligned on short screens */
                align-items: flex-start;
                justify-content: flex-start;
                padding-top: 3.5rem;
            }

            #resetPage .glass-card {
                margin-top: 0;
            }
        }
        
        #resetPage .back-to-login { 
            margin-top: 1.5rem; 
            font-size: 0.9rem;
            text-align: center; 
        }

        #resetPage .back-to-login a {
            color: var(--oxygen-deep);
            text-decoration: underline;
            font-weight: 600;
            transition: color 0.2s ease;
        }

        #resetPage .back-to-login a:hover,
        #resetPage .back-to-login a:focus {
            color: var(--oxygen-intense);
        }

        [data-theme="dark"] #resetPage .back-to-login a {
            color: rgba(187, 222, 251, 0.97);
        }

        [data-theme="dark"] #resetPage .back-to-login a:hover,
        [data-theme="dark"] #resetPage .back-to-login a:focus {
            color: #ffffff;
        }

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

        .modal-close {
            position: absolute;
            top: 1.5rem;
            right: 1.5rem;
            background: transparent;
            border: none;
            font-size: 1.5rem;
            color: var(--text-secondary);
            cursor: pointer;
            transition: color 0.3s;
            width: 32px;
            height: 32px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .modal-close:hover {
            color: var(--text-primary);
        }

        .modal-logo {
            text-align: center;
            margin-bottom: 2rem;
        }

        .modal-logo-text {
            font-size: 2.5rem;
            font-weight: 300;
            font-family: 'Poppins', sans-serif;
            background: linear-gradient(135deg, var(--oxygen-deepest) 0%, var(--oxygen-vivid) 25%, var(--accent-red-dark) 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .modal-title {
            font-family: 'Poppins', sans-serif;
            font-size: 1.5rem;
            font-weight: 400;
            margin-bottom: 0.5rem;
            text-align: center;
        }

        .modal-subtitle {
            text-align: center;
            color: var(--text-secondary);
            margin-bottom: 2rem;
            font-size: 0.95rem;
        }

        .sso-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.75rem;
            width: 100%;
            padding: 1rem;
            background: var(--bg-card);
            border: 2px solid var(--border-light);
            border-radius: 12px;
            color: var(--text-primary);
            font-weight: 500;
            cursor: pointer;
            transition: all 0.3s;
            margin-bottom: 1rem;
        }

        .sso-btn:hover {
            border-color: var(--oxygen-vivid);
            transform: translateY(-2px);
            box-shadow: 0 6px 20px var(--shadow-color);
        }

        .sso-btn.google i {
            color: #4285F4;
            font-size: 1.25rem;
        }

        .divider {
            display: flex;
            align-items: center;
            margin: 1.5rem 0;
            color: var(--text-secondary);
            font-size: 0.875rem;
        }

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

        .divider span {
            padding: 0 1rem;
        }

        .input-group {
            margin-bottom: 1.25rem;
        }

        .input-label {
            display: block;
            margin-bottom: 0.5rem;
            font-weight: 500;
            font-size: 0.875rem;
        }

        .input-wrapper {
            position: relative;
        }

        .input-icon {
            position: absolute;
            left: 1rem;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-secondary);
        }

        .input-field {
            width: 100%;
            padding: 1rem 1rem 1rem 3rem;
            background: var(--bg-secondary);
            border: 2px solid var(--border-light);
            border-radius: 12px;
            color: var(--text-primary);
            font-family: 'Inter', sans-serif;
            transition: all 0.3s;
        }

        .input-field:focus {
            outline: none;
            border-color: var(--oxygen-vivid);
            background: var(--bg-card);
        }

        /* Global placeholder styles applied to all .input-field elements for consistency
           Use a tunable variable so designers can tweak placeholder sizes centrally */
        .input-field::placeholder,
        .input-field::-webkit-input-placeholder,
        .input-field:-ms-input-placeholder,
        .input-field::-ms-input-placeholder,
        .input-field::-moz-placeholder {
            font-size: var(--placeholder-agent-size, 0.825rem);
            color: var(--text-secondary);
            opacity: var(--placeholder-opacity, 0.8);
        }

        /* Smooth dropdown background transition and dark-mode defaults
           - apply to select elements using the input-field class and their options
           - many UAs render native dropdowns but these rules improve appearance where supported
        */
        select.input-field {
            transition: background-color 220ms ease, color 220ms ease;
            background: var(--bg-secondary);
            color: var(--text-primary);
        }

        select.input-field:focus {
            background: var(--bg-card);
        }

        select.input-field option {
            transition: background-color 160ms ease, color 160ms ease;
            background: var(--bg-card);
            color: var(--text-primary);
        }

        select.input-field option:focus,
        select.input-field option:hover {
            background: linear-gradient(90deg, rgba(33,150,243,0.06), rgba(239,83,80,0.04));
        }

        /* Dark theme: avoid white flash by defaulting dropdown backgrounds to dark values */
        [data-theme="dark"] select.input-field {
            background: rgba(13,27,42,0.98); /* near-card dark */
            color: var(--text-primary);
        }

        [data-theme="dark"] select.input-field option {
            background: rgba(13,27,42,0.98);
            color: var(--text-primary);
        }

        [data-theme="dark"] select.input-field option:focus,
        [data-theme="dark"] select.input-field option:hover {
            background: linear-gradient(90deg, rgba(66,165,245,0.06), rgba(239,83,80,0.04));
            color: #fff;
        }

        /* Grouping block for Voice Agent form row */
        .agent-block-row { display: flex; gap: 1rem; align-items: stretch; }
        /* Grouping block for Voice Agent form (excluding Create Agent button) */
        .agent-create-block {
            width: 70%;
            margin: 0;
            border: 1px solid var(--border-light);
            border-radius: 12px;
            padding: 1rem;
        }
        /* Control block: center all inner UI horizontally and vertically */
        .agent-control-block {
            width: 30%;
            margin: 0;
            border: 1px solid var(--border-light);
            border-radius: 12px;
            padding: 1rem;
            background: transparent;
            display: flex;                 /* center child (agent-creating) */
            align-items: center;           /* vertical center within block height */
            justify-content: center;       /* horizontal center */
            text-align: center;            /* ensure text inside centers too */
        }
        @media (max-width: 900px) { 
            .agent-block-row { flex-direction: column; }
            .agent-create-block, .agent-control-block { width: 100%; }
        }

    /* Custom select (combobox) styles */
        .custom-select { position: relative; display: inline-block; width: 100%; }
        .select-trigger { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
        /* Ensure the Select a voice trigger matches input padding/shape within Agents section */
        .agents-content .custom-select .select-trigger.input-field {
            padding: 0.45rem 0.65rem; /* match .agents-content .input-field */
            border-radius: 10px;      /* match inputs in agents */
            line-height: 1.45;        /* match inputs in agents */
            width: 100%;
            font-size: 0.95rem;       /* match Agent Name input height exactly */
        }
        /* Reduce dropdown text sizes for better information density */
        .agents-content .select-dropdown .option-item { font-size: 0.8rem; }
        .agents-content .select-dropdown .optgroup-label { font-size: 0.8rem; }
        /* Normalize block flow so its spacing matches text inputs inside wrappers */
        .agents-content .custom-select { display: block; }
        .select-dropdown {
            position: absolute;
            left: 0; right: 0;
            margin-top: 8px;
            background: var(--bg-card);
            border: 1px solid var(--border-light);
            border-radius: 10px;
            box-shadow: 0 12px 40px var(--shadow-color);
            z-index: 1300;
            max-height: 220px;
            overflow: auto;
            padding: 0.5rem;
            transition: opacity 160ms ease, transform 160ms ease;
        }
        .select-dropdown[hidden] { display: none; }
        .select-search { padding: 0.25rem 0.25rem 0.5rem 0; }
        .options-container { display: block; }
        /* group label (language) */
        .optgroup-label { font-weight: 700; padding: 0.35rem 0.5rem; color: var(--text-secondary); }
        /* group container spacing */
        .optgroup { padding: 0.1rem 0; }
        /* option items: slight left indent to visually separate them from the group label */
        .option-item { padding: 0.45rem 0.5rem 0.45rem 1.1rem; border-radius: 8px; cursor: pointer; color: var(--text-primary); }
        .option-item[aria-selected="true"] { background: linear-gradient(135deg, rgba(33,150,243,0.08), rgba(239,83,80,0.06)); }
        .option-item:hover, .option-item:focus { background: linear-gradient(90deg, rgba(33,150,243,0.06), rgba(239,83,80,0.04)); outline: none; }

        /* Dark theme defaults for the custom dropdown */
        [data-theme="dark"] .select-dropdown { background: rgba(13,27,42,0.98); border-color: rgba(100,181,246,0.06); box-shadow: 0 12px 40px rgba(0,0,0,0.6); }
        [data-theme="dark"] .optgroup-label { color: var(--text-secondary); }
        [data-theme="dark"] .option-item { color: var(--text-primary); }

        .checkbox-group {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 1.5rem;
            font-size: 0.875rem;
        }

        .checkbox-label {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            color: var(--text-secondary);
        }

        .checkbox-group a {
            color: var(--oxygen-deep);
            text-decoration: underline;
            font-weight: 600;
        }

        .checkbox-group a:hover,
        .checkbox-group a:focus {
            color: var(--oxygen-intense);
        }

        [data-theme="dark"] .checkbox-group a {
            color: rgba(144, 202, 249, 0.95);
        }

        [data-theme="dark"] .checkbox-group a:hover,
        [data-theme="dark"] .checkbox-group a:focus {
            color: rgba(187, 222, 251, 1);
        }

        .forgot-link {
            color: var(--oxygen-deep);
            text-decoration: none;
            font-weight: 500;
        }

        .signup-link {
            text-align: center;
            margin-top: 1.5rem;
            font-size: 0.95rem;
            color: var(--text-secondary);
        }

        .signup-link a {
            color: var(--oxygen-deep);
            text-decoration: none;
            font-weight: 600;
        }

        @media (max-width: 640px) {
            .modal-content {
                padding: 2rem 1.5rem;
            }
        }
        
        .btn-link {
            padding: 0.75rem 1.5rem;
            background: transparent;
            border: none;
            color: var(--text-secondary);
            font-weight: 500;
            cursor: pointer;
            transition: color 0.3s;
        }

        .btn-link:hover {
            color: var(--oxygen-deep);
        }
        
        /* Demo mode toggle (TTS vs Voice Agents) - match currency toggle visuals for parity */
        .mode-toggle {
            display: inline-flex;
            gap: 0.5rem;
            justify-content: center;
            /* Reduced spacing so demo controls sit closer to the demo card */
            margin-bottom: 0.6rem;
        }
        /* Copy base styles from .currency-btn for pixel parity */
        .mode-toggle .mode-btn {
            padding: 0.5rem 1.2rem;
            border-radius: 999px;
            border: none;
            background: var(--bg-card);
            color: var(--text-primary);
            cursor: pointer;
            font-weight: 600;
            transition: all 0.25s ease;
            box-shadow: inset 0 0 0 1.5px var(--border-color);
            background-origin: border-box;
            overflow: hidden;
        }

        .mode-toggle .mode-btn:hover {
            box-shadow: inset 0 0 0 1.5px var(--oxygen-deep);
        }

        .mode-toggle .mode-btn.active {
            background: linear-gradient(135deg, var(--oxygen-deep), var(--accent-red));
            color: #ffffff;
            box-shadow: 0 6px 16px rgba(33, 150, 243, 0.25);
        }

        /* Accessibility: subtle focus-visible outline for keyboard users */
        .mode-toggle .mode-btn:focus-visible {
            outline: 3px solid rgba(100, 181, 246, 0.36);
            outline-offset: 3px;
            border-radius: 999px;
        }

        /* Dark theme: copy currency toggle dark values for consistent contrast */
        [data-theme="dark"] .mode-toggle .mode-btn {
            color: rgba(255, 255, 255, 0.9);
            box-shadow: inset 0 0 0 1.5px rgba(144, 202, 249, 0.35);
        }

        [data-theme="dark"] .mode-toggle .mode-btn:hover {
            box-shadow: inset 0 0 0 1.5px rgba(144, 202, 249, 0.7);
        }

        [data-theme="dark"] .mode-toggle .mode-btn.active {
            box-shadow: 0 6px 16px rgba(21, 101, 192, 0.45);
            color: #ffffff;
        }

        [data-theme="dark"] .mode-toggle .mode-btn:focus-visible {
            outline: 3px solid rgba(100, 181, 246, 0.62);
            outline-offset: 3px;
        }

        /* Voice Agents form and accordion */
    /* Agents content should match demo-section spacing for parity */
    .agents-content { 
        display: none; 
        margin: 1rem 0; 
    }
    .agents-content.active { display: block; }
    
    /* Match the agents card styling to TTS content for visual consistency */
    .agents-content .agent-card {
        padding: 2rem; /* match TTS padding */
        min-height: 580px; /* set minimum height to match TTS section */
    }

        /* Ensure Agent form inputs match compact TTS demo spacing/padding */
        .agents-content .input-field {
            padding: 0.5rem 0.75rem;
            border-radius: 10px;
            font-size: 0.95rem;
            line-height: 1.5;
            margin-bottom: 0.25rem;
        }

        /* Agent-specific placeholder tweaks inherit from global rules but use central opacity */
        .agents-content .input-field::placeholder,
        .agents-content .input-field::-webkit-input-placeholder,
        .agents-content .input-field:-ms-input-placeholder,
        .agents-content .input-field::-ms-input-placeholder,
        .agents-content .input-field::-moz-placeholder {
            /* Use tunable variable to match TTS demo label size exactly */
            font-size: var(--placeholder-agent-size, 0.9rem);
            color: var(--text-secondary);
            opacity: var(--placeholder-opacity, 0.8);
        }

        .agent-card { position: relative; }

        .agent-form .input-row { display:flex; gap:1rem; margin-bottom:1.25rem; }
        .agent-form .input-row .input-wrapper { flex:1; }
        
        /* Add spacing for labels */
        .agent-form .input-label {
            margin-bottom: 0.5rem;
        }
        
        /* Add spacing for agent block row */
        .agent-block-row {
            margin-bottom: 1.5rem;
        }
        
        /* Match Create Agent button height to Generate Audio button */
        .agents-content .btn-primary {
            padding: 1rem 2rem;
            font-size: 0.95rem;
        }

        .agent-accordion {
            margin-top: 1rem;
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.45s cubic-bezier(.2,.9,.2,1), transform 0.35s ease;
            transform-origin: bottom center;
        }

        .agent-accordion.open { max-height: 420px; }

        .agent-creating {
            display: flex; /* visible by default so pulse, Start button, and timer are shown */
            align-items: center;
            justify-content: center;
            flex-direction: column;
            gap: 1rem;
            padding: 2rem;
        }

        .agent-creating.active { display:flex; }

        .pulse-circle {
            width: 96px;
            height: 96px;
            border-radius: 50%;
            background: radial-gradient(circle at 30% 30%, rgba(66,165,245,0.95), rgba(239,83,80,0.9));
            box-shadow: 
                0 0 20px 5px rgba(66,165,245,0.4),
                0 0 40px 10px rgba(239,83,80,0.3),
                0 0 60px 15px rgba(66,165,245,0.2);
            animation: pulse 1.8s infinite ease-in-out;
        }

        /* small status dot used beside agent status (red = offline, green = online) */
        .status-dot {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            display: inline-block;
            box-shadow: 0 0 0 4px rgba(0,0,0,0.04);
            transition: background-color 180ms ease, box-shadow 180ms ease;
        }
        .status-dot.offline { background: #f44336; box-shadow: 0 0 0 6px rgba(244,67,54,0.06); }
        .status-dot.online { background: #4caf50; box-shadow: 0 0 0 6px rgba(76,175,80,0.06); }

        /* Fixed-width font for agent timer to prevent layout shift */
        #agentTimer {
            /* Use a specific monospace font for consistent cross-platform look */
            font-family: 'Roboto Mono', monospace;
            font-variant-numeric: tabular-nums;
            font-weight: 600;
            font-size: 0.95rem;
            letter-spacing: 0.02em;
        }

        /* Reduce font size for agent status line (e.g., "Creating agent and initializing conversation…") */
        #agentStatus { font-size: 0.9rem; }

        @keyframes pulse {
                0% {
                    transform: scale(0.95);
                    box-shadow:
                        0 0 8px 2px rgba(66,165,245,0.35),
                        0 0 14px 4px rgba(239,83,80,0.25),
                        0 0 28px 6px rgba(66,165,245,0.15);
                }
                50% {
                    transform: scale(1.03);
                    box-shadow:
                        0 0 12px 3px rgba(66,165,245,0.5),
                        0 0 24px 6px rgba(239,83,80,0.32),
                        0 0 40px 9px rgba(66,165,245,0.22);
                }
                100% {
                    transform: scale(0.98);
                    box-shadow:
                        0 0 8px 2px rgba(66,165,245,0.35),
                        0 0 14px 4px rgba(239,83,80,0.25),
                        0 0 28px 6px rgba(66,165,245,0.15);
                }
        }

        /* Slight dim/out-of-focus state for accordion when agent is created */
        .agent-accordion.out-of-focus { opacity: 0.35; filter: blur(0.6px); transform: scale(0.995); }

        /* Spinner Animation for Loading States */
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .spinner {
            display: inline-block;
            width: 1em;
            height: 1em;
            border: 2px solid rgba(255, 255, 255, 0.3);
            border-top: 2px solid #fff;
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
            margin-right: 0.5rem;
        }

        /* Button loading state */
        .btn-loading {
            position: relative;
            pointer-events: none;
            opacity: 0.85;
        }

        .btn-loading .spinner {
            vertical-align: middle;
        }

        /* Waveform container - prevent horizontal scrollbar */
        #waveformContainer {
            overflow-x: hidden !important;
            max-width: 100%;
        }

        #waveformContent {
            overflow-x: hidden !important;
            max-width: 100%;
        }

        #waveform {
            overflow-x: hidden !important;
            max-width: 95%;
            margin: 0 auto;
            background: transparent;
        }

        /* Ensure WaveSurfer wrapper doesn't overflow */
        #waveform > div {
            max-width: 100% !important;
        }

        /* Constrain canvas if it gets too wide */
        #waveform canvas {
            max-width: 100% !important;
        }

        /* Smooth animation for waveform */
        #waveform wave {
            transition: all 0.1s ease-out;
        }

