    .va-hidden { display: none !important; }

    /* Mic button (lives in the header next to the theme toggle) */
    #va-mic-btn { position: relative; }
    #va-mic-btn.va-on { color: #c4b5fd; border-color: rgba(139,92,246,.7); animation: vaPulse 2.2s infinite; }
    #va-mic-btn.va-awake { color: #e9d5ff; border-color: rgba(192,132,252,.9); animation-duration: 1s; }
    #va-mic-btn.va-fab { position: fixed; right: 16px; bottom: 90px; z-index: 99990; width: 48px; height: 48px; border-radius: 999px; }
    @keyframes vaPulse {
        0%   { box-shadow: 0 0 0 0 rgba(168,85,247,.5); }
        70%  { box-shadow: 0 0 0 10px rgba(168,85,247,0); }
        100% { box-shadow: 0 0 0 0 rgba(168,85,247,0); }
    }

    /* ---------- Full-screen centered overlay ---------- */
    /* Palette: everything stays in the purple family so it matches the logo.
       Deep violet base, violet / orchid glow, lilac text. Cancel / Edit keep red / amber so they still read as actions. */
    #va-overlay {
        /* glow colours as r,g,b — they shift slightly with the mode (see the data-mode rules below) */
        --va-a: 168,85,247;
        --va-b: 192,132,252;
        --va-ink: 245,243,255;               /* text colour */
        --va-wave: .5;                       /* how visible the waves are (kept low on purpose) */
        position: fixed; inset: 0; z-index: 100000; overflow: hidden;
        display: flex; align-items: center; justify-content: center;
        padding: max(16px, env(safe-area-inset-top)) 20px max(16px, env(safe-area-inset-bottom));
        color: rgb(var(--va-ink));
        /* No backdrop blur on purpose: a full-screen blur over a page that is still animating underneath is what made
           phones stutter. This gradient is almost opaque, so it looks just as deep and costs far less to draw. */
        background:
            radial-gradient(circle at 50% 24%, rgba(var(--va-a), .32), transparent 56%),
            radial-gradient(circle at 50% 88%, rgba(var(--va-b), .16), transparent 62%),
            radial-gradient(circle at 50% 42%, rgba(59,20,120,.55), rgba(9,3,22,.95) 76%);
        opacity: 0; visibility: hidden; pointer-events: none;
        transition: opacity .25s ease, visibility 0s linear .25s;
    }
    #va-overlay.va-show { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity .25s ease; }
    #va-overlay[data-mode="awake"]     { --va-a: 168,85,247;  --va-b: 232,121,249; --va-wave: .55; }
    #va-overlay[data-mode="countdown"] { --va-a: 192,132,252; --va-b: 129,140,248; --va-wave: .38; }
    #va-overlay[data-mode="reply"]     { --va-a: 139,92,246;  --va-b: 196,181,253; --va-wave: .45; }
    .light-theme #va-overlay {
        --va-ink: 46,16,101;
        background:
            radial-gradient(circle at 50% 24%, rgba(var(--va-a), .22), transparent 56%),
            radial-gradient(circle at 50% 42%, rgba(221,214,254,.78), rgba(250,245,255,.97) 76%);
    }

    /* ---------- "Liquid glass" card ----------
       A frosted-glass panel: real backdrop blur so it actually looks like glass, plus soft colour
       pools baked straight into the card's own background gradient for the "liquid" feel — no extra
       blurred layers stacked on top of each other, which is what rendered as a solid blocked-out mess
       on some phones/browsers before. This version is one flat, predictable paint. */
    #va-card {
        width: min(560px, 100%); max-height: 100%; position: relative;
        display: flex; flex-direction: column; align-items: center; text-align: center; gap: 16px;
        padding: 32px 26px 28px;
        border-radius: 30px;
        background:
            radial-gradient(circle at 18% 10%, rgba(var(--va-a), .38), transparent 46%),
            radial-gradient(circle at 86% 90%, rgba(var(--va-b), .3), transparent 50%),
            linear-gradient(165deg, rgba(76,29,149,.5), rgba(20,7,46,.74) 65%, rgba(46,16,101,.6));
        -webkit-backdrop-filter: blur(20px) saturate(150%);
        backdrop-filter: blur(20px) saturate(150%);
        border: 1px solid rgba(255,255,255,.18);
        box-shadow:
            0 30px 70px -14px rgba(4,1,14,.65),
            0 1px 0 rgba(255,255,255,.14) inset,
            0 0 0 1px rgba(255,255,255,.05) inset,
            0 0 100px -24px rgba(var(--va-a), .5);
        transform: scale(.94); transition: transform .25s ease, border-color .5s ease, box-shadow .5s ease, background .6s ease;
    }
    .light-theme #va-card {
        background:
            radial-gradient(circle at 18% 10%, rgba(var(--va-a), .2), transparent 46%),
            radial-gradient(circle at 86% 90%, rgba(var(--va-b), .16), transparent 50%),
            linear-gradient(165deg, rgba(255,255,255,.88), rgba(250,245,255,.95) 65%, rgba(237,233,254,.9));
        border-color: rgba(255,255,255,.75);
        box-shadow: 0 30px 70px -16px rgba(76,29,149,.22), 0 1px 0 rgba(255,255,255,.7) inset, 0 0 100px -28px rgba(139,92,246,.35);
    }
    #va-overlay.va-show #va-card { transform: scale(1); }

    /* Thin inner highlight instead of an animated masked ring — same "catching the light" idea,
       implemented as a plain inset shadow so it always renders correctly everywhere. */
    #va-card::after {
        content: ''; position: absolute; inset: 0; border-radius: inherit; z-index: 0; pointer-events: none;
        box-shadow: inset 0 0 0 1px rgba(255,255,255,.14), inset 0 46px 70px -46px rgba(255,255,255,.3);
    }

    /* Everything in the card sits above that highlight layer */
    #va-card > * { position: relative; z-index: 1; }

    /* ---------- Logo + simple circular waves (soft violet, brighter orchid while speaking) ---------- */
    #va-stage {
        --s: min(300px, 38vh);               /* size of the whole animated area */
        --L: calc(var(--s) * .36);           /* logo size */
        --va-wr: 167,139,250;                /* wave colour: soft violet by default */
        position: relative; flex: none; width: var(--s); height: var(--s);
        display: flex; align-items: center; justify-content: center;
        margin: calc(var(--s) * -.05) 0;
    }
    #va-overlay.va-speaking #va-stage { --va-wr: 216,180,254; }   /* brighter orchid while it is talking */
    .light-theme #va-stage { --va-wr: 139,92,246; }
    .light-theme #va-overlay.va-speaking #va-stage { --va-wr: 124,58,237; }

    /* Soft ambient glow breathing behind everything — brings some life back
       to the stage on phones, where a couple of thin rings alone looked flat. */
    #va-stage::before {
        content: ''; position: absolute; left: 50%; top: 50%; border-radius: 50%; pointer-events: none;
        width: calc(var(--L) * 2.3); height: calc(var(--L) * 2.3); margin: calc(var(--L) * -1.15) 0 0 calc(var(--L) * -1.15);
        background: radial-gradient(circle, rgba(var(--va-wr), .32) 0%, rgba(var(--va-wr), .10) 50%, rgba(var(--va-wr), 0) 72%);
        animation: vaBreathe 2.6s ease-in-out infinite;
    }
    @keyframes vaBreathe { 0%, 100% { transform: scale(.9); opacity: .75; } 50% { transform: scale(1.1); opacity: 1; } }

    /* Waves that ring the logo and drift outward, fading as they go */
    .va-wave-out {
        --va-reach: 2.6;
        position: absolute; left: 50%; top: 50%; width: var(--L); height: var(--L);
        margin: calc(var(--L) / -2) 0 0 calc(var(--L) / -2);
        border-radius: 50%; pointer-events: none; opacity: 0;
        border: 2.5px solid rgba(var(--va-wr), .6);
        animation: vaWaveOut 2.8s cubic-bezier(.16,.6,.3,1) infinite;
        will-change: transform, opacity; transition: border-color .5s ease;
    }
    .va-wave-out:nth-of-type(2) { animation-delay: .93s; }
    .va-wave-out:nth-of-type(3) { animation-delay: 1.86s; }
    @keyframes vaWaveOut {
        0%   { transform: scale(1); opacity: 0; }
        18%  { opacity: .7; }
        100% { transform: scale(var(--va-reach)); opacity: 0; }
    }

    /* Waves that draw inward from further out, toward the logo */
    .va-wave-in {
        position: absolute; left: 50%; top: 50%; width: var(--L); height: var(--L);
        margin: calc(var(--L) / -2) 0 0 calc(var(--L) / -2);
        border-radius: 50%; pointer-events: none; opacity: 0;
        border: 2.5px solid rgba(var(--va-wr), .6);
        animation: vaWaveIn 2.8s cubic-bezier(.4,0,.5,1) infinite;
        will-change: transform, opacity; transition: border-color .5s ease;
    }
    .va-wave-in:nth-of-type(2) { animation-delay: 1.4s; }
    @keyframes vaWaveIn {
        0%   { transform: scale(2.6); opacity: 0; }
        45%  { opacity: .7; }
        100% { transform: scale(1); opacity: 0; }
    }
    #va-overlay[data-mode="countdown"] .va-wave-out,
    #va-overlay[data-mode="countdown"] .va-wave-in { animation-duration: 3.6s; }

    /* One-shot "click" burst — fires the instant the wake word lands, or a
       command gets confirmed, so it actually feels tapped/heard rather than
       just fading in like the ambient waves do. */
    .va-click-ring {
        position: absolute; left: 50%; top: 50%; width: var(--L); height: var(--L);
        margin: calc(var(--L) / -2) 0 0 calc(var(--L) / -2);
        border-radius: 50%; pointer-events: none; opacity: 0;
        border: 3px solid rgba(var(--va-wr), .95);
    }
    .va-click-ring.va-fire { animation: vaClick .55s cubic-bezier(.2,.8,.2,1); }
    @keyframes vaClick { 0% { transform: scale(.75); opacity: .95; } 100% { transform: scale(2.3); opacity: 0; } }

    /* The logo itself */
    #va-logo-wrap { position: relative; z-index: 2; width: var(--L); height: var(--L); flex: none; animation: vaLogo 2.4s ease-in-out infinite; }
    #va-logo-wrap.va-fire { animation: vaLogoClick .4s ease-out; }
    @keyframes vaLogo { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
    @keyframes vaLogoClick { 0% { transform: scale(1); } 35% { transform: scale(1.18); } 100% { transform: scale(1); } }
    #va-logo {
        display: block; width: 100%; height: 100%; object-fit: contain; padding: 17%; box-sizing: border-box; border-radius: 50%;
        background: radial-gradient(circle at 30% 22%, rgba(255,255,255,.18), rgba(30,10,64,.88) 68%);
        border: 1px solid rgba(216,180,254,.32);
        box-shadow: 0 8px 34px rgba(var(--va-wr), .5), inset 0 0 22px rgba(var(--va-wr), .3);
        transition: box-shadow .5s ease;
    }
    .light-theme #va-logo { background: radial-gradient(circle at 30% 22%, rgba(255,255,255,.95), rgba(237,233,254,.92) 70%); border-color: rgba(139,92,246,.4); }

    @media (prefers-reduced-motion: reduce) {
        .va-wave-out, .va-wave-in, .va-click-ring.va-fire, #va-logo-wrap, #va-logo-wrap.va-fire, #va-stage::before { animation: none !important; }
    }

    /* ---------- Texts ---------- */
    #va-status {
        display: inline-flex; align-items: center; gap: 9px; max-width: 100%;
        padding: 7px 16px; border-radius: 999px;
        font-size: 11px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: rgb(var(--va-ink));
        background: rgba(var(--va-a), .2); border: 1px solid rgba(255,255,255,.28);
        -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
        box-shadow: 0 4px 18px -6px rgba(var(--va-a), .55);
        transition: background-color .5s ease, border-color .5s ease, box-shadow .5s ease;
    }
    #va-status::before {
        content: ''; flex: none; width: 7px; height: 7px; border-radius: 50%;
        background: rgb(var(--va-a)); box-shadow: 0 0 10px rgb(var(--va-a)); animation: vaBlink 1.2s ease-in-out infinite;
    }
        #va-was { margin-top: -4px; font-size: 12px; opacity: .6; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    #va-heard {
        min-height: 2.6em; width: 100%; padding: 0 6px;
        font-size: clamp(20px, 5vw, 30px); font-weight: 700; line-height: 1.3; word-break: break-word;
        text-shadow: 0 2px 18px rgba(var(--va-a), .35);
    }
    #va-heard:empty::before { content: '…'; opacity: .45; }
    #va-heard.va-interim { opacity: .7; }
    #va-heard.va-interim::after { content: '▍'; margin-left: 2px; animation: vaBlink 1s infinite; }
    @keyframes vaBlink { 50% { opacity: .15; } }

    /* Countdown */
    #va-count { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
    #va-count .va-ring { position: relative; width: 124px; height: 124px; }
    #va-count .va-ring svg { width: 100%; height: 100%; }
    #va-count .va-ring-bg { fill: none; stroke: rgba(196,181,253,.2); stroke-width: 5; }
    #va-ring-fg { fill: none; stroke: rgb(var(--va-a)); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 276.46; stroke-dashoffset: 0; transform: rotate(-90deg); transform-origin: 50% 50%; }
    #va-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 46px; font-weight: 900; font-family: 'JetBrains Mono', monospace; }
    #va-action { font-weight: 800; font-size: 18px; }
    #va-detail { font-size: 13px; opacity: .75; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    #va-count small { opacity: .65; font-size: 11px; }
    #va-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 4px; }

    /* Text reply (help / progress) */
    #va-reply { width: 100%; max-height: 34vh; overflow-y: auto; font-size: 15px; line-height: 1.55; padding: 12px 16px; border-radius: 16px; background: rgba(30,10,64,.55); border: 1px solid rgba(var(--va-a), .3); text-align: left; }
    .light-theme #va-reply { background: rgba(255,255,255,.8); border-color: #ddd6fe; }

    #va-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 4px; }
    #va-overlay button { cursor: pointer; border-radius: 12px; border: 1px solid rgba(var(--va-a), .38); background: rgba(var(--va-a), .14); color: inherit; font-weight: 700; font-size: 12px; padding: 8px 14px; min-height: 36px; transition: background-color .2s ease, border-color .2s ease; }
    #va-overlay button:hover { background: rgba(var(--va-a), .3); }
    #va-overlay #va-cancel { border-color: rgba(251,113,133,.55); color: #fda4af; }
    #va-overlay #va-edit { border-color: rgba(251,191,36,.55); color: #fcd34d; }
    .light-theme #va-overlay #va-cancel { color: #be123c; }
    .light-theme #va-overlay #va-edit { color: #b45309; }
    #va-overlay #va-now { border-color: transparent; color: #fff; background: linear-gradient(135deg, #7c3aed, #a855f7); box-shadow: 0 6px 18px -6px rgba(124,58,237,.7); }
    #va-overlay #va-now:hover { background: linear-gradient(135deg, #8b5cf6, #c084fc); }
    #va-overlay #va-off { opacity: .65; font-weight: 600; }

    /* Short screens (phones held sideways, small laptops): shrink so everything still fits */
    @media (max-height: 660px) {
        #va-stage { --s: min(230px, 30vh); }
        #va-card { gap: 8px; }
        #va-count .va-ring { width: 92px; height: 92px; }
        #va-num { font-size: 34px; }
        #va-heard { min-height: 1.6em; font-size: 18px; }
    }

/* ---- language pills: English | عربي (works on the dark and the light card) ---- */
#va-langs { display: inline-flex; gap: 4px; padding: 3px; border-radius: 999px; background: rgba(148,163,184,.18); border: 1px solid rgba(148,163,184,.30); align-self: center; }
#va-langs button { border: 0; background: transparent; color: inherit; font: 700 12px/1 inherit; padding: 7px 14px; border-radius: 999px; cursor: pointer; min-height: 30px; opacity: .75; touch-action: manipulation; }
#va-langs button.on { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; opacity: 1; box-shadow: 0 2px 10px rgba(99,102,241,.45); }
#va-langs button:not(.on):hover { opacity: 1; background: rgba(148,163,184,.22); }
.light-theme #va-langs { background: rgba(99,102,241,.10); border-color: rgba(99,102,241,.28); color: #312e81; }
