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

::-webkit-scrollbar {
    width: 4px !important;
    height: 0px !important;
    background: transparent !important;
}

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

::-webkit-scrollbar-thumb {
    background: #282828 !important;
    border-radius: 4px !important;
}

::-webkit-scrollbar-thumb:hover {
    background: #3e3e3e !important;
}

* {
    scrollbar-width: thin !important;
    scrollbar-color: #282828 transparent !important;
}

:root {
    --bg-main: #191919;
    --bg-header: #141414;
    --bg-sidebar: #161616;
    --bg-bottom: #161616;
    --bg-editor: #191919;
    --bg-tab-active: #222222;
    --bg-tab-inactive: #161616;
    --bg-tab-hover: #1c1c1c;
    --bg-btn: #1c1c1c;
    --bg-btn-hover: #262626;
    --bg-btn-active: #181818;
    --border-color: #262626;
    --border-btn: #2e2e2e;
    --text-primary: #e0e0e0;
    --text-muted: #888888;
    --text-dim: #555555;
    --file-icon: #4b82e8;
}

body, html {
    width: 100%;
    height: 100%;
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 13.5px;
    overflow: hidden !important;
}

body {
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1), transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

body.app-closing {
    opacity: 0 !important;
    transform: scale(0.96) translateY(6px) !important;
}

body.app-minimizing {
    opacity: 0 !important;
    transform: scale(0.97) translateY(12px) !important;
}

#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 45%, #18181b 0%, #0d0d0f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    transform: scale(1);
    filter: blur(0px);
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), filter 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    user-select: none;
}

#splash-screen.fade-out {
    opacity: 0;
    transform: scale(1.04);
    filter: blur(8px);
    pointer-events: none;
}

.splash-bg-glow {
    position: absolute;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-color, rgba(120, 110, 255, 0.16)) 0%, transparent 70%);
    filter: blur(48px);
    pointer-events: none;
    animation: splashGlowPulse 3s ease-in-out infinite alternate;
}

@keyframes splashGlowPulse {
    0% {
        opacity: 0.45;
        transform: scale(0.9);
    }
    100% {
        opacity: 0.85;
        transform: scale(1.15);
    }
}

.splash-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    z-index: 2;
}

.splash-logo-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 106px;
    height: 106px;
}

.splash-logo-aura {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-color, rgba(140, 130, 255, 0.25)) 0%, transparent 68%);
    opacity: 0.7;
    pointer-events: none;
    animation: splashGlowPulse 2.5s ease-in-out infinite alternate;
}

.splash-logo-img {
    -webkit-user-drag: none;
    pointer-events: none;
    width: 90px;
    height: 90px;
    object-fit: contain;
    filter: drop-shadow(0 12px 30px rgba(0, 0, 0, 0.85));
    animation: splashPopUp 0.85s cubic-bezier(0.16, 1, 0.3, 1) forwards, splashFloat 3.8s ease-in-out 0.85s infinite alternate;
}

@keyframes splashPopUp {
    0% {
        opacity: 0;
        transform: scale(0.4) translateY(10px);
    }
    60% {
        opacity: 1;
        transform: scale(1.06) translateY(-2px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes splashFloat {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(-5px);
    }
}

.splash-brand-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.splash-brand {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 5px;
    color: var(--text-primary, #ffffff);
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7);
}

.splash-loader-bar {
    width: 220px;
    height: 4px;
    background-color: rgba(255, 255, 255, 0.06);
    border-radius: 99px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.04);
    margin-top: 6px;
}

.splash-loader-progress {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-color, #786eff), #9d7aff);
    border-radius: 99px;
    transition: width 0.12s cubic-bezier(0.2, 0.8, 0.2, 1);
    position: relative;
    box-shadow: 0 0 10px var(--accent-color, rgba(120, 110, 255, 0.5));
}

.splash-progress-shimmer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.45) 50%, transparent 100%);
    animation: splashShimmer 1.5s infinite;
}

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

.splash-status-text {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted, #8b8b96);
    letter-spacing: 0.4px;
    min-height: 16px;
    text-align: center;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Light Theme overrides for Splash Screen */
body.theme-light #splash-screen {
    background: radial-gradient(circle at 50% 45%, #f8f9fc 0%, #ebedf3 100%) !important;
}

body.theme-light .splash-bg-glow {
    background: radial-gradient(circle, var(--accent-color, rgba(99, 102, 241, 0.18)) 0%, transparent 70%);
}

body.theme-light .splash-logo-aura {
    background: radial-gradient(circle, var(--accent-color, rgba(99, 102, 241, 0.2)) 0%, transparent 68%);
}

body.theme-light .splash-logo-img {
    filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.14));
}

body.theme-light .splash-brand {
    color: #1e232d !important;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

body.theme-light .splash-loader-bar {
    background-color: rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

body.theme-light .splash-status-text {
    color: #475569 !important;
    font-weight: 600;
}

#app-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background-color: var(--bg-main);
    position: relative;
    overflow: hidden !important;
    border: 1px solid var(--border-color, #262626);
    box-sizing: border-box;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

#titlebar {
    height: 34px;
    background-color: var(--bg-header);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left: 14px;
    cursor: default;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.05));
    position: relative;
}

.title-text {
    font-size: 13px;
    font-weight: 500;
    color: #999999;
    letter-spacing: 0.3px;
    pointer-events: none;
}

.titlebar-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.titlebar-pill-menu {
    display: flex;
    align-items: center;
    background: var(--bg-btn, rgba(28, 28, 32, 0.85));
    border: 1px solid var(--border-btn, rgba(255, 255, 255, 0.08));
    border-radius: 20px;
    padding: 2px 4px;
    gap: 3px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.titlebar-pill-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 6px;
    height: 24px;
    background: transparent;
    border: none;
    border-radius: 14px;
    color: var(--text-primary, #9999a4);
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease, padding 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.12s ease;
}

.titlebar-pill-btn svg {
    color: currentColor;
    flex-shrink: 0;
    display: block;
}

.titlebar-pill-btn span {
    max-width: 0;
    opacity: 0;
    margin-left: 0;
    overflow: hidden;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
    transition: max-width 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s ease, margin-left 0.22s ease;
    pointer-events: none;
}

.titlebar-pill-btn:hover {
    background-color: var(--bg-btn-hover, rgba(255, 255, 255, 0.12));
    color: #ffffff;
    padding: 3px 10px;
}

.titlebar-pill-btn:hover span {
    max-width: 80px;
    opacity: 1;
    margin-left: 6px;
}

.titlebar-pill-btn:active {
    background-color: rgba(255, 255, 255, 0.14);
    transform: scale(0.96);
}

.titlebar-pill-sep {
    width: 1px;
    height: 12px;
    background: rgba(255, 255, 255, 0.12);
}

.window-controls {
    display: flex;
    height: 100%;
    z-index: 11;
}

.win-btn {
    width: 46px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #888888;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

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

.win-btn.close:hover {
    background-color: #e81123;
    color: #ffffff;
}

#tabbar-container {
    height: 40px;
    background-color: var(--bg-header);
    display: flex;
    align-items: center;
    padding: 0 10px;
    gap: 6px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.05));
    cursor: default;
    overflow: hidden;
}

.tabs-list {
    display: flex;
    /* Basis 0 makes the strip shrink instead of pushing the add button out of
       the bar; without it the button is what got clipped. */
    flex: 1 1 0;
    min-width: 0;
    align-items: center;
    gap: 6px;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.tabs-list::-webkit-scrollbar {
    height: 4px;
}

.tabs-list::-webkit-scrollbar-track {
    background: transparent;
}

.tabs-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.16);
    border-radius: 2px;
}

.tabs-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Tabs keep their intrinsic width while the strip scrolls, and the add button
   never shrinks or scrolls away with them. */
.tabs-list .tab-item {
    flex: 0 0 auto;
}

#tabbar-container .tab-add-btn {
    flex: 0 0 auto;
}

.tab-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background-color: var(--bg-tab-inactive);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 13px;
    height: 30px;
    max-width: 170px;
    border: 1px solid transparent;
    overflow: hidden;
    /* padding/margin belong here or the closing collapse snaps: only properties
       listed in a transition animate. */
    transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                max-width 0.22s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.18s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.22s cubic-bezier(0.4, 0, 0.2, 1),
                margin 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-item:hover {
    background-color: var(--bg-tab-hover);
    color: #b8b8b8;
}

.tab-item.active {
    background-color: var(--bg-tab-active);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.07);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.tab-item.tab-enter {
    animation: tabPopIn 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.tab-item.tab-closing {
    max-width: 0px !important;
    opacity: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border-color: transparent !important;
    overflow: hidden !important;
}

/* Cheap GPU-only easing: opacity plus transforms, so the tab eases in without
   animating layout on every frame. */
@keyframes tabPopIn {
    0% { opacity: 0; transform: translateX(-8px) scale(0.94); }
    60% { opacity: 1; }
    100% { opacity: 1; transform: translateX(0) scale(1); }
}

.tab-icon {
    display: flex;
    align-items: center;
    color: #999999;
}

.tab-item.active .tab-icon {
    color: #ffffff;
}

.tab-title {
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

.tab-rename-input {
    background: #141418;
    border: 1px solid #3e3e50;
    border-radius: 4px;
    color: #ffffff;
    font-size: 12.5px;
    padding: 2px 6px;
    min-width: 80px;
    outline: none;
    font-family: inherit;
    cursor: text !important;
    caret-color: #ffffff;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
    transition: border-color 0.18s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.18s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.08s ease-out;
}

.tab-rename-input:focus {
    border-color: #606078;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18);
}

.tab-close {
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 3px;
    color: #777780;
    margin-left: 5px;
    cursor: pointer !important;
    transition: background-color 0.12s ease, color 0.12s ease, transform 0.1s ease;
    opacity: 0.6;
}

.tab-item:hover .tab-close {
    opacity: 0.85;
}

.tab-close:hover {
    background-color: rgba(255, 255, 255, 0.14) !important;
    color: #ffffff !important;
    opacity: 1 !important;
}

.tab-close:active {
    transform: scale(0.9);
}

.tab-close svg {
    display: block;
    pointer-events: none;
}

.tab-add-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    border: none;
    border-radius: 6px;
    color: #777777;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-add-btn:hover {
    background-color: var(--bg-tab-hover);
    color: #ffffff;
    transform: scale(1.05);
}

.tab-add-btn:active {
    transform: scale(0.95);
}

#main-content {
    display: flex;
    flex: 1;
    overflow: hidden !important;
    position: relative;
}

#editor-container {
    flex: 1;
    display: flex;
    background-color: var(--bg-editor);
    overflow: hidden !important;
    position: relative;
}

#editor {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    font-family: "Consolas", "Cascadia Code", "Fira Code", monospace;
    background-color: var(--bg-editor) !important;
}

#editor.anim-switch {
    animation: editorFadeIn 0.2s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes editorFadeIn {
    0% { opacity: 0.35; transform: translateY(3px); }
    100% { opacity: 1; transform: translateY(0); }
}

.ace_editor {
    background-color: var(--bg-editor) !important;
    color: var(--text-primary) !important;
}

.ace_gutter {
    background-color: var(--bg-sidebar) !important;
    color: #4a4a4a !important;
    border-right: 1px solid rgba(255, 255, 255, 0.03) !important;
}

.ace_gutter-active-line {
    background-color: rgba(255, 255, 255, 0.03) !important;
    color: #cccccc !important;
}

.ace_active-line {
    background-color: rgba(255, 255, 255, 0.025) !important;
}

.ace_cursor {
    color: #ffffff !important;
}

.ace_scrollbar-v, .ace_scrollbar-h {
    scrollbar-width: thin !important;
    scrollbar-color: #282828 transparent !important;
}

.ace_scrollbar-h {
    height: 0px !important;
    display: none !important;
}

/* GitHub Dark Luau Syntax Highlighting */
body:not(.theme-light) .ace_keyword { color: #ff7b72 !important; font-weight: 500; }
body:not(.theme-light) .ace_keyword.ace_operator { color: #ff7b72 !important; font-weight: normal; }
body:not(.theme-light) .ace_storage.ace_type, body:not(.theme-light) .ace_support.ace_type { color: #ff7b72 !important; font-weight: 500; }
body:not(.theme-light) .ace_support.ace_function, body:not(.theme-light) .ace_entity.ace_name.ace_function { color: #d2a8ff !important; }
body:not(.theme-light) .ace_string, body:not(.theme-light) .ace_string.ace_start, body:not(.theme-light) .ace_string.ace_end { color: #a5d6ff !important; }
body:not(.theme-light) .ace_comment { color: #8b949e !important; font-style: italic !important; }
body:not(.theme-light) .ace_constant.ace_numeric { color: #79c0ff !important; }
body:not(.theme-light) .ace_constant.ace_language { color: #79c0ff !important; font-weight: 500; }
body:not(.theme-light) .ace_constant.ace_library { color: #79c0ff !important; }
body:not(.theme-light) .ace_variable { color: #c9d1d9 !important; }
body:not(.theme-light) .ace_variable.ace_language { color: #79c0ff !important; }
body:not(.theme-light) .ace_variable.ace_parameter { color: #ffa657 !important; }
body:not(.theme-light) .ace_paren.ace_lparen, body:not(.theme-light) .ace_paren.ace_rparen { color: #c9d1d9 !important; }

/* Light Theme High-Contrast Luau Syntax Highlighting */
body.theme-light .ace_editor, body.theme-light .ace_text-layer { color: #1e293b !important; }
body.theme-light .ace_keyword { color: #cf222e !important; font-weight: 600; }
body.theme-light .ace_keyword.ace_operator { color: #0969da !important; font-weight: 600; }
body.theme-light .ace_storage.ace_type, body.theme-light .ace_support.ace_type { color: #cf222e !important; font-weight: 600; }
body.theme-light .ace_support.ace_function, body.theme-light .ace_entity.ace_name.ace_function { color: #8250df !important; font-weight: 600; }
body.theme-light .ace_string, body.theme-light .ace_string.ace_start, body.theme-light .ace_string.ace_end { color: #0550ae !important; font-weight: 500; }
body.theme-light .ace_comment { color: #57606a !important; font-style: italic !important; }
body.theme-light .ace_constant.ace_numeric { color: #0969da !important; font-weight: 500; }
body.theme-light .ace_constant.ace_language { color: #0969da !important; font-weight: 600; }
body.theme-light .ace_constant.ace_library { color: #0550ae !important; font-weight: 600; }
body.theme-light .ace_variable { color: #1f2328 !important; }
body.theme-light .ace_variable.ace_language { color: #0969da !important; font-weight: 600; }
body.theme-light .ace_variable.ace_parameter { color: #953800 !important; }
body.theme-light .ace_paren.ace_lparen, body.theme-light .ace_paren.ace_rparen { color: #1f2328 !important; }
body.theme-light .ace_cursor { color: #0f172a !important; }

#sidebar {
    width: 240px;
    background-color: var(--bg-sidebar);
    border-left: 1px solid var(--border-color, rgba(255, 255, 255, 0.04));
    display: flex;
    flex-direction: column;
    padding: 10px;
    flex-shrink: 0;
    overflow: hidden !important;
}

.search-box {
    display: flex;
    align-items: center;
    background-color: var(--bg-btn, #1f1f1f);
    border: 1px solid var(--border-btn, #282828);
    border-radius: 6px;
    padding: 6px 10px;
    gap: 8px;
    margin-bottom: 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    flex-shrink: 0;
}

.search-box:focus-within {
    border-color: var(--border-btn, #3e3e3e);
    box-shadow: 0 0 0 1px var(--border-btn, #3e3e3e);
}

.search-icon {
    display: flex;
    align-items: center;
    color: var(--text-muted, #666666);
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    min-width: 0;
}

.search-input::placeholder {
    color: #555555;
}

.scripts-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: 1;
}

.script-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 6px;
    cursor: pointer;
    color: #cccccc;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.script-item:hover {
    background-color: #202020;
    color: #ffffff;
}

.script-item:active {
    background-color: #1a1a1a;
}

.script-item-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.script-item-name {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.workspace-toolbar {
    flex-shrink: 0;
    margin: 0 1px 8px;
}

.workspace-title {
    color: var(--text-primary, #ddd);
    font-size: 12px;
    font-weight: 650;
    letter-spacing: .03em;
    margin-bottom: 7px;
    cursor: pointer;
}

#workspace-count { color: var(--text-muted, #888); font-weight: 400; }
.workspace-tools { display: flex; gap: 5px; }
.workspace-tools button,
.workspace-editor button,
.workspace-editor input,
.workspace-editor select {
    background: var(--bg-btn, #24242c);
    color: var(--text-primary, #ddd);
    border: 1px solid var(--border-btn, #373741);
    border-radius: 5px;
    font: inherit;
}
.workspace-tools button {
    font-size: 11px;
    padding: 5px 7px;
    cursor: pointer;
}
.workspace-tools button:last-child { margin-left: auto; font-size: 15px; line-height: 10px; }
.workspace-tools button:hover,
.workspace-editor button:hover { background: var(--bg-btn-hover, #30303b); }
.workspace-editor {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 9px;
    margin-bottom: 8px;
    border: 1px solid var(--border-btn, #373741);
    border-radius: 7px;
    background: var(--bg-btn, #202028);
}
.workspace-editor[hidden] { display: none; }
.workspace-editor-title { font-size: 12px; font-weight: 650; }
.workspace-editor-parent { font-size: 11px; color: var(--text-muted, #999); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-editor input,
.workspace-editor select { min-width: 0; width: 100%; box-sizing: border-box; padding: 6px; font-size: 12px; }
.workspace-editor-actions { display: flex; justify-content: flex-end; gap: 6px; }
.workspace-editor-actions button { padding: 5px 8px; font-size: 11px; cursor: pointer; }
#workspace-confirm { color: #fff; border-color: var(--file-icon, #4b82e8); background: var(--file-icon, #4b82e8); }
.workspace-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 0 5px;
    box-sizing: border-box;
    border-radius: 5px;
    color: var(--text-primary, #ccc);
    font-size: 12px;
    cursor: pointer;
    user-select: none;
}
.workspace-row:hover,
.workspace-row.selected { background: var(--bg-tab-hover, #292933); }
.workspace-row .workspace-caret { width: 10px; color: var(--text-muted, #888); flex-shrink: 0; text-align: center; }
.workspace-row .workspace-icon { width: 14px; flex-shrink: 0; display: flex; color: var(--file-icon, #8baafa); }
.workspace-row.folder .workspace-icon { color: #d9b76c; }
.workspace-row.place .workspace-icon { color: #81c7ad; }
.workspace-row .workspace-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.workspace-row .workspace-more { opacity: 0; border: 0; background: transparent; color: var(--text-muted, #aaa); cursor: pointer; padding: 3px 5px; }
.workspace-row:hover .workspace-more,
.workspace-row .workspace-more:focus { opacity: 1; }
.workspace-empty { padding: 13px 7px; font-size: 12px; line-height: 1.4; color: var(--text-muted, #999); }
.workspace-context-menu {
    position: fixed;
    z-index: 10000;
    min-width: 142px;
    display: none;
    flex-direction: column;
    padding: 4px;
    border-radius: 7px;
    border: 1px solid var(--border-btn, #373741);
    background: var(--bg-sidebar, #1c1c20);
    box-shadow: 0 10px 26px rgba(0,0,0,.5);
}
.workspace-context-menu.show { display: flex; }
.workspace-context-menu button { text-align: left; background: transparent; color: var(--text-primary, #ddd); border: 0; border-radius: 4px; padding: 7px 9px; font: inherit; font-size: 12px; cursor: pointer; }
.workspace-context-menu button:hover { background: var(--bg-tab-hover, #292933); }
.workspace-context-menu button.danger:hover { color: #ff7070; background: rgba(239,68,68,.12); }

#bottombar {
    height: 48px;
    background-color: var(--bg-bottom);
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.04));
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 14px;
    flex-shrink: 0;
}

.bottom-left, .bottom-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.telemetry-tag {
    font-size: 11.5px;
    font-family: monospace;
    color: #666666;
    margin-left: 12px;
    pointer-events: none;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background-color: var(--bg-btn);
    border: 1px solid var(--border-btn);
    border-radius: 6px;
    color: #cccccc;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-btn:hover {
    background-color: var(--bg-btn-hover);
    border-color: var(--border-btn);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
}

.action-btn:active {
    transform: translateY(0px) scale(0.98);
    background-color: var(--bg-btn-active);
}

.action-btn.icon-only {
    padding: 6px 9px;
}

.action-btn.attached {
    color: #ffffff;
    border-color: var(--file-icon, #4b82e8);
    background-color: color-mix(in srgb, var(--file-icon, #4b82e8) 22%, var(--bg-btn));
}

.action-btn.attached:hover {
    border-color: var(--file-icon, #4b82e8);
    background-color: color-mix(in srgb, var(--file-icon, #4b82e8) 32%, var(--bg-btn-hover));
}

.action-btn.injecting {
    color: #ffaa00;
    border-color: #ffaa00;
    background-color: rgba(255, 170, 0, 0.1);
    animation: injectPulse 1.2s infinite ease-in-out;
    pointer-events: none;
}

@keyframes injectPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.98); }
}

#settings-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

#settings-modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.settings-modal {
    width: 380px;
    background: #1c1c1f;
    border: 1px solid #2e2e36;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.2s cubic-bezier(0.34, 1.4, 0.64, 1);
}

#settings-modal-overlay.show .settings-modal {
    transform: scale(1);
}

.settings-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #282830;
    background: #18181b;
}

.settings-title {
    font-size: 13.5px;
    font-weight: 600;
    color: #e0e0e0;
}

.settings-close-btn {
    background: transparent;
    border: none;
    color: #777777;
    cursor: pointer;
    display: flex;
    align-items: center;
    border-radius: 4px;
    padding: 2px;
    transition: color 0.15s ease;
}

.settings-close-btn:hover {
    color: #ffffff;
}

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

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.setting-label {
    font-size: 13px;
    color: #cccccc;
}

.setting-toggle {
    width: 36px;
    height: 20px;
    background: #2a2a30;
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    transition: background 0.2s ease;
}

.setting-toggle::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #888888;
    border-radius: 50%;
    transition: transform 0.2s ease, background 0.2s ease;
}

.setting-toggle.on {
    background: #444450;
}

.setting-toggle.on::after {
    transform: translateX(16px);
    background: #ffffff;
}

.setting-select {
    background: #24242a;
    border: 1px solid #33333e;
    color: #e0e0e0;
    padding: 4px 8px;
    border-radius: 4px;
    outline: none;
    font-size: 12.5px;
}

#toast {
    position: fixed;
    bottom: 60px;
    left: 20px;
    background-color: #222222;
    border: 1px solid #333333;
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 12.5px;
    color: #e0e0e0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 100;
}

#toast.show {
    opacity: 1;
    transform: translateY(0);
}

.ace_cursor {
    transition: transform 0.06s ease-out, top 0.06s ease-out, left 0.06s ease-out !important;
}

.search-input {
    transition: border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.tab-rename-input {
    transition: width 0.18s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.18s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.18s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1) !important;
}

#tab-context-menu {
    position: fixed;
    background: #18181c;
    border: 1px solid #2e2e38;
    border-radius: 6px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.75);
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 9999;
    min-width: 145px;
    backdrop-filter: blur(12px);
    pointer-events: none;
    opacity: 0;
    transform: scale(0.9) translateY(-6px);
    transform-origin: top left;
    transition: opacity 0.16s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.16s cubic-bezier(0.16, 1, 0.3, 1);
}

#tab-context-menu.show {
    pointer-events: auto;
    opacity: 1;
    transform: scale(1) translateY(0);
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    font-size: 12.5px;
    color: #cccccc;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.context-menu-item:hover {
    background-color: #24242e;
    color: #ffffff;
}

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

.context-menu-item .ctx-check {
    margin-left: auto;
    opacity: 0;
    color: #7b88ff;
    transition: opacity 0.12s ease;
}

.context-menu-item.checked .ctx-check {
    opacity: 1;
}

#ctx-tab-autoexec {
    margin: 2px 0;
    padding: 8px 9px;
    border: 1px solid rgba(123, 136, 255, 0.22);
    background: rgba(123, 136, 255, 0.08);
    color: #d9ddff;
    font-weight: 500;
}

#ctx-tab-autoexec > svg:first-child {
    width: 14px;
    height: 14px;
    color: #aab2ff;
}

#ctx-tab-autoexec:hover:not(.unavailable),
#ctx-tab-autoexec.checked {
    background: rgba(123, 136, 255, 0.17);
    border-color: rgba(123, 136, 255, 0.46);
    color: #ffffff;
}

#ctx-tab-autoexec.unavailable {
    background: rgba(126, 126, 143, 0.045);
    border-color: rgba(126, 126, 143, 0.13);
    color: #777782;
}

#ctx-tab-autoexec.unavailable > svg:first-child {
    color: #777782;
}

#ctx-tab-autoexec.unavailable:hover {
    background: rgba(126, 126, 143, 0.1);
    color: #a5a5b1;
}

#ctx-tab-autoexec.unavailable::after {
    content: '\2197';
    margin-left: auto;
    color: #777782;
}

.tab-item.autoexec .tab-title::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #7b88ff;
    margin-right: 6px;
    vertical-align: middle;
}

.tab-item.autoexec-paused .tab-title::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #73737e;
    margin-right: 6px;
    vertical-align: middle;
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button,
.fps-input::-webkit-inner-spin-button,
.fps-input::-webkit-outer-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
    display: none !important;
}
input[type=number], .fps-input {
    -moz-appearance: textfield !important;
    appearance: none !important;
}

.tab-effect-slide {
    animation: tabSlideIn 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes tabSlideIn {
    0% { opacity: 0.75; transform: translateX(6px); }
    100% { opacity: 1; transform: translateX(0); }
}

.tab-effect-fade {
    animation: tabFadeIn 0.15s ease-out forwards;
}
@keyframes tabFadeIn {
    0% { opacity: 0.6; }
    100% { opacity: 1; }
}

.tab-effect-pop {
    animation: tabPopEffect 0.18s cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
}
@keyframes tabPopEffect {
    0% { opacity: 0.75; transform: scale(0.98); }
    100% { opacity: 1; transform: scale(1); }
}

.tab-effect-windhawk {
    animation: tabWindhawkSlide 0.28s cubic-bezier(0.14, 1.15, 0.32, 1) forwards;
}
@keyframes tabWindhawkSlide {
    0% { opacity: 0.45; transform: translateX(14px) scale(0.985); }
    100% { opacity: 1; transform: translateX(0) scale(1); }
}

body.btn-feedback-lift .action-btn:hover,
body.btn-feedback-lift .preset-btn:hover {
    transform: translateY(-1.5px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

body.btn-feedback-glow .action-btn:hover,
body.btn-feedback-glow .preset-btn:hover {
    border-color: #666680 !important;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.12) !important;
}

body.btn-feedback-windhawk .action-btn:hover,
body.btn-feedback-windhawk .preset-btn:hover,
body.btn-feedback-windhawk .titlebar-pill-btn:hover,
body.btn-feedback-windhawk .tab-item:hover,
body.btn-feedback-windhawk .scripthub-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.45), 0 0 10px rgba(75, 130, 232, 0.25) !important;
    transition: transform 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.22s ease !important;
}

body.btn-feedback-windhawk .action-btn:active,
body.btn-feedback-windhawk .preset-btn:active,
body.btn-feedback-windhawk .titlebar-pill-btn:active,
body.btn-feedback-windhawk .tab-item:active,
body.btn-feedback-windhawk .scripthub-btn:active {
    transform: scale(0.95) !important;
    transition: transform 0.08s ease !important;
}

/* Windhawk Context Menu Flyout */
.tab-context-menu.windhawk-flyout,
.context-menu.windhawk-flyout {
    animation: windhawkFlyout 0.22s cubic-bezier(0.14, 1.25, 0.32, 1) forwards !important;
}
@keyframes windhawkFlyout {
    0% { opacity: 0; transform: translateY(-8px) scale(0.92); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Windhawk Ultra-Fluid Caret Glide */
body.caret-style-windhawk-glide .ace_editor .ace_cursor {
    border-left: 2.2px solid #58a6ff !important;
    box-shadow: 0 0 8px rgba(88, 166, 255, 0.6) !important;
    outline: none !important;
    transition: left 0.085s cubic-bezier(0.16, 1, 0.3, 1),
                top 0.085s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.2s ease !important;
    will-change: left, top;
    animation: caretWindhawkPulse 1.2s ease-in-out infinite !important;
}
@keyframes caretWindhawkPulse {
    0%, 100% { opacity: 1; filter: drop-shadow(0 0 4px #58a6ff); }
    50% { opacity: 0.25; filter: none; }
}

.ace_editor .ace_cursor {
    border-left: 2px solid #ffffff !important;
    box-shadow: none !important;
    outline: none !important;
    transition: left 0.06s cubic-bezier(0.1, 0.9, 0.2, 1),
                top 0.06s cubic-bezier(0.1, 0.9, 0.2, 1),
                opacity 0.15s ease !important;
    will-change: left, top;
}

.ace_editor .ace_marker-layer .ace_active-line {
    background: rgba(255, 255, 255, 0.04) !important;
    transition: top 0.07s cubic-bezier(0.1, 0.9, 0.2, 1), height 0.07s cubic-bezier(0.1, 0.9, 0.2, 1) !important;
}

.ace_editor, .ace_text-layer {
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
    text-rendering: optimizeLegibility !important;
}

.setting-status-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-sidebar, #141416);
    border: 1px solid var(--border-color, #232328);
    border-radius: 6px;
    margin-bottom: 12px;
}

.status-indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #555566;
    flex-shrink: 0;
    transition: background 0.2s, box-shadow 0.2s;
}

.status-indicator-dot.on {
    background: #ffffff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

.engine-slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.engine-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 999px;
    background: var(--bg-btn, #25252c);
    outline: none;
    cursor: pointer;
    overflow: visible;
    transition: background 0.15s;
}

.engine-slider::-webkit-slider-container {
    overflow: visible;
}

.engine-slider::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 999px;
    background: var(--bg-btn, #25252c);
}

.engine-slider::-webkit-slider-thumb {
    -webkit-appearance: none !important;
    appearance: none !important;
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    min-height: 16px !important;
    max-width: 16px !important;
    max-height: 16px !important;
    margin-top: -5px !important;
    border: none !important;
    background: radial-gradient(circle, #ffffff 68%, transparent 72%) !important;
    border-radius: 50% !important;
    box-shadow: none !important;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.engine-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    background: radial-gradient(circle, #e0e0e0 68%, transparent 72%) !important;
    box-shadow: none !important;
}

.engine-val-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    background: var(--bg-btn, #18181c);
    border: 1px solid var(--border-btn, #282830);
    border-radius: 4px;
    font-size: 11.5px;
    color: #9999aa;
}

.engine-num-input {
    width: 50px;
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    text-align: right;
}

.engine-num-input::-webkit-outer-spin-button,
.engine-num-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.fps-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fps-input-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-btn, #141418);
    border: 1px solid var(--border-btn, #282834);
    border-radius: 5px;
    padding: 3px 10px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.fps-input-pill:hover {
    border-color: var(--border-btn, #3e3e50);
    background: var(--bg-btn-hover, #181820);
}

.fps-input-pill:focus-within {
    border-color: var(--border-btn, #777790);
    background: var(--bg-btn-hover, #1a1a22);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.05);
}

.fps-num-input {
    width: 46px;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    color: #ffffff !important;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    text-align: right;
    letter-spacing: 0.5px;
    padding: 0;
    margin: 0;
}

.fps-num-input::-webkit-inner-spin-button,
.fps-num-input::-webkit-outer-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
    display: none !important;
}

.fps-unit-tag {
    font-size: 11px;
    font-weight: 600;
    color: #727284;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    user-select: none;
}

.fps-apply-btn {
    background: var(--bg-btn, #24242c);
    border: 1px solid var(--border-btn, #363644);
    border-radius: 5px;
    color: var(--text-primary, #f0f0f5);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 13px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.fps-apply-btn:hover {
    background: var(--bg-btn-hover, #2e2e3a);
    border-color: var(--border-btn, #55556a);
    color: #ffffff;
    transform: translateY(-1px);
}

.fps-apply-btn:active {
    transform: translateY(0);
    background: var(--bg-btn-active, #1e1e26);
}

/* User Profile Avatar Badge */
.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    border-radius: 8px;
    padding: 3px 10px 3px 4px;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    cursor: default;
}

.user-profile-badge:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.user-profile-badge.hidden {
    display: none !important;
}

.user-avatar-wrap {
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: visible;
}

.user-avatar-img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #18181f;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: block;
}

.user-avatar-status-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    border: 1.5px solid #141419;
    box-shadow: 0 0 6px #22c55e;
}

.user-profile-meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.15;
}

.user-display-name {
    font-size: 12px;
    font-weight: 600;
    color: #f1f1f5;
    letter-spacing: -0.2px;
}

.user-sub-info {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: #8c8c9e;
}

.user-username {
    color: #a0a0b2;
}

.user-dot-sep {
    font-size: 8px;
    opacity: 0.6;
}

.user-place-id {
    color: #38bdf8;
    font-weight: 500;
}

/* Console Drawer */
.console-drawer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 190px;
    background: var(--bg-editor, #191919);
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    display: flex;
    flex-direction: column;
    z-index: 20;
    transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s ease, background-color 0.2s ease;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.45);
}

.console-drawer.collapsed {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

.console-resize-handle {
    position: absolute;
    top: -3px;
    left: 0;
    right: 0;
    height: 7px;
    cursor: ns-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    touch-action: none;
}

.console-resize-handle span {
    width: 42px;
    height: 3px;
    border-radius: 2px;
    background: var(--border-color, rgba(255, 255, 255, 0.14));
    transition: background-color 0.15s ease;
}

.console-resize-handle:hover span,
.console-drawer.resizing .console-resize-handle span {
    background: var(--file-icon, #38bdf8);
}

.console-drawer.resizing {
    transition: none;
    user-select: none;
}

.console-drawer-header {
    height: 28px;
    background: var(--bg-header, #141414);
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.06));
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    user-select: none;
    flex-shrink: 0;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.console-drawer-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-primary, #e2e8f0);
    letter-spacing: 0.2px;
}

.console-drawer-title svg {
    color: var(--file-icon, #38bdf8);
}

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

.console-drawer-btn {
    background: var(--bg-btn, rgba(255, 255, 255, 0.05));
    border: 1px solid var(--border-btn, transparent);
    color: var(--text-primary, #94a3b8);
    font-size: 11px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.console-drawer-btn:hover {
    background: var(--bg-btn-hover, rgba(255, 255, 255, 0.12));
    color: #ffffff;
}

.console-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    font-family: "Consolas", "Cascadia Code", "Fira Code", monospace;
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--text-primary, #cbd5e1);
    background: var(--bg-editor, #191919);
    user-select: text;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.console-line {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 1px 0;
    word-break: break-all;
}

.console-line .console-time {
    color: #64748b;
    font-size: 10.5px;
    flex-shrink: 0;
}

.console-line .console-badge {
    font-weight: 700;
    flex-shrink: 0;
}

.console-line.info .console-badge { color: #38bdf8; }
.console-line.step .console-badge { color: #f59e0b; }
.console-line.ok .console-badge { color: #10b981; }
.console-line.success .console-badge { color: #22c55e; font-weight: bold; }
.console-line.error .console-badge { color: #ef4444; font-weight: bold; }
.console-line.error { color: #fca5a5; }

/* Autocomplete Popup */
.editor-autocomplete-dropdown {
    position: fixed;
    z-index: 10000;
    background: #18181c;
    border: 1px solid rgba(86, 156, 214, 0.45);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
    border-radius: 6px;
    min-width: 250px;
    max-width: 380px;
    max-height: 230px;
    overflow-y: auto;
    display: none;
    font-family: "Consolas", "Cascadia Code", monospace;
    font-size: 12.5px;
    padding: 4px 0;
}

.editor-autocomplete-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 10px;
    color: #d4d4d4;
    cursor: pointer;
    user-select: none;
    gap: 8px;
}

.editor-autocomplete-item:hover,
.editor-autocomplete-item.selected {
    background: rgba(86, 156, 214, 0.25);
    color: #ffffff;
}

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

.editor-autocomplete-item .ac-badge {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.08);
    color: #8bb8e8;
    text-transform: uppercase;
}

/* ---- Floating Draggable Mini Music Player (Thorium Style) ---- */
.music-player-widget {
    position: fixed;
    bottom: 45px;
    right: 25px;
    width: 310px;
    background: var(--bg-sidebar, #16181d);
    backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 0 0 24px rgba(0, 0, 0, 0.2);
    z-index: 600;
    overflow: hidden;
    user-select: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text-primary, #e0e0e4);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.music-player-widget.dragging {
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.8), 0 0 32px rgba(0, 0, 0, 0.35);
    opacity: 0.96;
}

.mp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    background: var(--bg-header, rgba(255, 255, 255, 0.03));
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.06));
    cursor: grab;
}

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

.mp-header-left {
    display: flex;
    align-items: center;
    gap: 7px;
}

.mp-title {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-primary, #e0e0e4);
    letter-spacing: 0.3px;
}

.mp-badge {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 1px 6px;
    border-radius: 10px;
    background: var(--bg-btn, rgba(255, 255, 255, 0.08));
    color: var(--file-icon, #38bdf8);
    border: 1px solid var(--border-btn, rgba(255, 255, 255, 0.15));
}

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

.mp-btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted, #888894);
    cursor: pointer;
    padding: 3px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, background 0.15s ease;
}

.mp-btn-icon:hover {
    color: var(--text-primary, #ffffff);
    background: var(--bg-btn-hover, rgba(255, 255, 255, 0.08));
}

.mp-btn-icon.close:hover {
    color: #ff5c5c;
    background: rgba(255, 92, 92, 0.15);
}

.mp-content {
    padding: 12px 14px 14px;
}

.mp-track-info-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.mp-cover-art {
    width: 46px;
    height: 46px;
    border-radius: 8px;
    background: var(--bg-main, #121214);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--file-icon, #38bdf8);
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.mp-cover-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.mp-vinyl-disk {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, #242428 15%, #101012 30%, #1e1e24 55%, #0e0e10 70%);
    display: none;
    animation: rotateVinyl 4s linear infinite;
}

.mp-cover-art.playing .mp-vinyl-disk {
    display: block;
}

.mp-cover-art.playing .mp-cover-icon {
    display: none;
}

.mp-vinyl-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--file-icon, #38bdf8);
    border: 2px solid #000;
}

@keyframes rotateVinyl {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.mp-details {
    overflow: hidden;
    flex: 1;
}

.mp-track-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #ffffff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.mp-artist-name {
    font-size: 11px;
    color: var(--text-muted, #8c8c9a);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.mp-progress-container {
    margin-bottom: 10px;
}

.mp-progress-bar-bg {
    width: 100%;
    height: 4px;
    background: var(--border-color, rgba(255, 255, 255, 0.12));
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    transition: height 0.12s ease;
}

.mp-progress-bar-bg:hover {
    height: 6px;
}

.mp-progress-bar-fill {
    height: 100%;
    background: var(--file-icon, #38bdf8);
    border-radius: 4px;
    transition: width 0.1s linear;
}

.mp-progress-bar-bg:hover .mp-progress-thumb {
    opacity: 1;
}

.mp-progress-thumb {
    position: absolute;
    top: 50%;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-primary, #ffffff);
    transform: translate(-50%, -50%);
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.mp-time-row {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-dim, #727280);
    margin-top: 4px;
    font-family: 'JetBrains Mono', Consolas, monospace;
}

.mp-controls-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.mp-btn-ctrl {
    background: transparent;
    border: none;
    color: var(--text-muted, #9898a6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 50%;
    transition: color 0.15s ease, transform 0.1s ease;
}

.mp-btn-ctrl:hover {
    color: var(--text-primary, #ffffff);
    transform: scale(1.1);
}

.mp-btn-ctrl.active {
    color: var(--file-icon, #38bdf8);
}

.mp-btn-play {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--file-icon, #38bdf8);
    color: var(--bg-main, #000000);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.15s ease, box-shadow 0.15s ease;
}

.mp-btn-play:hover {
    transform: scale(1.08);
    opacity: 0.95;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

.mp-btn-play:active {
    transform: scale(0.94);
}

.mp-bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 6px;
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.05));
}

.mp-volume-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mp-vol-slider {
    -webkit-appearance: none;
    width: 70px;
    height: 3px;
    background: var(--border-color, rgba(255, 255, 255, 0.15));
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.mp-vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-primary, #ffffff);
    cursor: pointer;
    transition: transform 0.1s ease;
}

.mp-vol-slider:hover::-webkit-slider-thumb {
    transform: scale(1.25);
    background: var(--file-icon, #38bdf8);
}

.mp-connect-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    background: var(--bg-btn, rgba(255, 255, 255, 0.05));
    border: 1px solid var(--border-btn, rgba(255, 255, 255, 0.1));
    color: var(--text-muted, #c0c0ca);
    padding: 3px 8px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.mp-connect-btn:hover {
    background: var(--bg-btn-hover);
    border-color: var(--file-icon, #38bdf8);
    color: var(--file-icon, #38bdf8);
}

/* Playlist Drawer inside Mini Player */
.mp-playlist-drawer {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.07));
    max-height: 180px;
    display: flex;
    flex-direction: column;
}

.mp-playlist-head {
    display: flex;
    justify-content: space-between;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-muted, #92929e);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.mp-playlist-items {
    overflow-y: auto;
    max-height: 120px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mp-track-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    color: var(--text-muted, #c4c4ce);
    transition: background 0.12s ease;
}

.mp-track-item:hover {
    background: var(--bg-btn-hover, rgba(255, 255, 255, 0.07));
    color: var(--text-primary, #ffffff);
}

.mp-track-item.active {
    background: var(--bg-btn-active, rgba(56, 189, 248, 0.15));
    color: var(--file-icon, #38bdf8);
    font-weight: 500;
}

.mp-track-item-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 190px;
}

.mp-track-item-dur {
    font-size: 10px;
    color: var(--text-dim, #727280);
    font-family: monospace;
}

.mp-custom-input-row {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.mp-custom-input-row input {
    flex: 1;
    background: var(--bg-editor, rgba(0, 0, 0, 0.35));
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: 4px;
    color: var(--text-primary, #e0e0e0);
    font-size: 11px;
    padding: 4px 8px;
    outline: none;
}

.mp-custom-input-row input:focus {
    border-color: var(--file-icon, #38bdf8);
}

.mp-custom-input-row button {
    background: var(--file-icon, #38bdf8);
    border: none;
    border-radius: 4px;
    color: var(--bg-main, #000);
    font-weight: 600;
    font-size: 10.5px;
    padding: 0 10px;
    cursor: pointer;
}

/* Collapsed mini state */
.music-player-widget.collapsed .mp-content {
    display: none !important;
}
.music-player-widget.collapsed {
    width: 200px;
}

.mp-playlist-actions-row {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.06));
}

.mp-drawer-browse-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--bg-btn, rgba(255, 255, 255, 0.05));
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    border-radius: 6px;
    color: var(--text-primary, #e0e0e4);
    font-size: 11px;
    font-weight: 500;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.mp-drawer-browse-btn:hover {
    background: var(--bg-btn-hover, rgba(255, 255, 255, 0.1));
    border-color: var(--file-icon, #38bdf8);
    color: var(--file-icon, #38bdf8);
}

/* Light Theme Overrides for Thorium Player */
body.theme-light .music-player-widget {
    background: rgba(255, 255, 255, 0.94);
    border-color: #d1d5db;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12), 0 0 16px rgba(0, 0, 0, 0.06);
}
body.theme-light .mp-header {
    background: #f3f4f6;
    border-bottom-color: #e5e7eb;
}
body.theme-light .mp-cover-art {
    background: #e5e7eb;
    border-color: #d1d5db;
}

/* ---- Windhawk Smooth Window Motion Effects ---- */
#app-container {
    transition: transform 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.22s ease, opacity 0.2s ease;
    will-change: transform, box-shadow;
}

body.window-dragging #app-container,
body.thorium-moving #app-container {
    transform: scale(0.993) translateY(1px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75), 0 0 30px rgba(56, 189, 248, 0.2);
    opacity: 0.97;
}

body.anim-style-windhawk #app-container {
    transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.26s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

/* Static gradient is free of animation timers. Flow animates only opacity of
   one composited layer, not layout, blur or per-frame JavaScript colors. */
body.gradient-enabled #app-container { background: var(--interface-gradient); isolation: isolate; }
body.gradient-enabled #app-container::before {
    content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: var(--interface-gradient-reverse); opacity: 0;
}
body.gradient-flow #app-container::before { animation: thorium-color-flow var(--gradient-cycle, 14s) ease-in-out infinite alternate; }
@keyframes thorium-color-flow { from { opacity: 0; } to { opacity: 1; } }
/* Theme-independent gradient surface overrides live at the end of
   settings.css, after the light-theme and wallpaper rules. */
body.ui-background #app-container::before { animation-play-state: paused; }
body.ui-background * { animation-play-state: paused !important; }
.gradient-colors { display: flex; gap: 14px; }
.gradient-settings-card { border: 1px solid var(--border-color); border-radius: 6px; padding: 10px 12px; margin-bottom: 16px; }
.gradient-settings-card .setting-row { flex-wrap: wrap; gap: 10px; }
body.gradient-enabled .telemetry-tag { color: var(--text-primary); }
.gradient-colors label { display: flex; align-items: center; gap: 8px; }
.gradient-colors input { width: 34px; height: 28px; padding: 0; border: 1px solid var(--border-color); border-radius: 5px; cursor: pointer; }
#gradient-mode, #gradient-direction { color: var(--text-primary); background: var(--bg-btn); border: 1px solid var(--border-color); padding: 6px; border-radius: 5px; }
@media (prefers-reduced-motion: reduce) { body.gradient-flow #app-container::before { animation: none; } }
