/* ============================================
   WK-PS 变量 - 作用域限制在 comfyPage
   ============================================ */

/* WK-PS 变量 - 确保 comfyPage 内的变量可用*/
#comfyPage {
    --neon-purple: #636769;
    --neon-blue: #05d9e8;
    --neon-pink: #ff2a6d;
    /* 定义 darker-bg 变量 */
    --darker-bg: rgba(26, 26, 46, 0.95);
}

/* ComfyUI 变量 - 作用域限制*/
#comfyPage {
    --theme-primary: var(--neon-purple);
    --theme-primary-rgb: 39,41,43;
    --theme-secondary: #999999;
    --theme-border: rgba(45, 48, 70, 0.2);
    --theme-glow: rgba(45, 48, 70, 0.3);
    --wk-surface: rgba(12, 18, 28, 0.92);
    --wk-surface-soft: rgba(18, 25, 38, 0.82);
    --wk-stroke: rgba(148, 163, 184, 0.14);
    --wk-stroke-strong: rgba(99, 102, 241, 0.22);
    --wk-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
    margin: 0;
    padding: 0;
    background-color: transparent;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow-x: hidden;
    overflow-y: auto;
}

/* ComfyUI ???????? - ??????*/
#comfyPage::-webkit-scrollbar,
#comfyPage *::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
}

/* ????????? */
#comfyPage input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;
}

#comfyPage select {
    outline: none;
}

/* ============================================
   ?? WK-PS ??????????   ============================================ */

/* Splash Screen - WK-PS ?????? Wukong */
#splash-screen-wk {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(45, 48, 50, 1);
    z-index: 99999;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 680px;
    transition: opacity 0.5s ease-in-out;
    pointer-events: auto;
    overflow: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#splash-screen-wk::-webkit-scrollbar {
    width: 0 !important;
}

#splash-screen-wk.hidden {
    opacity: 0;
    pointer-events: none;
}

/* WK-PS App ?? */
#wk-app-container {
    position: relative;
    width: 100%;
    min-height: 100vh;
    margin: 0 auto;
    z-index: 1;
}

#comfyPage .splash-screen::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
    display: none !important;
}
#comfyPage .splash-screen.hidden {
    opacity: 0;
    pointer-events: none;
}
#comfyPage .splash-screen .click-hint {
    display:none;
    color: #05d9e8 !important;
    background-color: rgba(26, 26, 46, 0.9) !important;
    padding: 12px 25px !important;
    border-radius: 25px !important;
    font-size: 16px !important;
    font-weight: bold !important;
    border: 2px solid #05d9e8 !important;
    box-shadow: 0 0 15px #05d9e8 !important;
    text-shadow: 0 0 5px #05d9e8 !important;
    letter-spacing: 1px !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease !important;
}
#comfyPage .splash-screen .click-hint:hover {
    transform: scale(1.15) !important;
    box-shadow: 0 0 25px #05d9e8 !important;
    background-color: rgba(5, 217, 232, 0.2) !important;
}
#comfyPage .splash-screen * {
    animation: none !important;
}
#comfyPage .pages-container {
    position: relative;
    width: 100%;
    min-height: 100vh;
    z-index: 1;
}
#comfyPage .page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(33,35,36, 0.8);
    z-index: 1;
}
#workflow-page {
    display: none;
    background-image: url('../assets/wukongbg.jpg');
    background-size: 300px auto;
    background-position: center top;
    background-repeat: no-repeat;
    background-attachment: fixed;
}
#workflow-page.active {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    align-items: stretch;
    background:
        radial-gradient(circle at top center, rgba(79, 70, 229, 0.14), transparent 34%),
        linear-gradient(180deg, rgba(5, 10, 18, 0.98) 0%, rgba(2, 6, 12, 1) 100%);
}
#comfyPage #wk-app-container .connection-panel {
    width: 100%;
    max-width: none;
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.94) 0%, rgba(10, 14, 22, 0.96) 100%);
    border: 1px solid var(--wk-stroke);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin : 0;
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    box-shadow: var(--wk-shadow);
    overflow: hidden;
}
#comfyPage #wk-app-container .connection-panel input{
    background-color:transparent;
    border:none;
}
#comfyPage #wk-app-container .connection-panel input[type="text"],
#comfyPage #wk-app-container .connection-panel input[type="password"] {
    width: 100% !important;
    height: 38px !important;
    padding: 8px 12px;
    background: rgba(2, 6, 23, 0.78);
    border: 1px solid rgba(71, 85, 105, 0.82);
    border-radius: 10px;
    color: #f8fafc;
    font-size: 13px;
    box-sizing: border-box;
    margin: 0;
    display: block;
}
#comfyPage #wk-app-container .connection-panel input[type="text"]:focus,
#comfyPage #wk-app-container .connection-panel input[type="password"]:focus {
    border-color: rgba(129, 140, 248, 0.85);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.16);
}
#comfyPage #wk-app-container .connection-buttons {
    display: flex;
    gap: 8px;
    width: 100%;
    padding: 0;
}
#comfyPage #wk-app-container .connection-panel .cyber-button {
    flex: 1;
    padding : 0 10px;
    margin: 0;
    font-size : 12px;
    min-width : unset;
    height : 36px;
    line-height: 1;
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: 0.03em;
}
#comfyPage #wk-app-container .connection-panel .status-bar {
    margin: 0;
    padding : 6px 0;
    font-size: 12px;
    white-space: nowrap;
    background: transparent;
    border: none;
    border-radius: 0;
    min-height: 24px;
    display: flex;
    align-items: center;
    width: 100%;
    gap: 6px;
    overflow: hidden;
    position: relative;
}
#comfyPage .connection-panel .status-text {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#comfyPage .expiry-info {
    margin-left: auto;
    color: var(--theme-primary);
    font-size: 12px;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 50%;
}
#comfyPage .status-indicator {
    min-width: 8px;
    height: 8px;
    margin-right: 4px;
    flex-shrink: 0;
}
#comfyPage .button-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}
#comfyPage .cyber-button {
    background-color: #c5ef52;
    border: none;
    color:#fff;
    font-family: 'Orbitron', 'Rajdhani', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    cursor: pointer;
    transition: color 0.3s, border-color 0.3s, box-shadow 0.3s;
    border-radius : 4px;
}
#comfyPage .cyber-button:hover {
    color: #fff;
    background-color:#dbff7a;
}
#comfyPage .cyber-button:disabled {
    opacity : 0.5;
    cursor : not-allowed;
    background-color: #787878;
    color: #3d4246;
    border-color : #787878;
}
#comfyPage #disconnect-btn.cyber-button{
    background-color:#ff472f;
    border-color:#787878;
    color:#ffffff;
}
#comfyPage #disconnect-btn.cyber-button:disabled{
    border-color:#787878;
    color:#3d4246;
}
#comfyPage .status-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    background: rgba(26, 26, 46, 0.8);
    border-radius: 20px;
}
#comfyPage .status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transition: all 0.3s;
}
#comfyPage .status-indicator.connected {
    background-color: var(--neon-blue);
    box-shadow: 0 0 10px var(--neon-blue);
}
#comfyPage .status-indicator.disconnected {
    background-color: var(--neon-pink);
    box-shadow: 0 0 10px var(--neon-pink);
}
#comfyPage .settings-bar {
    width: 100%;
    display: flex;
    justify-content: center; 
    padding: 0;
    box-sizing: border-box; 
}
#comfyPage .settings-button {
    background: linear-gradient(180deg, rgba(20, 28, 42, 0.92) 0%, rgba(9, 14, 24, 0.96) 100%);
    border: 1px solid rgba(71, 85, 105, 0.68);
    border-radius: 12px;
    color: #dbeafe;
    font-size: 12px;
    cursor: pointer;
    transition: color 0.25s, border-color 0.25s, box-shadow 0.25s, transform 0.2s, background 0.25s;
    padding: 0px 0;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    font-weight: 600;
    letter-spacing: 0.04em;
}
#comfyPage .settings-button:hover {
    color: #ffffff;
    background: rgba(27, 36, 53, 0.96);
    border-color: rgba(99, 102, 241, 0.38);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
    transform: none;
}
#comfyPage .workflow-header {
    padding: 12px !important;
    margin: 0 !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important; 
    text-align: center !important;
    position: relative !important;
    height: 32px !important; 
    flex-shrink: 0;
    background-image: url('../assets/wukongbga.jpg') !important;
}
#comfyPage .workflow-header h2 {
    margin: 0 !important;
    font-size: 14px !important;
    color: transparent !important;
    text-align: center !important;
    letter-spacing: 1.5px !important;
    text-transform: uppercase !important;
    font-weight: 600 !important;
    text-shadow: none !important;
    background: none !important;
    -webkit-background-clip: unset !important;
    background-clip: unset !important;
    -webkit-text-fill-color: transparent !important;
    visibility: hidden !important;
}
#comfyPage .node-container {
    background: rgba(45, 48, 70, 0.1);
    border: 2px solid var(--neon-purple);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 0 15px rgba(45, 48, 70, 0.2);
}
#comfyPage .node-container h3 {
    color: var(--neon-purple);
    font-size: 20px;
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--neon-purple);
}
#comfyPage input[type="text"],
#comfyPage input[type="number"],
#comfyPage select {
    background-color: transparent;
    border: 2px solid var(--neon-blue);
    border-radius: 5px;
    color: #fff;
    padding: 10px;
    font-family: 'Rajdhani', sans-serif;
    transition: all 0.3s;
}
#comfyPage input:focus,
#comfyPage select:focus {
    outline: none;
    border-color: var(--neon-pink);
    box-shadow: 0 0 10px var(--neon-pink);
}
@keyframes textGlow {
    from {
        text-shadow: 0 0 10px var(--neon-blue);
    }
    to {
        text-shadow: 0 0 20px var(--neon-blue), 0 0 30px var(--neon-blue);
    }
}
@keyframes pulse {
    0% {
        box-shadow: 0 0 5px var(--success-color);
    }
    50% {
        box-shadow: 0 0 20px var(--success-color);
    }
    100% {
        box-shadow: 0 0 5px var(--success-color);
    }
}
#comfyPage .dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10001;
}
#comfyPage .dialog::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color : rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
}
#comfyPage .dialog-content {
    position: relative; 
    z-index: 1;
    width: 260px; 
    background: rgba(26, 26, 46, 0.98);
    border: 1px solid var(--theme-primary);
    border-radius: 8px;
    padding: 15px; 
    box-shadow: 0 0 20px var(--theme-glow);
    max-height: 90vh;
    overflow-y: auto;
    pointer-events: auto;
}
#comfyPage .dialog-content h3 {
    margin: 0 0 12px 0; 
    font-size: 16px; 
    color: var(--theme-primary);
}
#comfyPage .setting-item {
    margin-bottom: 12px; 
}
#comfyPage .setting-item label {
    display: block; 
    margin-bottom: 4px; 
    font-size: 13px; 
}
#comfyPage .setting-item label input[type="checkbox"] {
    margin-right: 6px;
}
#comfyPage .path-input {
    width: 100%;
    padding: 6px 8px; 
    margin-bottom: 6px; 
    background: rgba(26, 26, 46, 0.8);
    border: 1px solid var(--theme-primary);
    border-radius: 4px;
    color: #fff;
    font-size: 13px; 
    box-sizing: border-box;
}
#comfyPage .path-browse-btn {
    width: 100%;
    padding: 6px 8px; 
    background: rgba(26, 26, 46, 0.8);
    border: 1px solid var(--theme-primary);
    border-radius: 4px;
    color: var(--theme-primary);
    cursor: pointer;
    transition: all 0.3s;
    display: block;
    font-size: 13px; 
}
#comfyPage .dialog-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 15px; 
}
#comfyPage .dialog-buttons button {
    flex: 1;
    padding: 6px 8px;
    font-size: 13px;
    min-height: 30px;
}
#comfyPage .dialog-buttons button:first-child {
    margin-right: 8px;
}
#comfyPage .error-message {
    background-color: rgba(var(--theme-secondary-rgb, 255, 42, 109), 0.2);
    color: var(--theme-secondary, #ff2a6d);
    padding: 8px 12px;
    border-radius: 4px;
    margin: 8px auto;
    width: 240px;
    text-align: center;
    font-size: 13px;
    animation: fadeIn 0.3s ease-out, pulse 2s infinite;
    box-sizing: border-box;
    border: 1px solid var(--theme-secondary, #ff2a6d);
    display: block;
    font-weight: bold;
}
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(var(--theme-secondary-rgb, 255, 42, 109), 0.4);
    }
    70% {
        box-shadow: 0 0 0 5px rgba(var(--theme-secondary-rgb, 255, 42, 109), 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(var(--theme-secondary-rgb, 255, 42, 109), 0);
    }
}
#comfyPage .page-transition {
    transition: opacity 0.3s ease-in-out;
}
#editor-page {
    display: none;
    background: rgba(32,34,35, 0.8);
    padding: 5px;
    background-image: url('../assets/wukongbg2.jpg');
    background-size: 300px auto;
    background-position: center top;
    background-repeat: no-repeat;
    background-attachment: fixed;
}
#editor-page.active {
    display: flex;  
    flex-direction: column;
    align-items: center;
    background-image: url('../assets/wukongbg2.jpg');
    background-size: 300px auto;
    background-position: center top;
    background-repeat: no-repeat;
    background-attachment: fixed;
}
#comfyPage .back-button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: none;
    border: none;
    color: var(--theme-primary);
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}
#comfyPage .back-button:hover {
    color: var(--theme-secondary);
    text-shadow: 0 0 10px var(--theme-glow);
}
#comfyPage .header-button {
    flex: 1;
    padding: 4px 4px;
    /* 勿用 background 简写：会清空子选择器 #generate-btn / #interrupt-btn 的 background-image 图标 */
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    min-width: 0;
    text-align: center;
}
#comfyPage #back-btn {
    border: 1px solid #63696e;
    background-color: #63696e;
    background-image: url('../assets/fanhui.png');
    background-size: 16px 16px;
    background-position: center;
    background-repeat: no-repeat;
    color: transparent;
    text-indent: -9999px;
    overflow: hidden;
}
#comfyPage #back-btn:hover {
    background-color: #5a7c97;
    box-shadow: 0 0 5px rgba(151, 161, 170, 0.4);
}
#comfyPage #generate-btn {
    border: 1px solid #dcfc83;
    background-color: #dcfc83;
    background-image: url('../assets/yunxing.png');
    background-size: 20px 20px;
    background-position: center;
    background-repeat: no-repeat;
    color: transparent;
    text-indent: -9999px;
    overflow: hidden;
}
#comfyPage #generate-btn:hover {
    background-color: #a5e001;
    box-shadow: 0 0 6px rgba(165, 224, 1, 0.45);
}
#comfyPage #interrupt-btn {
    border: 1px solid #ff472f;
    background-color: #ff472f;
    background-image: url('../assets/zhongzhi.png');
    background-size: 20px 20px;
    background-position: center;
    background-repeat: no-repeat;
    color: transparent;
    text-indent: -9999px;
    overflow: hidden;
}
#comfyPage #interrupt-btn:hover {
    background-color: #ff1e00;
}
#comfyPage .header-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: var(--mono-gray);
    color: var(--mono-gray);
    box-shadow: none;
}
#comfyPage .workflow-vertical-layout {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
#comfyPage .widget-empty {
    padding: 15px;
    text-align: center;
    color: #666;
    font-style: italic;
}
#comfyPage #wk-app-container:has(#editor-page.active) #comfyPage .connection-panel,
#comfyPage .pages-container:has(#editor-page.active) ~ #comfyPage .connection-panel,
#comfyPage .pages-container:has(#editor-page.active) #comfyPage .connection-panel,
body:has(#workflow-page.active) #comfyPage .connection-panel {
    display: none;
}
#comfyPage .dialog-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}
#comfyPage .settings-footer {
    gap: 20px !important;
    justify-content: space-around !important;
}
#comfyPage .dialog-buttons .cyber-button {
    flex: 1;
    padding: 8px;
    font-size: 14px;
}
.cyber-button.secondary {
    border-color: var(--neon-blue);
    color: var(--neon-blue);
}
.cyber-button.secondary:hover {
    border-color: var(--neon-blue);
    color: #fff;
    box-shadow: 0 0 10px var(--neon-blue);
}
#comfyPage .connection-panel input[type="text"] {
    border-color: var(--theme-primary);
    background-color: #2d3032;
    color: #63696e;
}
#comfyPage .connection-panel input[type="text"]:focus {
    border-color:#ffffff;
    color:#ffffff;
}
#comfyPage .status-indicator.connected {
    background-color: #c5ef52;
    box-shadow: 0 0 10px var(--theme-glow);
}
#comfyPage .settings-button {
    border-color: var(--theme-primary);
    color: #ffffff;
}
#comfyPage .cyber-button {
    border-color: #c5ef52;
    color: #3d4246;
}
#comfyPage .cyber-button:hover {
    color: #3d4246;
    border-color: var(--theme-secondary);
    box-shadow: 0 0 10px var(--theme-glow);
}
#comfyPage .dialog-content {
    border-color: var(--theme-primary);
    box-shadow: 0 0 20px var(--theme-glow);
}
@keyframes rainbow-shift {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 200% 50%;
    }
}
#comfyPage .theme-rainbow .cyber-button {
    border-image: linear-gradient(
        45deg,
        var(--neon-blue),
        var(--neon-purple),
        var(--neon-pink),
        var(--cyber-yellow),
        var(--cyber-green)
    ) 1;
    border-width: 2px;
    background: linear-gradient(
        90deg,
        var(--neon-blue),
        var(--neon-purple),
        var(--neon-pink),
        var(--cyber-yellow),
        var(--cyber-green)
    );
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
#comfyPage .theme-rainbow .cyber-button:hover {
    background: linear-gradient(
        90deg,
        var(--cyber-green),
        var(--cyber-yellow),
        var(--neon-pink),
        var(--neon-purple),
        var(--neon-blue)
    );
    -webkit-background-clip: text;
    background-clip: text;
    box-shadow: 0 0 15px rgba(255, 42, 109, 0.4);
}
#comfyPage .theme-mono .workflow-name {
    background: linear-gradient(90deg, var(--mono-gray), var(--mono-light));
    -webkit-background-clip: text;
    background-clip: text;
}
#comfyPage .theme-mono .workflow-item {
    border-color: var(--mono-dark);
    background: rgba(32, 32, 32, 0.8);
}
#comfyPage .theme-mono .workflow-item:hover {
    border-color: var(--mono-light);
    box-shadow: 0 0 8px var(--mono-glow);
    background: rgba(48, 48, 48, 0.8);
}
#comfyPage .theme-mono .cyber-button {
    border-color: var(--mono-gray);
    color: var(--mono-gray);
    background: rgba(32, 32, 32, 0.8);
}
#comfyPage .theme-mono .cyber-button:hover {
    border-color: var(--mono-light);
    color: var(--mono-light);
    box-shadow: 0 0 10px var(--mono-glow);
    background: rgba(48, 48, 48, 0.8);
}
#comfyPage .theme-mono input[type="text"],
#comfyPage .theme-mono input[type="number"],
#comfyPage .theme-mono select {
    border-color: var(--mono-dark);
    background: rgba(32, 32, 32, 0.8);
}
#comfyPage .theme-mono input:focus,
#comfyPage .theme-mono select:focus {
    border-color: var(--mono-light);
    box-shadow: 0 0 8px var(--mono-glow);
}
#comfyPage .theme-mono .header h2 {
    color: var(--mono-gray);
    text-shadow: 0 0 5px var(--mono-glow);
}
#comfyPage .theme-mono .status-indicator.connected {
    background-color: var(--mono-light);
    box-shadow: 0 0 10px var(--mono-glow);
}
#comfyPage .theme-mono .settings-button {
    border-color: var(--mono-gray);
    color: var(--mono-gray);
    background: rgba(32, 32, 32, 0.8);
}
#comfyPage .theme-mono .settings-button:hover {
    border-color: var(--mono-light);
    color: var(--mono-light);
    box-shadow: 0 0 5px var(--mono-glow);
}
#comfyPage .widget-label {
    display: block;
    text-align: center;
    color: var(--mono-gray);
    font-size: 12px;
    margin-bottom: 8px;
    padding : 2px 6px;
    border-radius: 4px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}
#comfyPage .comfyui-dialog {
    border: none;
    padding: 0;
    /* 使用明确的颜色值 */
    background: rgba(26, 26, 46, 0.95);
    border-radius: 8px;
    width: 90vw;
    height: 90vh;
    max-width: 1600px;
    max-height: 1000px;
}
#comfyPage .comfyui-dialog::backdrop {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
}
#comfyPage .comfyui-container {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* 使用明确的颜色值，避免 var(--darker-bg) 未定义问题 */
    background: rgba(26, 26, 46, 0.95);
    z-index: 1000;
}
/* 自由模式或工作流加载时通过 .show 类显示 webview */
#comfyPage .comfyui-container.show {
    display: flex !important;
}
#comfyPage .comfyui-container webview {
    width: 100%;
    height: 100%;
    border: none;
}
#comfyPage .dialog-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: rgba(26, 26, 46, 0.95);
    border-bottom: 1px solid var(--theme-border);
    color: var(--theme-primary);
}
#comfyPage .dialog-close-btn {
    background: transparent;
    border: none;
    color: var(--theme-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    transition: all 0.3s;
}
#comfyPage .dialog-close-btn:hover {
    color: var(--theme-secondary);
    transform: scale(1.1);
}
#comfyPage .comfyui-iframe {
    flex: 1;
    width: 100%;
    height: calc(100% - 40px);  
    border: none;
    background: white;
}
/* 将 uxp-panel 样式限定在 #comfyPage 内，避免影响独立窗口
   注意：只有嵌入式 uxp-panel 在 #comfyPage 内，独立窗口不受影响 */
#comfyPage uxp-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90vw;
    height: 90vh;
    max-width: 1600px;
    max-height: 1000px;
    background: var(--darker-bg);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* 隐藏 #comfyPage 内的嵌入式 uxp-panel */
#comfyPage uxp-panel.embedded-panel {
    display: none !important;
}
#comfyPage .comfyui-webview {
    flex: 1;
    width: 100%;
    border: none;
}
/* 确保 #comfyPage .bg 只在 #comfyPage 内生效，不影响独立窗口 */
#comfyPage > .bg,
#comfyPage > * > .bg {
    background: rgba(26, 26, 46, 0.8);
    padding: 5px;
}
/* 确保 #comfyPage .row 只在 #comfyPage 内生效，不影响独立窗口 */
#comfyPage > .row,
#comfyPage > * > .row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px;
}
#comfyPage .close-button {
    background: transparent;
    border: none;
    color: var(--theme-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    transition: all 0.3s;
}
#comfyPage .close-button:hover {
    color: var(--theme-secondary);
    transform: scale(1.1);
}
#comfyPage .hidden {
    display: none !important;
}
#comfyui-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90vw;
    height: 90vh;
    max-width: 1600px;
    max-height: 1000px;
    background: var(--darker-bg);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
uxp-panel.svelte-3elpbo {
    display: flex;
    flex-direction: column;
}
.bg.svelte-3elpbo {
    background: rgba(26, 26, 46, 0.8);
    padding: 5px;
}
.row.svelte-3elpbo {
    display: flex;
    align-items: center;
    gap: 10px;
}
.row-item.svelte-3elpbo {
    display: flex;
    align-items: center;
    gap: 8px;
}
.discrip.svelte-3elpbo {
    color: var(--theme-primary);
    font-size: 14px;
}
webview.svelte-3elpbo {
    flex: 1;
    border: none;
} 
#comfyPage .info-container,
#info-container.info-container {
    display: none !important;
}
#comfyPage .info-icon {
    height: 80px;
    width: auto;
    display: block;
}
#comfyPage .path-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
#comfyPage .path-input {
    width: 100%;
    padding: 8px;
    margin-bottom: 8px;
    background: rgba(26, 26, 46, 0.8);
    border: 1px solid var(--theme-primary);
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    box-sizing: border-box;
}
#comfyPage .path-browse-btn {
    width: 100%;
    padding: 8px 12px;
    background: rgba(26, 26, 46, 0.8);
    border: 1px solid var(--theme-primary);
    border-radius: 4px;
    color: var(--theme-primary);
    cursor: pointer;
    transition: all 0.3s;
    display: block;
}
#comfyPage .path-browse-btn:hover {
    border-color: var(--theme-secondary);
    color: var(--theme-secondary);
    box-shadow: 0 0 8px var(--theme-glow);
}
#comfyPage .overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color:transparent; 
    z-index: 10000; 
    backdrop-filter: blur(5px); 
    overflow: hidden; 
}
#comfyPage .hidden {
    display: none !important;
}
#comfyPage .fixed-elements {
    z-index: 50; 
}
#comfyPage .checkbox-item {
    margin-top: 10px;
}
#comfyPage .checkbox-item label {
    display: flex;
    align-items: center;
    font-size: 13px;
}
#comfyPage .checkbox-item input[type="checkbox"] {
    margin-right: 8px;
    width: 14px;
    height: 14px;
}
#comfyPage .dialog .cyber-button {
    flex: 1;
    font-size: 13px;
    padding: 6px 10px;
    min-width: 80px;
    height: 30px;
    line-height: 1;
}
body.font-default {
    font-family: var(--default-font);
}
body.font-pixel {
    font-family: var(--pixel-font);
    letter-spacing: -0.5px;
}
body.font-mono {
    font-family: var(--mono-font);
}
body.font-rounded {
    font-family: var(--rounded-font);
}
body.font-sci-fi {
    font-family: var(--sci-fi-font);
    letter-spacing: 0.5px;
}
body.font-system {
    font-family: var(--system-font) !important;
}
body.font-system * {
    font-family: inherit !important;
}
#comfyPage .cyber-button, #comfyPage .cyber-input, #comfyPage .widget-label, #comfyPage .workflow-name,
#comfyPage .header h2, #comfyPage .setting-item, #comfyPage .path-input,
#comfyPage .settings-button, #comfyPage .header-button {
    font-family: inherit !important;
}
@font-face {
    font-family: 'SmileySans';
    src: url('../fonts/SmileySans-Oblique.ttf') format('truetype'),
         url('fonts/SmileySans-Oblique.ttf') format('truetype'),
         url('/fonts/SmileySans-Oblique.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap; 
}
body.font-custom * {
    font-family: 'SmileySans', Arial, sans-serif !important;
}

body:has(#comfyPage .dialog:not(.hidden)) {
    overflow: hidden;
}
body:has(#comfyPage .dialog:not(.hidden)) #comfyPage #wk-app-container {
    pointer-events: none; 
}
body:has(#comfyPage .dialog:not(.hidden)) #comfyPage .dialog-content {
    pointer-events: auto;
}
#comfyPage .dialog {
    z-index: 10001; 
}
body:has(.dialog[style*="display: flex"]) #comfyPage #wk-app-container::after,
body:has(#comfyPage .dialog:not(.hidden)) #comfyPage #wk-app-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 9999; 
    pointer-events: auto; 
}
#comfyPage .connect-btn,
#comfyPage .disconnect-btn,
#comfyPage .action-btn {
    height: 30px; 
    min-height: 30px;
    padding: 6px 12px;
    background: rgba(var(--theme-primary-rgb), 0.15);
    border: none; 
    border-radius: 4px;
    color: var(--theme-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-shadow: 0 0 5px var(--theme-glow);
    box-sizing: border-box;
}
#comfyPage .connect-btn:hover,
#comfyPage .disconnect-btn:hover,
#comfyPage .action-btn:hover {
    background: rgba(var(--theme-primary-rgb), 0.3);
    box-shadow: 0 0 8px var(--theme-glow);
}
#comfyPage .connect-btn:active,
#comfyPage .disconnect-btn:active,
#comfyPage .action-btn:active {
    background: rgba(var(--theme-primary-rgb), 0.4);
    transform: translateY(1px);
}
#comfyPage #license-key {
    width: 250px !important;
    height: 30px !important;
    border: 1px solid #636769;
    background-color: #2d3032;
    color: #63696e;
    padding: 6px 12px;
    border-radius: 4px;
    margin: 5px auto;
    box-sizing: border-box;
    transition: all 0.3s ease;
    display: block;
    font-family: inherit;
    letter-spacing: normal;
}
#comfyPage #license-key:focus {
    border-color:#ffffff;
    color:#ffffff;
    outline: none;
}
#comfyPage .status-indicator.disconnected {
    background-color: #e22b2b;
}
#comfyPage .status-indicator.disconnected.connected {
    background-color: #cfef52 !important;
    box-shadow: 0 0 10px #cfef52 !important;
}
#comfyPage .status-text {
    transition: color 0.3s ease;
}
#comfyPage .status-indicator.connected ~ .status-text {
    color: var(--theme-primary);
}
#comfyPage .status-indicator.disconnected ~ .status-text {
    color: var(--neon-pink);
}
body:has(#comfyPage .splash-screen:not(.hidden)) #comfyPage #wk-app-container {
    pointer-events: none; 
}
