/* Remove iOS/Android blue tap flash on interactive controls */
:where(a, button, summary, input, select, textarea, [role="button"], .badge) {
    -webkit-tap-highlight-color: transparent;
}

/* Keyboard focus system */
:where(a, button, summary, input, select, textarea, [role="button"], .badge):focus-visible {
    outline: 2px solid var(--liquid-glass-focus-ring);
    outline-offset: 2px;
}

/* Backdrop fallback for browsers/devices without backdrop-filter support */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    :root {
        --liquid-glass-surface: rgba(19, 27, 38, 0.56);
        --liquid-glass-surface-soft: rgba(19, 27, 38, 0.5);
        --liquid-glass-surface-deep: rgba(13, 19, 28, 0.68);
        --surface-popup-bg: rgba(19, 27, 38, 0.62);
        --surface-popup-item-bg: rgba(148, 163, 184, 0.22);
        --surface-popup-item-bg-hover: rgba(59, 130, 246, 0.22);
    }

    body.theme-light {
        --liquid-glass-surface: rgba(255, 255, 255, 0.78);
        --liquid-glass-surface-soft: rgba(255, 255, 255, 0.72);
        --liquid-glass-surface-deep: rgba(248, 250, 252, 0.86);
        --surface-popup-bg: rgba(255, 255, 255, 0.84);
        --surface-popup-item-bg: rgba(226, 232, 240, 0.66);
        --surface-popup-item-bg-hover: rgba(191, 219, 254, 0.62);
    }
}

/* Mobile performance tuning: reduce saturation work on lower-power devices */
@media (max-width: 1024px) {
    :root {
        --liquid-glass-saturation: 132%;
    }
}

@media (max-width: 640px) {
    :root {
        --liquid-glass-saturation: 124%;
    }
}
