/* Self-hosted fonts (offline-capable) — replaces a Google Fonts @import.
   Bricolage Grotesque and Plus Jakarta Sans are variable-weight files;
   one file each covers the whole weight range used across this app. */
@font-face {
    font-family: 'Bricolage Grotesque';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('../fonts/bricolage-grotesque-variable.woff2') format('woff2');
}
@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url('../fonts/plus-jakarta-sans-variable.woff2') format('woff2');
}
@font-face {
    font-family: 'Space Mono';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/space-mono-400.woff2') format('woff2');
}
@font-face {
    font-family: 'Space Mono';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/space-mono-700.woff2') format('woff2');
}

:root {
    color-scheme: dark;
    --bg-dark: #080d16;
    --bg-card: rgba(15, 23, 42, 0.65);
    --bg-input: rgba(30, 41, 59, 0.7);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-warning: #f59e0b;
    --text-warning-strong: #d97706;
    --text-info: #38bdf8;
    --text-danger-soft: #fca5a5;
    --accent-aurora: #00ffaa;
    /* RGB components of --accent-aurora, so translucent glows can be written as
       rgba(var(--accent-aurora-rgb), <alpha>) and still re-theme. Keep in sync with
       --accent-aurora above and its per-theme overrides in themes.css. */
    --accent-aurora-rgb: 0, 255, 170;
    --accent-aurora-violet: #7c5cff;
    /* Secondary accent (inspect/outline mode + device frame-shell toggles). RGB form so
       translucent tints can use rgba(var(--accent-aurora-violet-rgb), <alpha>). */
    --accent-aurora-violet-rgb: 124, 92, 255;
    --accent-gradient: linear-gradient(135deg, #00f5a0 0%, #00d2ff 100%);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(var(--accent-aurora-rgb), 0.4);
    --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    /* Corner-radius scale. The large content surfaces and the floating popups/modals all share
       --radius-xl, so a small popup is never MORE rounded than the big surface it sits over
       (they were 20px vs the device card's 16px before). */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --font-heading: 'Bricolage Grotesque', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --font-mono: 'Space Mono', monospace;
    /* Toast colors */
    --toast-success: rgba(0, 200, 120, 0.15);
    --toast-success-border: rgba(var(--accent-aurora-rgb), 0.35);
    --toast-error: rgba(239, 68, 68, 0.15);
    --toast-error-border: rgba(239, 68, 68, 0.35);
    --toast-info: rgba(56, 189, 248, 0.15);
    --toast-info-border: rgba(56, 189, 248, 0.35);
    --toast-warning: rgba(251, 191, 36, 0.15);
    --toast-warning-border: rgba(251, 191, 36, 0.35);
    /* Grid colors */
    --grid-color: rgba(var(--accent-aurora-rgb), 0.25);
    --grid-bg-color: rgba(var(--accent-aurora-rgb), 0.03);
}

body {
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(at 0% 0%, rgba(var(--accent-aurora-rgb), 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(0, 210, 255, 0.05) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-body);
    margin: 0;
    padding: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Visually hidden but still available to assistive tech (skip link target
   text, URL validation error announcements). */
.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;
}

.skip-link {
    position: fixed;
    top: -100px;
    left: 12px;
    z-index: 99999;
    background: var(--accent-gradient);
    color: #020617;
    padding: 10px 18px;
    border-radius: 8px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.85rem;
    text-decoration: none;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 12px;
}

/* ==========================================
   Reduced Motion
   ========================================== */
/* Covers the general case. A handful of elements set their OWN !important transition
   (equal-or-higher specificity beats this bare universal selector even though both are
   !important) — those get a matching-specificity companion override in css/themes.css,
   the last-loaded stylesheet, so it wins the cascade tie-break. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
    /* Exception: loading spinners keep a slow continuous spin so "loading" is still conveyed —
       the universal freeze above would otherwise leave them motionless and read as stuck. Class
       selectors outrank the bare `*` rule among !important declarations. A small rotating spinner
       is acceptable under reduced-motion (the guideline targets large/parallax motion). */
    .iframe-spinner,
    .inline-spinner,
    .device-refresh-btn.refreshing svg {
        animation-duration: 1.4s !important;
        animation-iteration-count: infinite !important;
    }
}

/* Give the small popup dismiss buttons a real tap target — they carried no explicit size,
   so the hit area was just the ~18px "x" glyph (well under the ~44px touch guideline). They
   are absolutely positioned in a corner, so growing the box only enlarges the clickable area. */
.close-tips-btn,
.close-warning-btn,
.close-qr-btn,
.close-inspector-btn {
    min-width: 30px;
    min-height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    padding: 8px 16px;
    border-radius: 12px;
    box-shadow: var(--shadow-premium);
    position: fixed;
    top: 15px;
    left: 20px;
    right: 20px;
    z-index: 500;
    margin: 0;
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    will-change: transform;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.brand-description {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    border-left: 1px solid var(--border-glass);
    padding-left: 12px;
    height: 24px;
    display: flex;
    align-items: center;
}

.top-bar-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    margin: 0 20px;
}

.top-bar-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

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

.brand-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    cursor: pointer;
    user-select: none;
    text-decoration: none;
}

.creator-credit {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: var(--font-body);
    border-left: 1px solid var(--border-glass);
    padding-left: 12px;
    height: 24px;
}

.creator-logo-link {
    display: flex;
    align-items: center;
    justify-content: center;
}

.creator-logo {
    display: block;
    width: 24px;
    height: 24px;
    opacity: 0.65;
    transition: opacity 0.2s, filter 0.2s, transform 0.2s;
}

.creator-logo-link:hover .creator-logo {
    opacity: 1;
    filter: drop-shadow(0 0 4px rgba(var(--accent-aurora-rgb), 0.5));
    transform: scale(1.1);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-subtitle {
    font-family: var(--font-heading);
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 2.5px;
    color: var(--text-secondary);
    transition: color 0.3s ease, text-shadow 0.3s ease;
    font-style: italic;
}

.controls {
    display: flex;
    align-items: flex-end;
    gap: 16px;
}

.header-icon {
    stroke: var(--accent-aurora);
    fill: none;
    -webkit-text-fill-color: initial;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.3s ease;
}

.brand-container:hover .header-icon {
    transform: scale(1.1) rotate(12deg);
    filter: drop-shadow(0 0 8px var(--accent-aurora));
}

.brand-container:hover .brand-subtitle {
    color: var(--accent-aurora);
    text-shadow: 0 0 8px rgba(var(--accent-aurora-rgb), 0.3);
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.input-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.info-icon {
    display: inline-flex;
    align-items: center;
    color: var(--text-muted);
    cursor: help;
    transition: color 0.2s ease;
}

.info-icon:hover {
    color: var(--accent-aurora);
}

input, select {
    padding: 6px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.8rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}

input:focus, select:focus {
    border-color: var(--accent-aurora);
    box-shadow: 0 0 0 3px var(--border-focus);
}

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

select {
    cursor: pointer;
    min-width: 140px;
}

select option {
    background-color: #0b1329;
    color: var(--text-primary);
}

.preset-controls-wrapper {
    display: flex;
    gap: 6px;
    align-items: center;
}

.preset-controls-wrapper select {
    min-width: 140px;
    flex-grow: 1;
}

.preset-controls-wrapper .icon-btn {
    padding: 0;
    width: 28px;
    height: 28px;
    min-width: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}


button, a {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

button {
    background: var(--accent-gradient);
    color: #020617;
    border: none;
    padding: 6px 12px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 12px rgba(var(--accent-aurora-rgb), 0.2);
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(var(--accent-aurora-rgb), 0.35);
}

button:active {
    transform: translateY(1px);
}

/* Global keyboard focus ring for buttons. Previously no <button> had any :focus-visible
   style, so keyboard users relied on inconsistent browser-default outlines. offset keeps the
   ring clear of the button edge (readable even over the aurora-gradient buttons). */
button:focus-visible {
    outline: 2px solid var(--accent-aurora);
    outline-offset: 2px;
}

/* Inline URL validation error, shown to sighted users too (not just screen readers). Absolutely
   positioned under the field so showing/clearing it never reflows the header row. */
#local-url-group,
#live-url-group {
    position: relative;
}

.field-error {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 3px;
    font-size: 0.6rem;
    line-height: 1.2;
    color: var(--text-danger-soft);
    pointer-events: none;
    z-index: 5;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
    box-shadow: none;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
    border-color: var(--text-secondary);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--text-danger-soft);
    border: 1px solid rgba(239, 68, 68, 0.3);
    box-shadow: none;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.5);
}

/* Dashboard Layout */
.dashboard {
    transform-origin: top center;
    display: flex;
}

.device-section {
    position: relative;
    width: fit-content;
    flex-shrink: 0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    padding: 30px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-premium);
    box-sizing: border-box;
}

.device-header {
    display: flex;
    flex-flow: row wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px 16px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 16px;
    cursor: grab;
    user-select: none;
    touch-action: none;
    border-radius: 8px;
}

.device-header:active {
    cursor: grabbing;
}

/* Card repositioning is also keyboard-operable (arrow keys, wired in
   toolbar-and-help.js) since the drag itself is mouse/touch only. */
.device-header:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--border-focus);
}

.device-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    border-top: 1px solid var(--border-glass);
    margin-top: 20px;
    padding-top: 16px;
}

.device-header h2 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    margin: 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-glass);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.size-badge {
    font-family: var(--font-mono);
    font-size: 0.65em;
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--accent-aurora);
    border: 1px solid var(--border-glass);
    padding: 4px 10px;
    border-radius: 20px;
    margin-left: 12px;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.iframe-container {
    display: flex;
    gap: 30px;
    justify-content: center;
    overflow-x: auto;
    padding: 10px 0;
}

.iframe-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
}

.iframe-wrapper h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-align: center;
    color: var(--text-secondary);
}

/* Device Dimensions & Transitions */
iframe {
    background: #ffffff;
    border: 1px solid var(--border-glass);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1), height 0.4s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s;
}

iframe:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

/* Desktop Frame Dimensions */
.desktop-frame {
    width: 1440px;
    height: 900px;
    border-radius: 12px;
}

.desktop-frame.landscape {
    width: 900px;
    height: 1440px;
}

/* Tablet Frame Dimensions */
.tablet-frame {
    width: 768px;
    height: 1024px;
    border-radius: 12px;
}

.tablet-frame.landscape {
    width: 1024px;
    height: 768px;
}

/* Mobile Frame Dimensions — kept in sync with the JS default (iphone15pro 393x852 in
   MOBILE_PROFILES / deviceDimensions.mobile). JS sets the real size at runtime; this fallback
   only shows in the pre-JS first paint (e.g. downloadStandalone's exported file), so a stale
   value would render the wrong size there. */
.mobile-frame {
    width: 393px;
    height: 852px;
    border-radius: 12px;
}

.mobile-frame.landscape {
    width: 852px;
    height: 393px;
}

/* Rotation and scale utilities */
.rotate-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
    padding: 6px 14px;
    font-size: 0.8rem;
    box-shadow: none;
}

.rotate-btn:hover {
    background: rgba(255, 255, 255, 0.10);
    border-color: var(--accent-aurora);
    box-shadow: 0 0 10px rgba(var(--accent-aurora-rgb), 0.15);
}

/* Device controls layout */
.device-controls {
    display: flex;
    flex-flow: row wrap;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
}

.input-group-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.device-select {
    background: var(--bg-input);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.8rem;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.device-select:focus {
    border-color: var(--accent-aurora);
}

.device-select-wrapper,
.grid-select-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.device-select-wrapper .select-icon,
.grid-select-wrapper .select-icon {
    position: absolute;
    left: 10px;
    pointer-events: none;
    color: var(--text-secondary);
    opacity: 0.7;
    z-index: 2;
    transition: color 0.2s;
}

.device-select-wrapper:hover .select-icon,
.grid-select-wrapper:hover .select-icon {
    color: var(--accent-aurora);
}

.device-select-wrapper select,
.grid-select-wrapper select {
    padding-left: 28px !important;
}

.device-select-wrapper select {
    min-width: 140px;
    max-width: 155px;
}

.grid-select-wrapper select {
    min-width: 95px;
    max-width: 120px;
}

.icon-only-btn {
    background: rgba(255, 255, 255, 0.04) !important;
    color: var(--text-secondary) !important;
    border: 1px solid var(--border-glass) !important;
    border-radius: 8px !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    box-shadow: none !important;
    transform: none !important;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease !important;
}

.icon-only-btn:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: var(--accent-aurora) !important;
    color: var(--accent-aurora) !important;
    box-shadow: 0 0 10px rgba(var(--accent-aurora-rgb), 0.2) !important;
}

.icon-only-btn:active {
    transform: scale(0.95) !important;
}

.icon-only-btn.active {
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
    color: var(--text-danger-soft) !important;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2) !important;
}

/* View Mode Selector (Side-by-Side, Overlay Slider, Tabs) */
.view-mode-selector {
    display: flex;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-glass);
    padding: 4px;
    border-radius: 8px;
    gap: 2px;
}

.view-mode-selector .mode-btn {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    box-shadow: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease;
    font-family: var(--font-heading);
}

.view-mode-selector .mode-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    transform: none;
    box-shadow: none;
}

.view-mode-selector .mode-btn.active {
    background: var(--accent-gradient);
    color: #020617;
    box-shadow: 0 2px 8px rgba(var(--accent-aurora-rgb), 0.25);
}

/* Tab Toggle Container */
.tab-toggle-container {
    display: flex;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-glass);
    padding: 4px;
    border-radius: 8px;
    gap: 2px;
}

.tab-toggle-container .tab-btn {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    box-shadow: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease;
    font-family: var(--font-heading);
}

.tab-toggle-container .tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.tab-toggle-container .tab-btn.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--accent-aurora);
    border: 1px solid rgba(var(--accent-aurora-rgb), 0.25);
}

/* Failsafe to disable pointer events during drag */
body.dragging iframe {
    pointer-events: none !important;
}

/* Slider Wrapper Dimensions and Layout mapping */
.slider-wrapper {
    display: flex;
    gap: 30px;
    justify-content: center;
    width: auto !important;
    height: auto !important;
    position: relative;
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1), height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Mode: Side-by-Side */
.iframe-container.mode-side-by-side .slider-wrapper {
    display: flex;
    gap: 30px;
    width: auto !important; /* Let children dictate width */
    height: auto !important; /* Let children dictate height */
}

.iframe-container.mode-side-by-side .slider-handle {
    display: none !important;
}

/* Mode: Overlay Slider */
.iframe-container.mode-overlay-slider .slider-wrapper {
    position: relative;
    /* Use width/height set inline by JS matching active device dimensions */
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-premium);
}

.iframe-container.mode-overlay-slider .iframe-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    gap: 0;
}

.iframe-container.mode-overlay-slider .iframe-wrapper h3 {
    display: none !important; /* Hide titles in overlay mode */
}

.iframe-container.mode-overlay-slider .iframe-wrapper iframe {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0;
    border: none;
    box-shadow: none;
}

.iframe-container.mode-overlay-slider .live-wrapper {
    z-index: 2;
    clip-path: inset(0 0 0 var(--split-pos, 50%));
}

.iframe-container.mode-overlay-slider .local-wrapper {
    z-index: 1;
}

/* Overlay Slider Handle bar */
.iframe-container.mode-overlay-slider .slider-handle {
    display: block;
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--split-pos, 50%);
    width: 20px; /* Expanded hit area */
    background: transparent;
    cursor: ew-resize;
    z-index: 10;
    transform: translateX(-50%);
    touch-action: none;
}

.iframe-container.mode-overlay-slider .slider-handle::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px;
    background: var(--accent-gradient);
    transform: translateX(-50%);
    box-shadow: 0 0 12px rgba(var(--accent-aurora-rgb), 0.4);
}

.iframe-container.mode-overlay-slider .slider-handle::after {
    content: '↔';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    background: var(--bg-dark);
    border: 2px solid var(--accent-aurora);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-aurora);
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    user-select: none;
}

/* Mode: Tabs */
.iframe-container.mode-tabs .slider-wrapper {
    display: block;
    position: relative;
    border-radius: 16px;
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-premium);
    overflow: hidden;
}

.iframe-container.mode-tabs .iframe-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    gap: 0;
}

.iframe-container.mode-tabs .iframe-wrapper h3 {
    display: none !important;
}

.iframe-container.mode-tabs .iframe-wrapper iframe {
    width: 100% !important;
    height: 100% !important;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.iframe-container.mode-tabs .slider-handle {
    display: none !important;
}

.iframe-container.mode-tabs .slider-wrapper.show-local .local-wrapper {
    z-index: 2;
    display: block !important;
}
.iframe-container.mode-tabs .slider-wrapper.show-local .live-wrapper {
    z-index: 1;
    display: none !important;
}

.iframe-container.mode-tabs .slider-wrapper.show-live .local-wrapper {
    z-index: 1;
    display: none !important;
}
.iframe-container.mode-tabs .slider-wrapper.show-live .live-wrapper {
    z-index: 2;
    display: block !important;
}

/* Optional Local Comparison mode - single live viewport overrides */
body.mode-single-live #local-url-group,
body.mode-single-live #swap-urls-btn {
    display: none !important;
}

body.mode-single-live .local-wrapper {
    display: none !important;
}

body.mode-single-live .view-mode-selector,
body.mode-single-live .tab-toggle-container {
    display: none !important;
}

body.mode-single-live .iframe-container .slider-wrapper {
    display: block !important;
    width: auto !important;
    height: auto !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
}

body.mode-single-live .iframe-container .live-wrapper {
    position: static !important;
    width: auto !important;
    height: auto !important;
    clip-path: none !important;
}

body.mode-single-live .iframe-container .live-wrapper h3 {
    display: none !important;
}

body.mode-single-live .iframe-container .live-wrapper iframe {
    border: 1px solid var(--border-glass) !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3) !important;
}

body.mode-single-live .iframe-container .slider-handle {
    display: none !important;
}

/* Optional Live Comparison mode, single local viewport overrides */
body.mode-single-local #live-url-group,
body.mode-single-local #swap-urls-btn {
    display: none !important;
}

body.mode-single-local .live-wrapper {
    display: none !important;
}

body.mode-single-local .view-mode-selector,
body.mode-single-local .tab-toggle-container {
    display: none !important;
}

body.mode-single-local .iframe-container .slider-wrapper {
    display: block !important;
    width: auto !important;
    height: auto !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
}

body.mode-single-local .iframe-container .local-wrapper {
    position: static !important;
    width: auto !important;
    height: auto !important;
    clip-path: none !important;
}

body.mode-single-local .iframe-container .local-wrapper h3 {
    display: none !important;
}

body.mode-single-local .iframe-container .local-wrapper iframe {
    border: 1px solid var(--border-glass) !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3) !important;
}

body.mode-single-local .iframe-container .slider-handle {
    display: none !important;
}



/* Warning Banner Styles */
.warning-banner {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--text-danger-soft);
    padding: 14px 40px 14px 24px;
    border-radius: 12px;
    font-size: 0.8rem;
    line-height: 1.5;
    box-sizing: border-box;
    text-align: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.1);
    font-family: var(--font-body);
    
    position: fixed;
    top: calc(var(--header-height, 70px) + 10px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 110;
    width: calc(100% - 40px);
    max-width: 600px;
    margin: 0;
    transition: top 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.warning-banner strong {
    color: #f87171;
}

.close-warning-btn {
    position: absolute;
    top: 6px;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--text-danger-soft);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    box-shadow: none !important;
    transform: none !important;
    transition: color 0.2s;
}

.close-warning-btn:hover {
    color: #fff;
}

.btn-warning-action {
    background: var(--accent-gradient);
    color: #020617;
    border: none;
    padding: 6px 16px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    border-radius: 6px;
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(var(--accent-aurora-rgb), 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-warning-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(var(--accent-aurora-rgb), 0.35);
}

.interactive-tip-link {
    cursor: pointer;
    color: var(--accent-aurora);
    text-decoration: underline;
    transition: color 0.2s ease;
}

.interactive-tip-link:hover {
    color: #fff;
}

