:root {
    --bg-base: #fafbfc;
    --bg-panel: rgba(255, 255, 255, 0.78);
    --bg-panel-solid: #ffffff;
    --bg-hover: rgba(0, 0, 0, 0.04);
    --border: rgba(226, 232, 240, 0.85);
    --border-light: rgba(203, 213, 225, 0.95);

    --accent: #0f172a;
    --accent-hover: #000000;
    --accent-glow: rgba(15, 23, 42, 0.12);
    --danger: #ef4444;

    --text-main: #0f172a;
    --text-dim: #64748b;
    --text-muted: #94a3b8;

    --sidebar-width: 280px;
    --inspector-width: 320px;
    --header-height: 54px;
    --font-display: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-base);
    background-image: radial-gradient(750px circle at 50% 25%, rgba(226, 232, 240, 0.75), transparent 75%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: "Inter", sans-serif;
    font-size: 13px;
    height: 100vh;
    overflow: hidden;
}

/* Beautiful Animated Background */
.app-background {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 50% -10%,
            rgba(226, 232, 240, 0.5) 0%,
            transparent 75%),
        radial-gradient(circle at 90% 90%,
            rgba(226, 232, 240, 0.3) 0%,
            transparent 65%);
    z-index: -1;
    pointer-events: none;
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 16px 20px 16px 20px;
    gap: 14px;
    box-sizing: border-box;
}

/* Solid Geometric Panels */
.panel {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(229, 231, 235, 0.85);
    border-radius: 20px;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.04);
}

/* Floating Glass Capsule Header */
.navbar {
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    gap: 12px;
    width: 100%;
    margin: 0 auto;
    max-width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 9999px;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.02);
    position: relative;
    z-index: 100;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.navbar:hover {
    border-color: rgba(203, 213, 225, 1);
    box-shadow: 0 8px 30px -4px rgba(0, 0, 0, 0.08), 0 4px 10px -2px rgba(0, 0, 0, 0.03);
    background: rgba(255, 255, 255, 0.95);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.nav-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 0;
    overflow: visible;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 4px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 6px;
    cursor: pointer;
    flex-shrink: 0;
}

.logo-text {
    display: flex;
    align-items: center;
    gap: 6px;
}

.logo-main {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 900;
    letter-spacing: -0.03em;
    color: #0f172a;
    line-height: 1;
}

.logo-sub {
    font-family: var(--font-display);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #64748b;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    padding: 2px 7px;
}

.logo svg {
    width: 18px;
    height: 18px;
    color: #0f172a;
}

.divider {
    width: 1px;
    height: 18px;
    background: rgba(226, 232, 240, 0.95);
    margin: 0 3px;
    flex-shrink: 0;
}

.tool-btn,
.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 9999px;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    background: none;
    border: none;
    font-size: 15px;
    flex-shrink: 0;
}

.tool-btn:hover,
.icon-btn:hover {
    background: rgba(15, 23, 42, 0.05);
    color: #0f172a;
    transform: translateY(-1px);
}

.tool-btn.active {
    background: #0f172a;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}

.tool-btn svg,
.icon-btn svg {
    width: 16px;
    height: 16px;
}

/* Modern Horizontal Pill Insert Bar */
.insert-bar {
    display: inline-flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.04);
    backdrop-filter: blur(12px);
    border-radius: 9999px;
    padding: 3px 6px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    gap: 2px;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    box-sizing: border-box;
    flex-shrink: 1;
}

.insert-bar::-webkit-scrollbar {
    display: none;
}

.insert-btn {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    padding: 4px 9px;
    border-radius: 9999px;
    background: transparent;
    border: none;
    color: #475569;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    gap: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.insert-btn:hover {
    background: #ffffff;
    color: #0f172a;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.insert-btn svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.insert-btn span {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Insert More Dropdown */
.insert-more-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.insert-more-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 14px;
    padding: 6px;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.12), 0 4px 10px -2px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 140px;
    z-index: 1000;
    animation: menuFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.insert-more-menu.hidden {
    display: none !important;
}

.insert-more-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #334155;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
    width: 100%;
}

.insert-more-item:hover {
    background: rgba(15, 23, 42, 0.06);
    color: #0f172a;
}

.insert-more-item svg {
    width: 14px;
    height: 14px;
    color: #64748b;
}

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



/* Expand Arrow Button (Subtle minimalist chevron right on the edge of ImageLabel) */
button.expand-arrow-btn,
.expand-arrow-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 20px !important;
    height: 22px !important;
    min-width: 20px !important;
    min-height: 22px !important;
    padding: 0 !important;
    border-radius: 6px !important;
    background: transparent !important;
    color: #64748b !important;
    border: none !important;
    margin: 0 1px 0 2px !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    box-shadow: none !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    position: relative !important;
    z-index: 5 !important;
}

button.expand-arrow-btn:hover,
.expand-arrow-btn:hover {
    background: rgba(15, 23, 42, 0.07) !important;
    color: #0f172a !important;
    transform: none !important;
    box-shadow: none !important;
}

button.expand-arrow-btn svg,
.expand-arrow-btn svg {
    width: 13px !important;
    height: 13px !important;
    stroke: currentColor !important;
    stroke-width: 2.2 !important;
    display: block !important;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

button.expand-arrow-btn.expanded svg,
.expand-arrow-btn.expanded svg {
    transform: rotate(180deg) !important;
}

/* Floating Glass Dropdown Tray for Extended Components (Single Pill Row, Matching Normal Insert Bar) */
.insert-dropdown-tray {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: auto;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 9999px;
    box-shadow: 0 12px 30px -4px rgba(15, 23, 42, 0.12), 0 4px 10px rgba(0, 0, 0, 0.04);
    padding: 3px 6px;
    flex-direction: row;
    align-items: center;
    gap: 2px;
    z-index: 99999;
    box-sizing: border-box;
    white-space: nowrap;
    width: max-content;
    max-width: calc(100vw - 32px);
}

.insert-dropdown-tray.expanded {
    display: flex;
    animation: traySlideDown 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes traySlideDown {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.insert-dropdown-tray .insert-btn {
    white-space: nowrap;
}

/* Hyper-Realistic macOS Window Controls ("Traffic Lights / Cones") */
[data-name="TrafficLights"] svg,
[data-id*="TrafficLights"] svg,
.canvas-element[data-name="CloseButton"] svg,
.canvas-element[data-name="MinimiseButton"] svg,
.canvas-element[data-name="MaximiseButton"] svg {
    filter: drop-shadow(0 0.75px 1.5px rgba(0, 0, 0, 0.16));
    transition: filter 0.15s ease, transform 0.1s ease;
}

[data-name="TrafficLights"]:hover .mac-glyph,
[data-id*="TrafficLights"]:hover .mac-glyph,
.canvas-element[data-name="CloseButton"]:hover .mac-glyph,
.canvas-element[data-name="MinimiseButton"]:hover .mac-glyph,
.canvas-element[data-name="MaximiseButton"]:hover .mac-glyph {
    opacity: 1 !important;
    transition: opacity 0.12s ease;
}

.canvas-element[data-name="CloseButton"]:active svg,
.canvas-element[data-name="MinimiseButton"]:active svg,
.canvas-element[data-name="MaximiseButton"]:active svg {
    transform: scale(0.92);
    filter: brightness(0.85) drop-shadow(0 0.5px 0.5px rgba(0, 0, 0, 0.25));
}

/* Tactile macOS / Roblox Studio Corner Resize Grip */
.window-resize-grip {
    position: absolute;
    right: 5px;
    bottom: 5px;
    width: 14px;
    height: 14px;
    cursor: se-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0.55;
    transition: opacity 0.15s ease, transform 0.12s ease;
    user-select: none;
    border-radius: 3px;
}

.window-resize-grip:hover {
    opacity: 1;
    transform: scale(1.15);
    background: rgba(0, 0, 0, 0.04);
}

.window-resize-grip:active {
    opacity: 1;
    transform: scale(0.95);
}

/* Canvas SearchBar Interactive Input */
.canvas-element[data-name="SearchBar"] {
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.canvas-element[data-name="SearchBar"]:focus-within {
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.25) !important;
}

.canvas-search-input::placeholder {
    color: #94a3b8;
    opacity: 1;
}

.canvas-search-clear:hover {
    color: #0f172a !important;
}

/* Notification Bell Button */
.changelog-btn {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    border-radius: 9999px !important;
    cursor: pointer !important;
    border: 1px solid rgba(226, 232, 240, 0.95) !important;
    background: #ffffff !important;
    color: #475569 !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.changelog-btn:hover {
    background: #f8fafc !important;
    border-color: rgba(203, 213, 225, 1) !important;
    color: #0f172a !important;
    transform: translateY(-1px) !important;
}

.changelog-btn svg {
    width: 17px !important;
    height: 17px !important;
}

.changelog-dot {
    position: absolute !important;
    top: 6px !important;
    right: 7px !important;
    width: 7.5px !important;
    height: 7.5px !important;
    background: #ef4444 !important; /* Standard vibrant red notification dot */
    border: 1.5px solid #ffffff !important;
    border-radius: 50% !important;
    box-shadow: 0 1px 3px rgba(239, 68, 68, 0.45) !important;
    pointer-events: none !important;
    animation: pulse-dot 2.5s infinite;
}

@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

/* Action Buttons */
.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 9999px;
    cursor: pointer;
    border: 1px solid rgba(229, 231, 235, 0.9);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    color: #0f172a;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: inherit;
}

.action-btn:hover {
    background: #ffffff;
    border-color: rgba(203, 213, 225, 1);
    color: #000000;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.action-btn.primary {
    background: #0f172a;
    border-color: #0f172a;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.15);
}

.action-btn.primary:hover {
    background: #000000;
    border-color: #000000;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25);
}

.action-btn svg {
    width: 16px;
    height: 16px;
}

/* Run / Test Button */
.action-btn.run-test-btn {
    width: auto !important;
    padding: 0 13px !important;
    gap: 7px !important;
    font-size: 11.5px !important;
    font-weight: 700 !important;
    background: #0f172a !important;
    color: #ffffff !important;
    border: 1px solid #0f172a !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2) !important;
    letter-spacing: -0.01em;
}

.action-btn.run-test-btn:hover {
    background: #1e293b !important;
    border-color: #1e293b !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.3) !important;
}

.action-btn.run-test-btn.active {
    background: #10b981 !important;
    border-color: #10b981 !important;
    color: #ffffff !important;
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.45) !important;
}

.action-btn.run-test-btn .run-pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    display: inline-block;
    transition: all 0.2s ease;
}

.action-btn.run-test-btn.active .run-pulse-dot {
    background: #ffffff;
    animation: pulse-dot 1.2s infinite;
}

/* Simulated Hooking HUD */
.hook-test-hud {
    position: fixed;
    bottom: 24px;
    right: 28px;
    width: 380px;
    max-height: 250px;
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35), 0 0 1px 1px rgba(255, 255, 255, 0.1);
    color: #f8fafc;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.hook-test-hud.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(14px) scale(0.96);
}

.hud-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(30, 41, 59, 0.7);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.hud-title-wrap {
    display: flex;
    align-items: center;
    gap: 7px;
}

.hud-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
    animation: pulse-dot 1.5s infinite;
}

.hud-title {
    font-weight: 700;
    font-size: 10.5px;
    letter-spacing: 0.04em;
    color: #f1f5f9;
}

.hud-tag {
    font-size: 9px;
    font-weight: 700;
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.hud-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hud-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    border-radius: 4px;
    font-size: 10px;
    padding: 2px 7px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.hud-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

.hud-btn.close:hover {
    background: rgba(239, 68, 68, 0.35);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.5);
}

.hud-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 160px;
}

.hud-log-item {
    line-height: 1.4;
    word-break: break-word;
    font-size: 10.5px;
}

.hud-log-item .hud-time {
    color: #64748b;
    margin-right: 5px;
}

.hud-log-item.info .hud-msg {
    color: #94a3b8;
}

.hud-log-item.hook .hud-msg {
    color: #38bdf8;
}

.hud-log-item.event .hud-msg {
    color: #34d399;
}

.hud-log-item.warn .hud-msg {
    color: #fbbf24;
}

.hud-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background: rgba(15, 23, 42, 0.98);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 9.5px;
    color: #64748b;
}

.hud-footer b {
    color: #94a3b8;
}

.action-btn.discord-btn {
    background: #5865f2;
    color: #fff;
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
    border: none;
    border-radius: 9999px;
}

.action-btn.discord-btn:hover {
    background: #4752c4;
    transform: translateY(-1px);
}

.action-btn.discord-btn svg {
    width: 18px;
    height: 18px;
}

/* Workspace */
.workspace {
    flex: 1;
    display: flex;
    gap: 14px;
    min-height: 0;
    min-width: 0;
}

/* Sidebars */
.sidebar {
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
    z-index: 10 !important;
    width: var(--sidebar-width);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 20px !important;
    background: rgba(255, 255, 255, 0.75) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border: 1px solid rgba(229, 231, 235, 0.85) !important;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.04) !important;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(229, 231, 235, 0.7);
    font-size: 11px;
    color: #64748b;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(255, 255, 255, 0.5);
}

.sidebar-footer a {
    color: #0f172a;
    text-decoration: none;
    font-weight: 600;
}

.sidebar-footer a:hover {
    text-decoration: underline;
}

.sidebar.inspector-panel {
    width: var(--inspector-width);
}

.panel-header {
    height: 48px;
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 13.5px;
    letter-spacing: -0.02em;
    color: #0f172a;
    border-bottom: 1px solid rgba(229, 231, 235, 0.7);
    background: rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
}

/* Main Canvas */
.main-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    position: relative;
    overflow: visible;
}

.canvas-area {
    flex: 1;
    background: var(--canvas-bg, #f8fafc);
    border: 1px solid rgba(229, 231, 235, 0.85);
    border-radius: 20px;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.03);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: radial-gradient(rgba(148, 163, 184, 0.28) 1.2px, transparent 1.2px);
    background-size: 24px 24px;
    background-position: 50% 50%;
    min-width: 0;
}

/* Hide dated CAD rulers */
.ruler {
    display: none !important;
}

.ruler-top {
    top: 36px;
    left: 0;
    width: 100%;
    height: 20px;
}

.ruler-left {
    top: 56px;
    left: 0;
    width: 20px;
    height: calc(100% - 56px);
}

/* Canvas Toolbar */
.canvas-toolbar {
    position: relative;
    height: 44px;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    z-index: 50;
    flex-shrink: 0;
    overflow: visible;
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 1;
    min-width: 0;
}

.toolbar-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #475569;
    white-space: nowrap;
    flex-shrink: 0;
}

.toolbar-select {
    width: auto;
    min-width: 80px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    color: #0f172a;
    background: #ffffff;
    border: 1px solid rgba(203, 213, 225, 0.95);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    outline: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.toolbar-select:hover {
    border-color: rgba(148, 163, 184, 1);
}

.toolbar-select:focus {
    border-color: #0f172a;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.1);
}

.toolbar-color {
    width: 28px;
    height: 28px;
    padding: 2px;
    border: 1px solid rgba(203, 213, 225, 0.95);
    border-radius: 8px;
    cursor: pointer;
    background: #ffffff;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.03);
}

.toolbar-color::-webkit-color-swatch-wrapper {
    padding: 0;
}

.toolbar-color::-webkit-color-swatch {
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 6px;
}

.toolbar-color::-webkit-color-swatch {
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 9999px;
}

.zoom-indicator {
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    font-weight: 600;
    color: #0f172a;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    padding: 4px 10px;
    min-width: 48px;
    text-align: center;
}

/* Pristine Floating Device Frame Viewport - Infinite Whiteboard Canvas Container */
.viewport {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    background-image: none !important;
    overflow: visible !important;
    width: 800px;
    height: 500px;
    position: relative;
    transition: transform 0.1s ease-out;
}

/* Modern Code Drawer */
.code-drawer {
    height: 220px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(229, 231, 235, 0.85);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.04);
    transition:
        width 0.3s,
        height 0.3s,
        transform 0.1s;
}

.code-drawer.floating {
    position: fixed;
    bottom: 40px;
    right: 40px;
    width: 600px;
    height: 400px;
    z-index: 2000;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15);
    border: 1px solid rgba(229, 231, 235, 0.9);
    transition: none;
}

.code-drawer.floating .panel-header {
    cursor: default;
    /* Use dedicated drag handle instead */
}

.drag-handle {
    height: 12px;
    background: rgba(255, 255, 255, 0.03);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: move;
    border-bottom: 1px solid var(--border);
}

.code-drawer.floating .drag-handle {
    display: flex;
}

.drag-dots {
    display: flex;
    gap: 3px;
}

.drag-dots span {
    width: 3px;
    height: 3px;
    background: var(--text-dim);
    border-radius: 50%;
    opacity: 0.5;
}

/* Resize Zones */
.drawer-resizer {
    position: absolute;
    z-index: 100;
    display: none;
}

.code-drawer.floating .drawer-resizer {
    display: block;
}

.resizer-n {
    top: -4px;
    left: 0;
    right: 0;
    height: 8px;
    cursor: n-resize;
}

.resizer-s {
    bottom: -4px;
    left: 0;
    right: 0;
    height: 8px;
    cursor: s-resize;
}

.resizer-e {
    right: -4px;
    top: 0;
    bottom: 0;
    width: 8px;
    cursor: e-resize;
}

.resizer-w {
    left: -4px;
    top: 0;
    bottom: 0;
    width: 8px;
    cursor: w-resize;
}

.resizer-se {
    right: -4px;
    bottom: -4px;
    width: 12px;
    height: 12px;
    cursor: se-resize;
    z-index: 101;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.editor-container {
    flex: 1;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    overflow: hidden;
}

.code-tabs {
    gap: 0;
    padding: 0 8px;
}

.tab-bar {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
}

.tab-bar::-webkit-scrollbar {
    display: none;
}

.code-tab {
    padding: 6px 14px;
    font-size: 11.5px;
    font-weight: 600;
    color: #64748b;
    background: transparent;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    gap: 6px;
}

.code-tab:hover {
    color: #0f172a;
    background: rgba(15, 23, 42, 0.04);
}

.code-tab.active {
    color: #0f172a !important;
    background: rgba(15, 23, 42, 0.06) !important;
    box-shadow: none !important;
    border-bottom: 2px solid #0f172a !important;
    border-radius: 8px 8px 0 0 !important;
}

.code-tab .tab-close {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    opacity: 0.6;
    transition: all 0.15s;
}

.code-tab:hover .tab-close {
    opacity: 0.6;
}

/* --- NEURAL DESIGN (AI) STYLES --- */
.neural-btn {
    border: 1px solid rgba(59, 130, 246, 0.4) !important;
    background: rgba(59, 130, 246, 0.05) !important;
    color: var(--accent) !important;
    position: relative;
    overflow: hidden;
}

.neural-btn::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(transparent, var(--accent), transparent 30%);
    animation: rotate-neural 4s linear infinite;
    opacity: 0.2;
    pointer-events: none;
}

@keyframes rotate-neural {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.ai-content {
    background: rgba(255, 255, 255, 0.96) !important;
    border: 1px solid rgba(226, 232, 240, 0.95) !important;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.1) !important;
    color: #0f172a !important;
}

.ai-orb {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 1px;
}

#aiPromptInput {
    background: #ffffff;
    border: 1px solid rgba(203, 213, 225, 0.9);
    border-radius: 8px;
    color: #0f172a;
    padding: 12px;
    line-height: 1.5;
}

#aiPromptInput:focus {
    border-color: var(--accent);
    outline: none;
}

.btn.primary#generateAIBtn {
    background: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 800;
    font-size: 11px;
    height: 38px;
}

.code-tab .tab-close:hover {
    opacity: 1;
    background: var(--bg-hover);
}

/* Explorer */
.explorer-search {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(229, 231, 235, 0.7);
}

.explorer-search .prop-input {
    font-size: 12px;
    padding: 7px 12px;
    border-radius: 9999px;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.explorer,
.properties {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 12px;
}

.explorer-item {
    display: flex;
    align-items: center;
    padding: 7px 12px;
    margin-bottom: 3px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    gap: 8px;
    transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    min-height: 32px;
}

.explorer-item:hover {
    background: rgba(15, 23, 42, 0.04);
    color: #0f172a;
    transform: translateX(2px);
}

.explorer-item.selected {
    background: rgba(15, 23, 42, 0.07) !important;
    color: #0f172a !important;
    font-weight: 600;
    box-shadow: none !important;
    border: 1px solid rgba(203, 213, 225, 0.85) !important;
    position: relative !important;
}

.explorer-item.selected::before {
    content: '' !important;
    position: absolute !important;
    left: 0 !important;
    top: 6px !important;
    bottom: 6px !important;
    width: 3px !important;
    border-radius: 0 3px 3px 0 !important;
    background: #0f172a !important;
}

.explorer-item.selected svg {
    color: #0f172a !important;
}

.explorer-item.just-added {
    animation: flashAdded 1.5s ease-out;
}

@keyframes flashAdded {
    0% { background: rgba(37, 99, 235, 0.35) !important; outline: 2px solid #2563eb; }
    50% { background: rgba(37, 99, 235, 0.18) !important; outline: 1px solid rgba(37, 99, 235, 0.5); }
    100% { background: rgba(15, 23, 42, 0.07) !important; outline: none; }
}

.explorer-item.drag-over {
    background: rgba(15, 23, 42, 0.08);
}

.explorer-item.locked {
    opacity: 0.5;
}

.explorer-item svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    color: #64748b;
}

.item-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-actions {
    display: none;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.explorer-item:hover .item-actions {
    display: flex;
}

.eye-btn,
.lock-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    padding: 3px;
    border-radius: 6px;
    opacity: 0.6;
    color: inherit;
    transition: all 0.15s;
}

.eye-btn:hover,
.lock-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

.eye-btn.off {
    opacity: 1;
    color: #ef4444;
}

.lock-btn.on {
    opacity: 1;
    color: #f59e0b;
}

.tree-toggle {
    font-size: 9px;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s;
    flex-shrink: 0;
    color: #94a3b8;
}

.tree-toggle.open {
    transform: rotate(90deg);
}

.tree-toggle-spacer {
    width: 14px;
    flex-shrink: 0;
}

/* Properties */
.prop-category {
    padding: 10px 8px 6px;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.08em;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.prop-section-header {
    padding: 8px 10px;
    font-family: var(--font-display);
    font-size: 11.5px;
    font-weight: 800;
    text-transform: uppercase;
    color: #475569;
    letter-spacing: 0.06em;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s;
}

.prop-section-header:hover {
    background: rgba(15, 23, 42, 0.04);
    color: #0f172a;
}

.section-arrow {
    font-size: 8px;
    transition: transform 0.2s;
    display: inline-block;
}

.section-arrow.open {
    transform: rotate(90deg);
}

.prop-row {
    display: flex;
    align-items: center;
    padding: 6px 4px;
    margin-bottom: 4px;
    min-height: 34px;
}

.prop-label {
    flex: 0 0 110px;
    padding-left: 6px;
    font-size: 11.5px;
    font-weight: 500;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.prop-value {
    flex: 1;
    display: flex;
    align-items: center;
}

.align-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    width: 100%;
    margin-top: 6px;
}

.align-grid .action-btn {
    padding: 4px;
    font-size: 11px;
    justify-content: center;
    height: 30px;
    border-radius: 8px;
}

.prop-input {
    width: 100%;
    min-width: 0;
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 10px;
    color: #0f172a;
    font-size: 12px;
    font-weight: 500;
    padding: 7px 12px;
    outline: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: inherit;
}

.prop-input:focus {
    border-color: #0f172a;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

/* Native select/readability hardening */
select.prop-input,
select.toolbar-select {
    color: var(--text-main);
    background-color: #ffffff;
}

select.prop-input option,
select.toolbar-select option {
    color: #0f172a;
    background-color: #ffffff;
}

.prop-input:focus {
    border-color: var(--accent);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

input[type="color"].prop-input {
    padding: 0;
    height: 28px;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

/* Context Menu */
.context-menu {
    position: fixed;
    padding: 6px;
    z-index: 1000;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.1);
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-main);
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.1s;
}

.menu-item:hover {
    background: var(--bg-hover);
}

.menu-item.danger:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.menu-item svg {
    width: 16px;
    height: 16px;
    color: var(--text-dim);
}

.menu-item.danger svg {
    color: var(--danger);
}

.menu-item span {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-dim);
}

.menu-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 6px;
}

/* Canvas Element */
.canvas-element {
    position: absolute;
    box-sizing: border-box;
    user-select: none;
    overflow: visible;
}

.canvas-element.being-dragged {
    z-index: 999999 !important;
}

.canvas-element.drag-overflow-visible {
    overflow: visible !important;
}

/* Custom Scrollbar Logic for Viewport */
.canvas-element::-webkit-scrollbar {
    width: var(--sb-thickness, 8px);
    height: var(--sb-thickness, 8px);
}

.canvas-element::-webkit-scrollbar-track {
    background: transparent;
}

.canvas-element::-webkit-scrollbar-thumb {
    background: var(--sb-color, #ffffff);
    opacity: var(--sb-opacity, 1);
    border-radius: 10px;
}

.canvas-element.selected::after {
    content: "";
    position: absolute;
    inset: -1px;
    border: 1.2px solid #2563eb !important;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15) !important;
    border-radius: inherit;
    pointer-events: none;
    z-index: 9999;
}

.canvas-element.being-dragged::after {
    content: "";
    position: absolute;
    inset: -1px;
    border: 1.2px solid #2563eb !important;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2) !important;
    border-radius: inherit;
    pointer-events: none;
    z-index: 999999;
}

.canvas-element[data-name="Topbar"] {
    border-top-left-radius: 22px !important;
    border-top-right-radius: 22px !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.canvas-element.locked {
    outline: 1px dashed rgba(251, 191, 36, 0.4);
}

/* Resize Handles */
.handle {
    width: 7px;
    height: 7px;
    background: #ffffff;
    border: 1.2px solid #2563eb !important;
    border-radius: 50%;
    position: absolute;
    z-index: 10000;
    box-sizing: border-box;
    box-shadow: 0 1px 4px rgba(37, 99, 235, 0.25);
}

.handle-nw {
    top: -3.5px;
    left: -3.5px;
    cursor: nw-resize;
}

.handle-ne {
    top: -3.5px;
    right: -3.5px;
    cursor: ne-resize;
}

.handle-sw {
    bottom: -3.5px;
    left: -3.5px;
    cursor: sw-resize;
}

.handle-se {
    bottom: -3.5px;
    right: -3.5px;
    cursor: se-resize;
}

.handle-n {
    top: -3.5px;
    left: calc(50% - 3.5px);
    cursor: n-resize;
}

.handle-s {
    bottom: -3.5px;
    left: calc(50% - 3.5px);
    cursor: s-resize;
}

.handle-w {
    left: -3.5px;
    top: calc(50% - 3.5px);
    cursor: w-resize;
}

.handle-e {
    right: -3.5px;
    top: calc(50% - 3.5px);
    cursor: e-resize;
}

/* Snap Guides */
.snap-guide {
    position: absolute;
    z-index: 9998;
    pointer-events: none;
}

.snap-guide-h {
    background: #00d4ff;
    height: 1px;
    width: 100%;
    left: 0;
}

.snap-guide-v {
    background: #00d4ff;
    width: 1px;
    height: 100%;
    top: 0;
}

/* Distance Indicators */
.dist-line {
    position: absolute;
    background: #f97316;
    z-index: 9997;
    pointer-events: none;
}

.dist-label {
    position: absolute;
    background: #f97316;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
    transform: translate(-50%, -50%);
    z-index: 9998;
    pointer-events: none;
    white-space: nowrap;
}

/* Selection Info Bar */
.selection-info {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: #e2e8f0;
    font-size: 11px;
    font-weight: 500;
    font-family: "JetBrains Mono", monospace;
    padding: 4px 14px;
    border-radius: 6px;
    z-index: 20;
    display: none;
    align-items: center;
    gap: 12px;
    pointer-events: none;
    letter-spacing: 0.3px;
}

/* Color Swatches */
.color-swatches {
    display: flex;
    gap: 3px;
    padding: 2px 0 0;
    flex-wrap: wrap;
}

.color-swatch {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform 0.1s;
}

.color-swatch:hover {
    transform: scale(1.2);
    border-color: var(--text-main);
}

.color-swatch-item {
    aspect-ratio: 1 / 1;
    min-height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: transform 0.12s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.12s ease;
    box-sizing: border-box;
}

.color-swatch-item:hover {
    transform: scale(1.28);
    z-index: 5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
}

.color-wheel-wrapper:hover {
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25) !important;
}

/* Box Selection */
.selection-rect {
    position: absolute;
    border: 1px solid var(--accent);
    background: rgba(59, 130, 246, 0.1);
    display: none;
    z-index: 9999;
    pointer-events: none;
}



.template-name {
    font-weight: 600;
    font-size: 13px;
}

.template-desc {
    font-size: 11px;
    color: var(--text-dim);
}

/* Shortcuts Modal */
.shortcuts-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shortcuts-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15);
    width: 440px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 24px;
}

.shortcuts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
}

.shortcut-category {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-dim);
    letter-spacing: 0.5px;
    margin: 16px 0 8px;
}

.shortcut-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.shortcut-action {
    font-size: 13px;
    color: var(--text-main);
}

.shortcut-keys {
    font-size: 12px;
    font-family: "JetBrains Mono", monospace;
    color: var(--text-main);
    background: rgba(15, 23, 42, 0.05);
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.4);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.6);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.hidden {
    display: none !important;
}

/* UI Light Frosted Polish Pass */
body {
    background: var(--bg-base);
}

.panel {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(229, 231, 235, 0.85);
    border-radius: 20px;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.04);
}

.navbar {
    height: 56px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(229, 231, 235, 0.85);
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
}

.navbar::after {
    display: none;
}

.logo-main {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 900;
    letter-spacing: -0.03em;
    color: #0f172a;
    text-shadow: none;
}

.insert-bar {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.04);
    backdrop-filter: blur(12px);
    border-radius: 9999px;
    padding: 4px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    gap: 3px;
}

.insert-btn {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    padding: 6px 12px;
    border-radius: 9999px;
    background: transparent;
    border: none;
    color: #475569;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 600;
    gap: 5px;
}

.insert-btn:hover {
    border-color: transparent;
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.canvas-area {
    border-radius: 20px;
    border: 1px solid rgba(229, 231, 235, 0.85);
    background: #fafbfc;
    background-image: radial-gradient(rgba(148, 163, 184, 0.28) 1.2px, transparent 1.2px);
    background-size: 24px 24px;
    background-position: 50% 50%;
}

.canvas-toolbar {
    height: 48px;
    padding: 0 16px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(229, 231, 235, 0.85);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

.toolbar-label {
    color: #64748b;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.toolbar-select,
.prop-input {
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.95);
    color: #0f172a;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.toolbar-select:hover,
.prop-input:hover {
    border-color: rgba(203, 213, 225, 1);
}

.toolbar-select:focus,
.prop-input:focus {
    border-color: #0f172a;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.viewport {
    background: transparent !important;
    border-radius: 0 !important;
    overflow: visible !important;
    transform-origin: center center;
    transition: transform 0.2s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: none !important;
    border: none !important;
}

.viewport::before {
    display: none !important;
}

.explorer,
.properties {
    padding: 10px 12px;
}

.explorer-item {
    border: 1px solid transparent;
    border-radius: 10px;
    min-height: 32px;
    color: #475569;
    font-weight: 500;
    padding: 7px 12px;
}

.explorer-item:hover {
    background: rgba(15, 23, 42, 0.04);
    color: #0f172a;
}

.explorer-item.selected {
    background: rgba(15, 23, 42, 0.07) !important;
    color: #0f172a !important;
    font-weight: 600;
    box-shadow: none !important;
    border: 1px solid rgba(203, 213, 225, 0.85) !important;
}

.explorer-item.selected svg {
    color: #0f172a !important;
}

.prop-section-header {
    background: transparent;
    border: 1px solid transparent;
    color: #475569;
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: 0.06em;
}

.prop-section-header:hover {
    background: rgba(15, 23, 42, 0.04);
    color: #0f172a;
}

.prop-row {
    padding: 6px 4px;
    border-radius: 7px;
}

.prop-row:hover {
    background: rgba(15, 23, 42, 0.02);
}

.prop-label {
    color: #64748b;
    font-size: 11.5px;
    font-weight: 500;
}

.canvas-element.selected::after {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15) !important;
}

.handle {
    width: 7px;
    height: 7px;
    background: #ffffff;
    border: 1.2px solid #2563eb !important;
    box-shadow: 0 1px 4px rgba(37, 99, 235, 0.25);
}

.snap-guide-h,
.snap-guide-v {
    background: #3b82f6 !important;
    box-shadow: none;
}

.selection-info {
    bottom: 14px;
    border: 1px solid rgba(229, 231, 235, 0.9);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    color: #0f172a;
    border-radius: 9999px;
    padding: 6px 14px;
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.code-drawer {
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(229, 231, 235, 0.85);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.04);
}

.code-tab.active {
    background: rgba(15, 23, 42, 0.06) !important;
    color: #0f172a !important;
    font-weight: 600;
    box-shadow: none !important;
    border-bottom: 2px solid #0f172a !important;
    border-radius: 8px 8px 0 0 !important;
}

.action-btn.primary,
.btn.primary {
    background: #0f172a;
    border-color: #0f172a;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.15);
}

.action-btn.primary:hover,
.btn.primary:hover {
    background: #000000;
    border-color: #000000;
}

.modal-content,
.shortcuts-content,
.context-menu {
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
}

@media (max-width: 1180px) {

    .insert-btn span,
    .changelog-btn span:not(.changelog-dot) {
        display: none;
    }

    .insert-btn {
        min-width: 38px;
        padding: 8px;
    }

    .navbar {
        padding: 0 12px;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.001ms !important;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.001ms !important;
    }
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    width: 600px;
    max-width: 90%;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.15);
}

.modal-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#importCodeInput {
    width: 100%;
    height: 300px;
    font-family: "JetBrains Mono", monospace;
    font-size: 12px;
    resize: none;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    padding: 12px;
    outline: none;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.btn {
    padding: 8px 16px;
    border-radius: 9999px;
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text-main);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn:hover {
    background: rgba(15, 23, 42, 0.05);
}

.btn.primary {
    background: #0f172a;
    border-color: #0f172a;
    color: #ffffff;
}

.btn.primary:hover {
    background: #000000;
    border-color: #000000;
}

.selection-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 1px solid var(--accent);
    pointer-events: none;
    z-index: 1000;
}

.handle {
    pointer-events: auto;
}

/* Responsive */
@media (max-width: 1400px) {
    :root {
        --sidebar-width: 250px;
        --inspector-width: 280px;
    }

    .action-btn .btn-label {
        display: none;
    }

    .action-btn {
        padding: 0 10px;
    }

    .changelog-btn span:not(.changelog-dot) {
        display: none;
    }

    .changelog-btn {
        padding: 0 10px;
    }

    .canvas-toolbar .toolbar-label {
        display: none;
    }

    .canvas-toolbar {
        padding: 0 8px;
        gap: 4px;
    }
}

@media (max-width: 1100px) {
    :root {
        --sidebar-width: 220px;
        --inspector-width: 240px;
    }

    .canvas-toolbar .zoom-indicator {
        display: none;
    }

    .canvas-toolbar .export-select {
        min-width: 80px;
    }

    .logo-badge {
        display: none;
    }

    .navbar {
        height: 50px;
        padding: 0 10px;
        gap: 6px;
    }
}

@media (max-width: 900px) {
    :root {
        --sidebar-width: 180px;
        --inspector-width: 200px;
    }

    .insert-btn {
        padding: 6px;
    }

    .insert-btn svg {
        width: 16px;
        height: 16px;
    }
}

.drag-ghost {
    position: fixed;
    top: -100px;
    left: -100px;
    background: var(--accent);
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    pointer-events: none;
    z-index: 9999;
    box-shadow: none;
    border: 1px solid white;
}

.restore-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: var(--bg-panel-solid);
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: none;
    z-index: 5000;
    transition: all 0.2s;
    font-family: inherit;
}

.restore-btn:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-2px);
}

.restore-btn svg {
    width: 18px;
    height: 18px;
}

.hidden {
    display: none !important;
}

.template-card {
    flex-direction: column !important;
    align-items: flex-start;
    gap: 4px !important;
    padding: 12px 16px !important;
    background: rgba(255, 255, 255, 0.02) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.template-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.template-name {
    font-size: 14px !important;
    color: #fff;
}

.template-desc {
    font-size: 11px !important;
    opacity: 0.6;
}

/* --- EXPANDED TEMPLATE BROWSER MODAL --- */
.templates-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 9998;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.templates-backdrop.hidden {
    display: none !important;
}

.templates-panel {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    height: calc(100% - 48px) !important;
    overflow-y: auto !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    z-index: 10 !important;
}

.templates-panel.hidden {
    display: none !important;
}

.templates-header {
    display: none !important; /* Managed by right sidebar tab switcher */
}

.templates-toolbar {
    padding: 12px 14px !important;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
}

.templates-search {
    width: 100% !important;
    height: 34px !important;
    border: 1px solid rgba(203, 213, 225, 0.95) !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    color: #0f172a !important;
    padding: 0 11px !important;
    outline: none !important;
    font-family: inherit !important;
    font-size: 12px !important;
}

.templates-search:focus {
    border-color: #0f172a !important;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.12) !important;
}

.templates-categories {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
}

.template-chip {
    height: 24px !important;
    padding: 0 10px !important;
    border-radius: 999px !important;
    border: 1px solid rgba(226, 232, 240, 0.9) !important;
    background: #ffffff !important;
    color: #475569 !important;
    font-family: inherit !important;
    font-size: 10.5px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
}

.template-chip:hover,
.template-chip.active {
    color: #ffffff !important;
    border-color: #0f172a !important;
    background: #0f172a !important;
}

.templates-list {
    padding: 12px 14px !important;
    gap: 10px !important;
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto !important;
    flex: 1 !important;
}

.template-card {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 14px !important;
    border-radius: 12px !important;
    background: #ffffff !important;
    border: 1px solid rgba(226, 232, 240, 0.9) !important;
    cursor: pointer !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    overflow: hidden !important;
    text-align: left !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03) !important;
}

.template-card:hover {
    background: #ffffff !important;
    border-color: #0f172a !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.08) !important;
}

.template-preview {
    width: 78px;
    min-width: 78px;
    border-radius: 12px;
    background:
        linear-gradient(135deg,
            rgba(255, 255, 255, 0.9) 0%,
            rgba(241, 245, 249, 0.8) 100%);
    border: 1.5px solid #09090b;
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 1);
    position: relative;
    overflow: hidden;
}

.template-preview::before {
    content: "";
    position: absolute;
    left: 9px;
    top: 9px;
    width: 26px;
    height: 5px;
    border-radius: 999px;
    background: #09090b;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.template-preview span {
    position: absolute;
    left: 9px;
    right: 9px;
    height: 9px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.template-preview span:nth-child(1) {
    top: 28px;
    width: 44px;
}

.template-preview span:nth-child(2) {
    top: 44px;
    width: 56px;
}

.template-preview span:nth-child(3) {
    top: 60px;
    width: 36px;
    background: #09090b;
}

.template-info {
    min-width: 0;
    flex: 1;
    gap: 5px !important;
}

.template-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.template-category {
    color: var(--accent);
}

.template-name {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    line-height: 1.25;
}

.template-desc {
    font-size: 11px !important;
    color: #475569 !important;
    opacity: 1 !important;
    line-height: 1.4;
}

.template-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}

.template-tags em {
    font-style: normal;
    color: #475569;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 2px 7px;
    font-size: 9.5px;
    font-weight: 600;
}

.templates-empty {
    padding: 28px 16px;
    text-align: center;
    color: #64748b;
    font-size: 12px;
}

/* --- NEURAL SYNTHESIS --- */
.ai-modal-orb {
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 2px;
    animation: orb-pulse 2s infinite;
}

@keyframes orb-pulse {
    0% {
        opacity: 0.5;
        transform: scale(0.9);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }

    100% {
        opacity: 0.5;
        transform: scale(0.9);
    }
}

@keyframes neural-loading {
    0% {
        transform: translateX(-100%);
    }

    50% {
        transform: translateX(100%);
    }

    100% {
        transform: translateX(300%);
    }
}

.neural-status-text {
    animation: status-pulse 1.5s infinite;
}

@keyframes status-pulse {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.6;
    }
}

/* --- MINIMAL LIGHT UX REVAMP --- */
:root {
    --bg-base: #fafbfc;
    --bg-panel: rgba(255, 255, 255, 0.78);
    --bg-panel-solid: #ffffff;
    --bg-hover: rgba(0, 0, 0, 0.04);
    --border: rgba(226, 232, 240, 0.85);
    --border-light: rgba(203, 213, 225, 0.95);
    --accent: #0f172a;
    --accent-hover: #000000;
    --accent-glow: rgba(15, 23, 42, 0.12);
    --text-main: #0f172a;
    --text-dim: #64748b;
    --text-muted: #94a3b8;
    --sidebar-width: 280px;
    --inspector-width: 320px;
    --header-height: 56px;
}

body {
    background-color: var(--bg-base) !important;
    background-image: radial-gradient(750px circle at 50% 25%, rgba(226, 232, 240, 0.75), transparent 75%) !important;
    color: var(--text-main) !important;
    letter-spacing: -0.005em;
}

.app-background {
    display: none !important;
}

.app {
    padding: 16px 20px !important;
    gap: 14px !important;
}

.panel,
.sidebar,
.sidebar.inspector-panel {
    border-radius: 20px !important;
    background: rgba(255, 255, 255, 0.78) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.04) !important;
    border: 1px solid rgba(229, 231, 235, 0.85) !important;
    color: var(--text-main) !important;
}

.navbar {
    height: 56px !important;
    padding: 0 20px !important;
    background: rgba(255, 255, 255, 0.78) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border: 1px solid rgba(229, 231, 235, 0.85) !important;
    border-radius: 9999px !important;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.02) !important;
    color: var(--text-main) !important;
}

.navbar:hover {
    border-color: rgba(209, 213, 219, 0.95) !important;
    box-shadow: 0 8px 30px -4px rgba(0, 0, 0, 0.08), 0 4px 10px -2px rgba(0, 0, 0, 0.03) !important;
    background: rgba(255, 255, 255, 0.9) !important;
}

.navbar::after {
    display: none !important;
}

.logo-main {
    font-family: var(--font-display) !important;
    font-size: 16px !important;
    font-weight: 900 !important;
    letter-spacing: -0.03em !important;
    color: #0f172a !important;
    text-shadow: none !important;
}

.logo-sub {
    font-family: var(--font-display) !important;
    font-size: 9.5px !important;
    font-weight: 700 !important;
    letter-spacing: 0.04em !important;
    color: #64748b !important;
    background: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 9999px !important;
    padding: 2px 8px !important;
}

.insert-bar {
    display: inline-flex !important;
    align-items: center !important;
    background: rgba(15, 23, 42, 0.04) !important;
    backdrop-filter: blur(12px) !important;
    border-radius: 9999px !important;
    padding: 3px 6px !important;
    border: 1px solid rgba(226, 232, 240, 0.9) !important;
    gap: 2px !important;
    max-width: none !important;
    overflow: visible !important;
    flex-shrink: 0 !important;
}

.insert-btn {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    padding: 5px 9px !important;
    border-radius: 9999px !important;
    background: transparent !important;
    border: none !important;
    color: #475569 !important;
    font-family: inherit !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    gap: 4px !important;
    cursor: pointer !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.insert-btn:hover {
    background: #ffffff !important;
    color: #0f172a !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
    transform: translateY(-1px) !important;
}

.insert-btn svg {
    width: 14px !important;
    height: 14px !important;
    opacity: 0.85 !important;
}

.insert-btn span {
    font-size: 11.5px !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

.tool-btn,
.icon-btn,
.action-btn {
    border-radius: 9999px !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    color: #475569 !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.tool-btn:hover,
.icon-btn:hover,
.action-btn:hover {
    color: #0f172a !important;
    background: rgba(15, 23, 42, 0.05) !important;
    border-color: rgba(226, 232, 240, 0.9) !important;
    transform: translateY(-1px) !important;
}

.action-btn.primary,
.tool-btn.active {
    color: #ffffff !important;
    background: #0f172a !important;
    border-color: #0f172a !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.15) !important;
}

.action-btn.primary:hover {
    background: #000000 !important;
    border-color: #000000 !important;
}

.changelog-btn {
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 9999px !important;
    background: #ffffff !important;
    border: 1px solid rgba(226, 232, 240, 0.95) !important;
    color: #475569 !important;
    position: relative !important;
    margin-right: 2px !important;
}

.changelog-btn:hover {
    color: #0f172a !important;
    background: #f8fafc !important;
    border-color: rgba(203, 213, 225, 1) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

.panel-header {
    height: 48px !important;
    padding: 0 16px !important;
    background: transparent !important;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8) !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
}

.panel-header>span {
    color: #0f172a !important;
}

.canvas-area {
    border-radius: 20px !important;
    background-color: var(--canvas-bg, #f8fafc) !important;
    background-image: radial-gradient(rgba(148, 163, 184, 0.28) 1.2px, transparent 1.2px) !important;
    background-size: 24px 24px !important;
    border: 1px solid rgba(229, 231, 235, 0.85) !important;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.04) !important;
}

.canvas-toolbar {
    height: 44px !important;
    padding: 0 12px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border: 1px solid rgba(226, 232, 240, 0.95) !important;
    border-radius: 14px !important;
    box-sizing: border-box !important;
    width: 100% !important;
    overflow: visible !important;
    z-index: 50 !important;
    gap: 6px !important;
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-shrink: 1 !important;
    min-width: 0 !important;
}

.toolbar-label {
    font-size: 10px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
    color: #475569 !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
}

.toolbar-select,
.prop-input,
.templates-search {
    border-radius: 8px !important;
    background: #ffffff !important;
    border: 1px solid rgba(203, 213, 225, 0.95) !important;
    color: #0f172a !important;
    font-family: inherit !important;
}

.toolbar-select:focus,
.prop-input:focus,
.templates-search:focus {
    border-color: #0f172a !important;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.12) !important;
    outline: none !important;
}

.canvas-toolbar .gz-select {
    min-width: 80px !important;
    width: auto !important;
}

.canvas-toolbar .export-select {
    min-width: 118px !important;
}

.canvas-toolbar .grid-select {
    min-width: 60px !important;
}

.canvas-toolbar .gz-select-trigger {
    height: 28px !important;
    padding: 0 8px !important;
    font-size: 11px !important;
    border: 1px solid #cbd5e1 !important;
    background: #ffffff !important;
    color: #0f172a !important;
    border-radius: 8px !important;
}

.zoom-indicator {
    color: #334155 !important;
    font-size: 11px !important;
    font-weight: 700 !important;
}

.viewport {
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    border: none !important;
    overflow: visible !important;
}

.selection-info {
    bottom: 16px !important;
    background: rgba(255, 255, 255, 0.92) !important;
    backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(203, 213, 225, 0.9) !important;
    border-radius: 999px !important;
    color: #0f172a !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06) !important;
}

.explorer-search {
    padding: 12px 14px !important;
    background: transparent !important;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8) !important;
}

.explorer-search input {
    width: 100% !important;
    height: 34px !important;
    padding: 0 12px !important;
    border-radius: 8px !important;
    border: 1px solid rgba(203, 213, 225, 0.95) !important;
    background: #ffffff !important;
    color: #0f172a !important;
    font-family: inherit !important;
    font-size: 12px !important;
    outline: none !important;
}

.explorer-search input:focus {
    border-color: #0f172a !important;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.12) !important;
}

.explorer,
.properties {
    padding: 10px 12px !important;
}

.explorer-item {
    min-height: 34px !important;
    border-radius: 8px !important;
    padding: 6px 10px !important;
    color: #1e293b !important;
    font-weight: 500 !important;
}

.explorer-item:hover {
    background: rgba(15, 23, 42, 0.05) !important;
    color: #0f172a !important;
}

.explorer-item.selected {
    color: #0f172a !important;
    background: rgba(15, 23, 42, 0.07) !important;
    box-shadow: none !important;
    font-weight: 700 !important;
    border: 1px solid rgba(203, 213, 225, 0.85) !important;
    position: relative !important;
}

.explorer-item.selected::before {
    content: '' !important;
    position: absolute !important;
    left: 0 !important;
    top: 6px !important;
    bottom: 6px !important;
    width: 3px !important;
    border-radius: 0 3px 3px 0 !important;
    background: #0f172a !important;
}

.explorer-empty {
    min-height: 160px !important;
    border: 1px dashed rgba(203, 213, 225, 0.9) !important;
    border-radius: 14px !important;
    color: #64748b !important;
}

.explorer-empty strong {
    color: #1e293b !important;
    font-weight: 700 !important;
}

.prop-category {
    color: #475569 !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
}

.prop-section-header {
    background: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
    color: #0f172a !important;
    border-radius: 8px !important;
    font-weight: 800 !important;
    font-size: 11.5px !important;
    letter-spacing: 0.04em !important;
    padding: 8px 10px !important;
    margin-top: 6px !important;
}

.prop-section-header:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}

.prop-label {
    color: #334155 !important;
    font-size: 11.5px !important;
    font-weight: 600 !important;
}

.color-swatch {
    width: 20px !important;
    height: 20px !important;
    border-radius: 6px !important;
    border: 1px solid rgba(0, 0, 0, 0.2) !important;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4), 0 1px 2px rgba(0, 0, 0, 0.08) !important;
    cursor: pointer !important;
}

.color-swatch:hover {
    transform: scale(1.18) !important;
    border-color: #0f172a !important;
    z-index: 2 !important;
}

.code-drawer {
    background: rgba(255, 255, 255, 0.88) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(229, 231, 235, 0.85) !important;
    border-radius: 20px !important;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.04) !important;
}

.code-tabs {
    padding: 0 14px !important;
    border-bottom: 1px solid rgba(226, 232, 240, 0.9) !important;
    background: rgba(255, 255, 255, 0.75) !important;
    border-top-left-radius: 20px !important;
    border-top-right-radius: 20px !important;
}

.code-tab {
    padding: 10px 14px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #64748b !important;
}

.code-tab.active {
    color: #0f172a !important;
    background: rgba(15, 23, 42, 0.06) !important;
    border-bottom: 2px solid #0f172a !important;
    border-radius: 8px 8px 0 0 !important;
    box-shadow: none !important;
}

.context-menu,
.modal-content,
.shortcuts-content {
    background: rgba(255, 255, 255, 0.96) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    border: 1px solid rgba(226, 232, 240, 0.95) !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.1) !important;
    color: #0f172a !important;
}

.menu-item {
    color: #334155 !important;
    border-radius: 8px !important;
}

.menu-item:hover {
    background: rgba(15, 23, 42, 0.05) !important;
    color: #0f172a !important;
}

.sidebar-footer {
    padding: 12px 14px !important;
    background: rgba(15, 23, 42, 0.02) !important;
    border-top: 1px solid rgba(226, 232, 240, 0.7) !important;
    color: #64748b !important;
    font-size: 11px !important;
}

.sidebar-footer a {
    color: #0f172a !important;
    font-weight: 600 !important;
}

.template-card {
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.8) !important;
    border: 1px solid rgba(226, 232, 240, 0.9) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03) !important;
    color: #0f172a !important;
}

.template-card:hover {
    background: #ffffff !important;
    border-color: rgba(203, 213, 225, 1) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06) !important;
    transform: translateY(-1px) !important;
}

.template-chip {
    height: 26px !important;
    border-radius: 999px !important;
    background: rgba(15, 23, 42, 0.04) !important;
    border: 1px solid rgba(226, 232, 240, 0.9) !important;
    color: #475569 !important;
    font-weight: 600 !important;
}

.template-chip:hover,
.template-chip.active {
    color: #0f172a !important;
    border-color: #0f172a !important;
    background: rgba(15, 23, 42, 0.08) !important;
}

.template-preview {
    background: rgba(15, 23, 42, 0.04) !important;
    border: 1px solid rgba(226, 232, 240, 0.9) !important;
}

.template-preview span {
    background: rgba(15, 23, 42, 0.12) !important;
}

/* --- PREMIUM CUSTOM DROPDOWNS --- */
.gz-select {
    position: relative;
    user-select: none;
    font-size: 11px;
    font-weight: 600;
    width: 100%;
    min-width: 120px;
}

.gz-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 32px;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border);
    border-radius: 9px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.23, 1, 0.32, 1);
    color: var(--text-main);
}

.gz-select-trigger:hover {
    background: #ffffff;
    border-color: rgba(203, 213, 225, 1);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.gz-select.open .gz-select-trigger {
    border-color: var(--accent);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.gz-select-trigger::after {
    content: "";
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid var(--text-dim);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-left: 10px;
}

.gz-select.open .gz-select-trigger::after {
    transform: rotate(180deg);
    border-top-color: var(--accent);
}

.gz-select-options {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    min-width: 140px;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 12px;
    box-shadow:
        0 20px 50px rgba(15, 23, 42, 0.15),
        0 4px 12px rgba(15, 23, 42, 0.08) !important;
    z-index: 999999 !important;
    overflow: auto;
    max-height: min(280px, 45vh);
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 6px;
}

.gz-select.drop-up .gz-select-options {
    top: auto;
    bottom: calc(100% + 6px);
}

.gz-select.open .gz-select-options {
    opacity: 1 !important;
    transform: translateY(0) scale(1) !important;
    pointer-events: auto !important;
}

.gz-select-option {
    padding: 10px 12px;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2px;
}

.gz-select-option:last-child {
    margin-bottom: 0;
}

.gz-select-option:hover {
    background: rgba(15, 23, 42, 0.04);
    color: var(--text-main);
    padding-left: 16px;
}

.gz-select-option.selected {
    color: var(--accent);
    background: rgba(15, 23, 42, 0.06);
    font-weight: 700;
}

.gz-select-option.selected::after {
    content: "✓";
    font-size: 11px;
    opacity: 0.8;
}

.template-tags em {
    background: transparent;
    border-color: var(--border);
}

/* Rayfield Gen2 Adaptive Insert Bar */
#rayfieldInsertBar {
    gap: 4px;
    padding: 3px 6px;
    border-radius: 10px;
    box-shadow: 0 4px 18px rgba(0, 136, 255, 0.08);
}

#rayfieldInsertBar .insert-btn {
    border-radius: 6px;
    transition: all 0.15s ease;
    font-weight: 600;
}

#rayfieldInsertBar .insert-btn:hover {
    background: rgba(0, 136, 255, 0.12) !important;
    color: #38bdf8 !important;
    transform: translateY(-1px);
}

/* ==========================================================================
   ADVANCED RESPONSIVE SYSTEM (NO SMUDGING ON SMALL SCREENS)
   ========================================================================== */

/* Medium-Large screens (<= 1280px) */
@media (max-width: 1280px) {
    .logo-sub {
        display: none !important;
    }
    #playBtnText {
        display: none !important;
    }
    .action-btn.run-test-btn {
        padding: 0 10px !important;
    }
    .action-btn {
        padding: 0 8px !important;
    }
}

/* Medium screens (<= 1100px) */
@media (max-width: 1100px) {
    :root {
        --sidebar-width: 210px !important;
        --inspector-width: 230px !important;
    }
    .navbar {
        height: 52px !important;
        padding: 0 10px !important;
        gap: 6px !important;
    }
    .nav-left {
        gap: 3px !important;
    }
    .nav-right {
        gap: 3px !important;
    }
    .insert-btn {
        padding: 5px 8px !important;
        font-size: 11px !important;
        gap: 4px !important;
    }
    .insert-btn svg {
        width: 13px !important;
        height: 13px !important;
    }
}

/* Compact screens (<= 980px) - Shrinks insert-bar to compact icon pill */
@media (max-width: 980px) {
    .insert-btn span {
        display: none !important;
    }
    .insert-btn {
        padding: 6px 7px !important;
        border-radius: 9999px !important;
    }
    .insert-bar {
        padding: 2px 4px !important;
        gap: 2px !important;
    }
    .canvas-toolbar {
        overflow-x: auto !important;
        scrollbar-width: none !important;
        flex-wrap: nowrap !important;
    }
    .canvas-toolbar::-webkit-scrollbar {
        display: none !important;
    }
    .canvas-toolbar .toolbar-label {
        display: none !important;
    }
}

/* Small screens (<= 820px) */
@media (max-width: 820px) {
    :root {
        --sidebar-width: 180px !important;
        --inspector-width: 190px !important;
    }
    .app {
        padding: 8px 10px !important;
        gap: 8px !important;
    }
    .logo-main {
        font-size: 13px !important;
    }
    .changelog-btn {
        width: 32px !important;
        height: 32px !important;
    }
    .action-btn {
        width: 32px !important;
        height: 32px !important;
        padding: 0 !important;
        justify-content: center !important;
    }
    .insert-dropdown-tray {
        width: max-content !important;
        max-width: calc(100vw - 32px) !important;
        left: 0 !important;
        right: auto !important;
    }
}

/* Mobile / Narrow viewports (<= 640px) */
@media (max-width: 640px) {
    .nav-left .tool-btn {
        display: none !important;
    }
    .nav-right .action-btn:nth-child(2),
    .nav-right .action-btn:nth-child(3) {
        display: none !important;
    }
    .sidebar {
        display: none !important;
    }
}