/* ========================================
   Phaser 可视化编辑器 - 样式
   ======================================== */

:root {
    /* 颜色变量 */
    --editor-bg: #1e1e1e;
    --panel-bg: #252526;
    --panel-header-bg: #3c3c3c;
    --border-color: #3c3c3c;
    --text-color: #cccccc;
    --text-muted: #808080;
    --accent-color: #007acc;
    --hover-bg: #2a2d2e;
    --active-bg: #094771;
    --selection-bg: #264f78;
    --grid-color: #333333;
    
    /* 尺寸变量 */
    --menu-height: 36px;
    --toolbar-height: 40px;
    --status-height: 24px;
    --panel-header-height: 32px;
    --left-panel-width: clamp(170px, 18vw, 220px);
    --right-panel-width: clamp(220px, 24vw, 280px);
    --bottom-panel-height: clamp(150px, 24vh, 200px);
    --resize-handle-size: 4px;
    
    /* Shoelace z-index 覆盖 - 确保弹出菜单在最顶层 */
    --sl-z-index-dropdown: 999999;
    --sl-z-index-tooltip: 999999;
}

/* ========================================
   基础样式重置
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 13px;
    background: var(--editor-bg);
    color: var(--text-color);
}

body {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
}



input,
textarea,
[contenteditable="true"] {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* ========================================
   小屏窗口自适应（桌面端）
   ======================================== */
@media (max-width: 1366px) {
    :root {
        --menu-height: 34px;
        --toolbar-height: 36px;
        --panel-header-height: 30px;
        --left-panel-width: clamp(150px, 16vw, 190px);
        --right-panel-width: clamp(200px, 22vw, 250px);
        --bottom-panel-height: clamp(130px, 20vh, 170px);
    }

    html, body {
        font-size: 12px;
    }

    #toolbar {
        gap: 6px;
        padding: 0 6px;
    }

    #menu-bar sl-button::part(base),
    #btn-preview::part(base),
    #zoom-select::part(combobox),
    .scene-selector::part(combobox),
    .panel-header span,
    .property-label,
    .property-input::part(input),
    .layer-name,
    .asset-item span {
        font-size: 11px;
    }

    .editor-tabs-header,
    .editor-mode-tabs sl-tab {
        height: 36px;
    }

    .editor-mode-tabs sl-tab {
        padding: 0 12px;
        font-size: 12px;
    }

    .panel-content {
        padding: 6px;
    }
}

@media (max-width: 1180px) {
    :root {
        --menu-height: 32px;
        --toolbar-height: 34px;
        --panel-header-height: 28px;
        --left-panel-width: clamp(136px, 15vw, 168px);
        --right-panel-width: clamp(184px, 20vw, 230px);
        --bottom-panel-height: clamp(116px, 18vh, 150px);
    }

    html, body {
        font-size: 11px;
    }

    .panel-header {
        padding: 0 6px;
        gap: 4px;
    }

    .editor-tabs-header,
    .editor-mode-tabs sl-tab {
        height: 34px;
    }

    .editor-mode-tabs sl-tab {
        padding: 0 10px;
        font-size: 11px;
    }

    .panel-tabs-right {
        gap: 6px;
        padding-right: 6px;
    }
}

body.mobile-unsupported {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(circle at 20% 20%, #2f2f36 0%, #1c1c22 55%, #121216 100%);
}

.mobile-unsupported-notice {
    width: min(100%, 560px);
    padding: 24px 20px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(20, 20, 26, 0.86);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
}

.mobile-unsupported-notice p {
    margin: 0;
    line-height: 1.8;
    text-align: center;
    font-size: 16px;
    color: #f3f3f3;
}

/* ========================================
   编辑器容器布局
   ======================================== */
#editor-container {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-rows: var(--menu-height) var(--toolbar-height) 1fr var(--status-height);
    grid-template-columns: 1fr;
}

/* ========================================
   改编模式提示横幅
   ======================================== */
#remix-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, rgba(180, 83, 9, 0.75), rgba(217, 119, 6, 0.75));
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 500;
    height: 28px;
    white-space: nowrap;
    overflow: hidden;
    z-index: 900;
}

#remix-banner sl-icon {
    font-size: 14px;
}

/* 改编模式激活时，下推编辑器容器 */
body.remix-mode #editor-container {
    height: calc(100% - 28px);
    margin-top: 28px;
}

/* ========================================
   菜单栏
   ======================================== */
#menu-bar {
    display: flex;
    align-items: center;
    padding: 0 8px;
    background: var(--editor-bg);
    border-bottom: 1px solid var(--border-color);
    gap: 4px;
    position: relative;
    z-index: 100;
}

/* 确保所有菜单栏下拉菜单弹出在最顶层 */
#menu-bar sl-dropdown {
    --sl-z-index-dropdown: 999999;
}

/* 菜单栏user区域下拉菜单 */
#menu-bar .user-area sl-dropdown::part(popup) {
    z-index: 999999 !important;
}

#menu-bar sl-button::part(base) {
    font-size: 12px;
    color: var(--text-color);
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 4px;
}

#menu-bar sl-button::part(base):hover {
    background: #3a3a3a;
    border-color: #505050;
}

#menu-bar sl-button::part(base):active {
    background: #333333;
}

#menu-bar sl-dropdown {
    --sl-spacing-small: 4px;
}

/* 确保下拉菜单弹出在最顶层 - 移动端修复 */
#menu-bar sl-dropdown::part(popup) {
    z-index: 10000 !important;
}

#menu-bar sl-menu {
    z-index: 10001;
}

/* 插入菜单 - 网格布局 */
.insert-grid-menu {
    background: var(--sl-panel-background-color, #fff);
    border: 1px solid var(--sl-panel-border-color, #e0e0e0);
    border-radius: var(--sl-border-radius-medium, 4px);
    padding: 8px;
    box-shadow: var(--sl-shadow-large);
    min-width: 280px;
}

.insert-grid-menu .insert-category-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--sl-color-neutral-500);
    padding: 4px 4px 2px;
    margin-top: 4px;
}

.insert-grid-menu .insert-category-label:first-child {
    margin-top: 0;
}

.insert-grid-menu .insert-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
}

.insert-grid-menu .insert-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 2px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    color: var(--sl-color-neutral-700);
    transition: background 0.15s;
    text-align: center;
    line-height: 1.2;
}

.insert-grid-menu .insert-grid-item:hover {
    background: var(--sl-color-primary-50, #e8f0fe);
    color: var(--sl-color-primary-700, #1a56db);
}

.insert-grid-menu .insert-grid-item sl-icon {
    font-size: 20px;
}

.menu-spacer {
    flex: 1;
}

#menu-bar #btn-preview::part(base) {
    font-size: 12px;
    background: #1890ff !important;
    border-color: #1890ff !important;
    color: #fff !important;
}

#menu-bar #btn-preview::part(base):hover {
    background: #40a9ff !important;
    border-color: #40a9ff !important;
}

/* ========================================
   工具栏
   ======================================== */
#toolbar {
    display: flex;
    align-items: center;
    padding: 0 8px;
    background: var(--panel-header-bg);
    border-bottom: 1px solid var(--border-color);
    gap: 8px;
}

#toolbar sl-icon-button::part(base) {
    font-size: 16px;
    color: var(--text-color);
}

#toolbar sl-icon-button.active::part(base) {
    color: var(--accent-color);
    background: var(--active-bg);
}

#toolbar sl-divider {
    height: 24px;
    --color: var(--border-color);
}

.toolbar-spacer {
    flex: 1;
}

#zoom-select {
    width: 80px;
}

#zoom-select::part(combobox) {
    font-size: 12px;
}

.tool-btn {
    transition: all 0.15s ease;
}

.tool-btn:hover::part(base) {
    background: var(--hover-bg);
}

/* ========================================
   主内容区
   ======================================== */
#main-content {
    display: grid;
    grid-template-columns: var(--left-panel-width) auto 1fr var(--right-panel-width);
    overflow: hidden;
}

/* ========================================
   面板容器
   ======================================== */
.panel-container {
    display: flex;
    flex-direction: column;
    background: var(--panel-bg);
    border-right: 1px solid var(--border-color);
    overflow: hidden;
}

#right-panel {
    border-right: none;
    border-left: 1px solid var(--border-color);
}

/* ========================================
   面板通用样式
   ======================================== */
.panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 100px;
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    height: var(--panel-header-height);
    padding: 0 8px;
    background: var(--panel-header-bg);
    border-bottom: 1px solid var(--border-color);
    gap: 6px;
    flex-shrink: 0;
    user-select: none;
}

.panel-header sl-icon {
    font-size: 14px;
    color: var(--text-muted);
}

.panel-header span {
    font-size: 12px;
    font-weight: 500;
    flex: 1;
}

.panel-header .panel-action {
    font-size: 14px;
    color: var(--text-color);
    opacity: 1;
    transition: color 0.2s;
}

.panel-header .panel-action:hover {
    color: #4ade80;
}

.panel-content {
    flex: 1;
    overflow: auto;
    padding: 8px;
}

/* ========================================
   中间区域
   ======================================== */
#center-area {
    display: grid;
    grid-template-rows: 1fr var(--bottom-panel-height);
    overflow: hidden;
    background: var(--editor-bg);
}

/* ========================================
   主编辑区面板（场景/事件切换）
   ======================================== */
#main-editor-panel {
    display: flex;
    flex-direction: column;
    background: var(--editor-bg);
    overflow: hidden;
}

.editor-tabs-header {
    display: flex;
    align-items: center;
    height: 40px;
    padding: 0;
    background: var(--panel-bg);
    border-bottom: 1px solid var(--border-color);
}

.editor-mode-tabs {
    flex: 0 0 auto;
}

.editor-mode-tabs::part(base) {
    border-bottom: none;
}

.editor-mode-tabs::part(tabs) {
    gap: 0;
}

.editor-mode-tabs sl-tab {
    padding: 0 16px;
    height: 40px;
    font-size: 13px;
}

.editor-mode-tabs sl-tab::part(base) {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease;
}

.editor-mode-tabs sl-tab::part(base):hover {
    color: var(--text-color);
}

.editor-mode-tabs sl-tab[active]::part(base) {
    color: var(--text-color);
    border-bottom-color: var(--accent-color);
    background: transparent;
}

.editor-mode-tabs sl-tab sl-icon {
    font-size: 16px;
}

.panel-tabs-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding-right: 8px;
}

.mobile-panel-toggles {
    display: none;
    align-items: center;
    gap: 2px;
}

.mobile-panel-toggle::part(base) {
    font-size: 14px;
    color: #4da6ff;
    background: rgba(77, 166, 255, 0.15);
}

.mobile-panel-toggle.active::part(base) {
    color: var(--accent-color);
    background: rgba(0, 122, 204, 0.16);
}

#mobile-toggle-blockly-toolbox {
    display: none;
}

.scene-selector {
    width: 150px;
}

.scene-selector::part(combobox) {
    font-size: 12px;
    height: 28px;
}

/* 编辑器视图容器 */
.editor-view {
    display: none;
    flex: 1;
    overflow: hidden;
}

.editor-view.active {
    display: flex;
}

/* 布局视图（场景编辑器） */
#layout-view {
    flex-direction: column;
}

#layout-view .scene-content {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    background: var(--editor-bg);
    overflow: auto;
    position: relative;
    z-index: 2;
    isolation: isolate;
    scrollbar-gutter: stable both-edges;
}

.scene-content.scene-scroll-locked {
    overflow: hidden;
}

.scene-content.scene-pan-disabled {
    overflow: hidden;
}

/* 事件视图（Blockly） */
#event-view {
    flex-direction: column;
    position: relative;
}

#event-view #blockly-container {
    flex: 1;
    width: 100%;
    height: 100%;
}

.scene-content {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    background: var(--editor-bg);
    padding: 0;
    overflow: auto;
    position: relative;
    z-index: 2;
    isolation: isolate;
    scrollbar-gutter: stable both-edges;
}

#scene-canvas-container {
    position: relative;
    background: #1a1a2e;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    overflow: visible;
    flex-shrink: 0;
    z-index: 1;
    margin-right: 10px;
    margin-bottom: 10px;
}

#scene-canvas-container canvas {
    display: block;
}

/* 场景网格背景 */
.scene-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-image: 
        linear-gradient(to right, var(--grid-color) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid-color) 1px, transparent 1px);
    background-size: 32px 32px;
    opacity: 0.5;
}

/* 场景标签 */
.panel-tabs {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

#scene-tabs {
    --track-color: transparent;
}

#scene-tabs::part(base) {
    font-size: 11px;
}

/* ========================================
   底部面板区（资源面板）
   ======================================== */
#bottom-panel {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border-color);
    background: var(--panel-bg);
}

#bottom-panel .panel {
    flex: 1;
}

/* ========================================
   资源面板
   ======================================== */
#assets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 8px;
}

.asset-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.asset-item:hover {
    background: var(--hover-bg);
}

.asset-item.selected {
    background: var(--selection-bg);
}

.asset-item img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 4px;
    background: var(--editor-bg);
    margin-bottom: 4px;
}

.asset-item span {
    font-size: 11px;
    color: var(--text-muted);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    max-width: 100%;
    text-align: center;
}

/* 资源面包屑导航 */
.asset-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    background: var(--editor-bg);
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    min-height: 28px;
    flex-wrap: wrap;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 3px;
    cursor: pointer;
    color: var(--text-color);
    transition: background 0.15s;
}

.breadcrumb-item:hover {
    background: var(--hover-bg);
}

.breadcrumb-root sl-icon {
    font-size: 14px;
    color: #f0c36d;
}

.breadcrumb-sep {
    font-size: 10px;
    color: var(--text-muted);
}

/* 文件夹样式 */
.folder-item {
    cursor: pointer;
}

.folder-item .folder-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-bottom: 4px;
}

.asset-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-bottom: 4px;
}

/* ========================================
   Blockly 面板
   ======================================== */
#blockly-container {
    width: 100%;
    height: 100%;
    min-height: 150px;
    position: relative;
}

#blockly-panel .panel-content {
    padding: 0;
}

/* Blockly 主题覆盖 */
.blocklyMainBackground {
    fill: var(--editor-bg) !important;
}

.blocklyToolboxDiv {
    background-color: var(--panel-bg) !important;
}


/* ========================================
   属性面板
   ======================================== */
#property-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.no-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    gap: 8px;
}

.no-selection sl-icon {
    font-size: 32px;
}

/* 属性面板 ID 头部 */
.property-id-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--panel-header-bg);
    border-radius: 4px;
    margin-bottom: 12px;
}

.property-id-header sl-icon {
    font-size: 16px;
    color: var(--accent-color);
}

.property-id-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.property-id-value {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 11px;
    color: var(--text-color);
    background: var(--editor-bg);
    padding: 2px 6px;
    border-radius: 3px;
    user-select: all;
    flex: 1;
}

.delete-object-btn {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 14px;
}

.delete-object-btn:hover {
    color: var(--danger-color, #dc3545);
}

.property-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.property-group-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
}

.property-row {
    display: grid;
    grid-template-columns: 80px 1fr;
    align-items: center;
    gap: 8px;
}

.property-label {
    font-size: 12px;
    color: var(--text-muted);
}

.property-input {
    width: 100%;
}

.property-input::part(input) {
    font-size: 12px;
}

/* 双列属性 */
.property-row-double {
    display: grid;
    grid-template-columns: 40px 1fr 40px 1fr;
    align-items: center;
    gap: 4px;
}

.property-row-double .property-label {
    font-size: 11px;
    text-align: center;
}

/* 私有变量管理 */
.variable-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.variable-list .no-vars {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 8px;
}

.variable-row {
    display: grid;
    grid-template-columns: minmax(88px, 0.72fr) 24px 24px;
    align-items: center;
    gap: 4px;
}

.variable-row sl-input::part(input) {
    font-size: 12px;
}

.variable-row .var-name {
    max-width: 160px;
}

.variable-row .edit-var-btn,
.variable-row .delete-var-btn {
    font-size: 14px;
    color: var(--text-muted);
}

.variable-row .edit-var-btn:hover {
    color: var(--accent-color);
}

.variable-row .delete-var-btn:hover {
    color: #ef4444;
}

.variable-value-dialog::part(panel) {
    width: min(560px, calc(100vw - 24px));
}

.variable-value-dialog-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.variable-value-input {
    width: 100%;
}

.variable-value-dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    width: 100%;
}

.add-var-btn {
    font-size: 14px;
}

/* ========================================
   图层面板
   ======================================== */
#layer-panel {
    flex: 0 0 200px;
    min-height: 100px;
}

#layer-tree {
    --indent-size: 16px;
}

/* 图层面板：允许左键选择列表项（覆盖 body 的 user-select: none） */
#layer-tree,
#layer-tree .layer-item {
    -webkit-user-select: auto;
    -moz-user-select: auto;
    -ms-user-select: auto;
    user-select: auto;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    -webkit-user-drag: element;
    user-drag: element;
}

.layer-item:hover {
    background: var(--hover-bg);
}

.layer-item.selected {
    background: var(--selection-bg);
}

.layer-item.dragging {
    opacity: 0.5;
}

.layer-item.drag-above::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 2px;
    background: #4ade80;
    z-index: 10;
}

.layer-item.drag-below::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: #4ade80;
    z-index: 10;
}

.layer-visibility {
    opacity: 0.7;
    cursor: pointer;
}

.layer-visibility:hover {
    opacity: 1;
}

.layer-name {
    flex: 1;
    font-size: 12px;
}

.layer-sf-wrap {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}

.layer-sf-label {
    font-size: 10px;
    color: rgba(255,255,255,0.4);
    white-space: nowrap;
}

.layer-sf-input {
    width: 40px;
    padding: 1px 4px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 4px;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.75);
    font-size: 11px;
    text-align: center;
    outline: none;
    -moz-appearance: textfield;
    appearance: textfield;
}

.layer-sf-input::-webkit-inner-spin-button,
.layer-sf-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.layer-sf-input:focus {
    border-color: rgba(99,102,241,0.6);
    background: rgba(99,102,241,0.1);
}

.layer-lock {
    opacity: 0.5;
    cursor: pointer;
}

.layer-lock:hover {
    opacity: 1;
}

/* ========================================
   项目树
   ======================================== */
#project-tree {
    --indent-size: 16px;
    --indent-guide-color: transparent;
    --indent-guide-width: 0;
}

/* 项目面板：允许左键选择列表项（覆盖 body 的 user-select: none） */
#project-tree,
#project-tree sl-tree-item {
    -webkit-user-select: auto;
    -moz-user-select: auto;
    -ms-user-select: auto;
    user-select: auto;
}

/* 隐藏选中项的蓝色左边框 */
#project-tree sl-tree-item::part(item) {
    border-inline-start: none !important;
    color: white;
}

#project-tree sl-tree-item::part(expand-button) {
    font-size: 12px;
    color: white;
}

#project-tree sl-tree-item[selected]::part(item) {
    color: #4ade80;
    background: transparent;
}

/* 场景选中样式 - 淡灰色背景 */
#project-tree sl-tree-item.scene-tree-item[selected]::part(item) {
    color: #4ade80;
    background: rgba(128, 128, 128, 0.25);
}

#project-tree sl-tree-item sl-icon {
    color: inherit;
}

/* 对象树项样式 */
.tree-item-content {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 4px;
}

.tree-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-item-actions {
    display: none;
    align-items: center;
    gap: 2px;
    margin-left: auto;
}

#project-tree sl-tree-item:hover > .tree-item-content > .tree-item-actions {
    display: flex;
}

.tree-action-btn {
    font-size: 14px;
    color: var(--text-muted);
    transition: color 0.2s;
}

.tree-action-btn:hover {
    color: var(--accent-color);
}

.tree-action-btn.delete-btn:hover {
    color: #ef4444;
}

.tree-action-btn::part(base) {
    padding: 2px;
}

/* 锁定按钮样式 */
.tree-lock-btn {
    font-size: 14px;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
    margin-left: 4px;
}

#project-tree sl-tree-item:hover > .tree-item-content > .tree-lock-btn {
    opacity: 0.5;
}

#project-tree sl-tree-item:hover > .tree-item-content > .tree-lock-btn:hover {
    opacity: 1;
    color: var(--accent-color);
}

.tree-lock-btn.is-locked {
    opacity: 1;
    color: #f59e0b;
}

.tree-lock-btn::part(base) {
    padding: 2px;
}

/* 锁定对象样式 */
#project-tree sl-tree-item.locked .tree-item-name {
    color: var(--text-muted);
    font-style: italic;
}

#project-tree sl-tree-item.locked::part(item) {
    opacity: 0.7;
}

/* 容器拖放样式 */
#project-tree sl-tree-item.drag-over {
    background: rgba(74, 222, 128, 0.2);
    outline: 2px dashed #4ade80;
    outline-offset: -2px;
}

#project-tree sl-tree-item.drag-above::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 2px;
    background: #4ade80;
    z-index: 10;
}

#project-tree sl-tree-item.drag-below::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: #4ade80;
    z-index: 10;
}

#project-tree sl-tree-item {
    position: relative;
}

/* 允许项目面板中的对象项被拖动排序（覆盖 body 的 -webkit-user-drag: none） */
#project-tree sl-tree-item.object-tree-item {
    -webkit-user-drag: element;
    user-drag: element;
}

#project-tree sl-tree-item.dragging {
    opacity: 0.5;
}

#project-tree sl-tree-item[data-is-container="true"]::part(item) {
    border-left: 3px solid #4ade80;
}

/* ========================================
   状态栏
   ======================================== */
#status-bar {
    display: flex;
    align-items: center;
    padding: 0 8px;
    background: var(--accent-color);
    color: white;
    font-size: 11px;
    gap: 16px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-item sl-icon {
    font-size: 12px;
}

.status-spacer {
    flex: 1;
}

/* ========================================
   对话框样式
   ======================================== */
sl-dialog::part(panel) {
    background: var(--panel-bg);
    color: var(--text-color);
    border: 3px solid white;
    border-radius: 8px;
}

sl-dialog::part(header) {
    background: var(--panel-header-bg);
}

sl-dialog::part(footer) {
    background: var(--panel-header-bg);
}

sl-dialog::part(overlay) {
    background-color: rgba(0, 0, 0, 0.85);
}

sl-dialog::part(close-button) {
    color: #ffffff;
    font-size: 18px;
}

sl-dialog::part(close-button):hover {
    color: #ff6b6b;
}

/* 预览对话框确保最顶层 */
#preview-dialog {
    --sl-z-index-dialog: 100000;
}

#preview-dialog::part(overlay) {
    z-index: 99999;
}

#preview-dialog::part(panel) {
    z-index: 100000;
    border-radius: 10px;
    border: 2px solid white;
}

#code-dialog pre {
    background: var(--editor-bg);
    padding: 16px;
    border-radius: 4px;
    overflow: auto;
    max-height: 60vh;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    line-height: 1.5;
}

#preview-container {
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

#preview-container iframe {
    display: block;
    border: none;
}

#preview-container canvas {
    max-width: 100%;
    max-height: 100%;
}

/* ========================================
   调整手柄
   ======================================== */
.resize-handle {
    position: absolute;
    background: transparent;
    z-index: 100;
}

.resize-handle-h {
    width: var(--resize-handle-size);
    height: 100%;
    cursor: col-resize;
    right: 0;
    top: 0;
}

.resize-handle-v {
    width: 100%;
    height: var(--resize-handle-size);
    cursor: row-resize;
    bottom: 0;
    left: 0;
}

.resize-handle:hover {
    background: var(--accent-color);
}

/* 面板分隔条 */
.panel-resizer {
    flex: 0 0 4px;
    background: var(--border-color);
    cursor: ns-resize;
    transition: background 0.15s ease;
}

.panel-resizer:hover,
.panel-resizer.dragging {
    background: var(--accent-color);
}

/* 水平面板分隔条（用于调整左右宽度） */
.panel-resizer-h {
    width: 4px;
    background: var(--border-color);
    cursor: ew-resize;
    transition: background 0.15s ease;
    flex-shrink: 0;
}

.panel-resizer-h:hover,
.panel-resizer-h.dragging {
    background: var(--accent-color);
}

/* ========================================
   选择框和变换控件
   ======================================== */
.selection-box {
    position: absolute;
    border: 2px solid var(--accent-color);
    background: rgba(0, 122, 204, 0.1);
    pointer-events: none;
}

.transform-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: white;
    border: 2px solid var(--accent-color);
    cursor: pointer;
    z-index: 1000;
}

.transform-handle.corner-nw { cursor: nw-resize; }
.transform-handle.corner-ne { cursor: ne-resize; }
.transform-handle.corner-sw { cursor: sw-resize; }
.transform-handle.corner-se { cursor: se-resize; }
.transform-handle.edge-n { cursor: n-resize; }
.transform-handle.edge-s { cursor: s-resize; }
.transform-handle.edge-e { cursor: e-resize; }
.transform-handle.edge-w { cursor: w-resize; }

.rotate-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--accent-color);
    border-radius: 50%;
    cursor: crosshair;
    z-index: 1000;
}

/* ========================================
   拖放指示器
   ======================================== */
.drop-indicator {
    position: absolute;
    border: 2px dashed var(--accent-color);
    background: rgba(0, 122, 204, 0.1);
    pointer-events: none;
    z-index: 999;
}

.drag-preview {
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    opacity: 0.8;
    transform: translate(-50%, -50%);
}

/* ========================================
   上下文菜单
   ======================================== */
.context-menu {
    position: fixed;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    padding: 4px 0;
    z-index: 10000;
    min-width: 150px;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 12px;
}

.context-menu-item:hover {
    background: var(--hover-bg);
}

.context-menu-item sl-icon {
    font-size: 14px;
    color: var(--text-muted);
}

.context-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

/* ========================================
   加载状态
   ======================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: white;
}

/* ========================================
   滚动条样式
   ======================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--editor-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ========================================
   Shoelace 组件样式覆盖
   ======================================== */
sl-input::part(base),
sl-select::part(combobox),
sl-textarea::part(base) {
    background: var(--editor-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

sl-input::part(input),
sl-select::part(display-input),
sl-textarea::part(textarea) {
    color: var(--text-color);
}

sl-tree-item::part(item) {
    padding: 2px 8px;
}

sl-tree-item::part(item):hover {
    background: var(--hover-bg);
}

sl-tree-item[selected]::part(item) {
    background: var(--selection-bg);
}

sl-menu {
    background: var(--panel-bg);
    border-color: var(--border-color);
}

/* 全局强制所有弹出层z-index */
sl-popup,
sl-popup::part(popup),
sl-dropdown::part(popup) {
    z-index: 999999 !important;
}

sl-menu-item::part(base) {
    color: var(--text-color);
    font-size: 12px;
}

sl-menu-item::part(base):hover {
    background: var(--hover-bg);
}

sl-tab::part(base) {
    color: var(--text-muted);
    font-size: 11px;
}

sl-tab[active]::part(base) {
    color: var(--text-color);
}

sl-switch::part(label) {
    font-size: 12px;
}

/* ========================================
   响应式调整
   ======================================== */
@media (max-width: 1200px) {
    :root {
        --left-panel-width: 180px;
        --right-panel-width: 240px;
    }
}

@media (max-width: 900px) {
    :root {
        --menu-height: 44px;
        --toolbar-height: 48px;
    }

    #editor-container {
        grid-template-rows: var(--menu-height) var(--toolbar-height) 1fr;
    }

    #status-bar {
        display: none;
    }

    /* 禁用iOS Safari输入框自动放大 - 字体至少16px */
    sl-input::part(input),
    sl-select::part(display-input),
    sl-textarea::part(textarea),
    .property-input::part(input),
    .layer-sf-input,
    input,
    textarea,
    select {
        font-size: 16px !important;
    }

    #menu-bar,
    #toolbar {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        white-space: nowrap;
        padding: 0 6px;
        gap: 6px;
    }

    #menu-bar::-webkit-scrollbar,
    #toolbar::-webkit-scrollbar {
        display: none;
    }

    #menu-bar sl-dropdown,
    #menu-bar sl-button,
    #toolbar sl-button-group,
    #toolbar sl-switch,
    #toolbar sl-select,
    #toolbar sl-tooltip,
    #toolbar sl-divider {
        flex-shrink: 0;
    }

    #menu-bar sl-button::part(base) {
        min-height: 34px;
    }

    #toolbar sl-icon-button::part(base) {
        min-width: 34px;
        min-height: 34px;
    }

    /* 移动端顶部菜单栏层级最高 */
    #menu-bar {
        position: relative;
        z-index: 100;
    }

    /* 移动端菜单栏内所有下拉菜单弹出层最高层级 */
    #menu-bar sl-dropdown::part(popup) {
        z-index: 999999 !important;
    }

    #main-content {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
        position: relative;
        overflow: hidden;
    }

    #left-panel,
    #center-area,
    #right-panel {
        height: 100%;
        min-width: 0;
    }

    #left-panel,
    #right-panel {
        display: flex;
        position: absolute;
        top: 0;
        bottom: 0;
        width: min(82vw, 320px);
        max-width: 88vw;
        z-index: 35;
        transition: transform 0.22s ease;
        box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12), 0 18px 36px rgba(0, 0, 0, 0.38);
    }

    #left-panel {
        left: 0;
        transform: translateX(calc(-100% - 1px));
    }

    #right-panel {
        right: 0;
        transform: translateX(calc(100% + 1px));
    }

    body.mobile-left-panel-open #left-panel {
        transform: translateX(0);
    }

    body.mobile-right-panel-open #right-panel {
        transform: translateX(0);
    }

    #center-area {
        min-width: 0;
        width: 100%;
        grid-template-rows: 1fr;
        position: relative;
    }

    #bottom-panel {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: min(36vh, 260px);
        z-index: 35;
        border-top: 1px solid var(--border-color);
        transform: translateY(calc(100% + 1px));
        transition: transform 0.22s ease;
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
    }

    body.mobile-bottom-panel-open #bottom-panel {
        transform: translateY(0);
    }

    .mobile-panel-backdrop {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 30;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }

    #main-content.mobile-panel-backdrop-visible .mobile-panel-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .panel-resizer-h,
    .panel-resizer {
        display: none;
    }

    .panel-header {
        padding: 0 10px;
    }

    .panel-content {
        padding: 10px;
    }

    .editor-tabs-header {
        height: 44px;
    }

    .editor-mode-tabs sl-tab {
        height: 44px;
        padding: 0 12px;
        font-size: 12px;
    }

    .panel-tabs-right {
        gap: 6px;
        padding-right: 6px;
    }

    .mobile-panel-toggles {
        display: inline-flex;
    }

    body.event-view-active #mobile-toggle-project-panel,
    body.event-view-active #mobile-toggle-assets-panel,
    body.event-view-active #mobile-toggle-property-panel {
        display: none;
    }

    body.event-view-active #mobile-toggle-blockly-toolbox {
        display: inline-flex;
    }

    body.event-view-active #blockly-container .blocklyFlyout,
    body.event-view-active #blockly-container .blocklyFlyoutBackground,
    body.event-view-active #blockly-container .blocklyFlyoutScrollbar {
        max-width: calc(90% - 56px) !important;
    }

    /* 修复移动端积木分类遮盖工具箱的问题 */
    body.event-view-active #blockly-container .blocklyToolboxDiv {
        z-index: 40 !important;
        position: absolute !important;
    }

    body.event-view-active #blockly-container .blocklyFlyout {
        z-index: 50 !important;
        position: absolute !important;
        left: 60px !important;
    }

    body.event-view-active:not(.mobile-blockly-toolbox-open) #blockly-container .blocklyToolboxDiv,
    body.event-view-active:not(.mobile-blockly-toolbox-open) #blockly-container .blocklyFlyout,
    body.event-view-active:not(.mobile-blockly-toolbox-open) #blockly-container .blocklyFlyoutBackground,
    body.event-view-active:not(.mobile-blockly-toolbox-open) #blockly-container .blocklyFlyoutScrollbar {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    .scene-selector {
        width: 120px;
    }

    #layout-view .scene-content,
    .scene-content {
        overflow: scroll;
        -webkit-overflow-scrolling: auto;
        scrollbar-gutter: stable both-edges;
        scrollbar-width: auto;
    }

    #layout-view .scene-content::-webkit-scrollbar,
    .scene-content::-webkit-scrollbar {
        width: 12px;
        height: 12px;
    }

    #layout-view .scene-content::-webkit-scrollbar-track,
    .scene-content::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.08);
    }

    #layout-view .scene-content::-webkit-scrollbar-thumb,
    .scene-content::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.45);
        border-radius: 8px;
    }

    #blockly-container .blocklyWidgetDiv {
        touch-action: manipulation;
    }

    /* 手机端：让场景画布默认贴近顶部，避免被遮挡后看不到 */
    #scene-canvas-container {
        margin: 0;
    }
}

@media (max-width: 640px) {
    :root {
        --menu-height: 42px;
        --toolbar-height: 46px;
    }

    #left-panel,
    #right-panel {
        width: min(88vw, 320px);
        max-width: 92vw;
    }

    #toolbar {
        gap: 4px;
    }

    #zoom-select {
        width: 72px;
    }

    .scene-selector {
        width: 108px;
    }
}

/* ========================================
   Win7 风格预览窗口
   ======================================== */
.win7-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9998;
}

.win7-window {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    border-radius: 6px;
    box-shadow: 
        0 0 0 1px rgba(0, 0, 0, 0.3),
        0 4px 20px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.15) 0%, 
        rgba(255, 255, 255, 0.05) 100%);
    backdrop-filter: blur(20px);
    overflow: hidden;
}

.win7-titlebar {
    height: 30px;
    background: linear-gradient(180deg, 
        #4a8fd9 0%, 
        #3a7bc8 25%, 
        #2d6ab8 50%, 
        #1e5aa8 75%,
        #1a5098 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    padding: 0 4px;
    cursor: move;
    user-select: none;
    border-radius: 6px 6px 0 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* 拖动时的窗口样式 */
.win7-window.dragging {
    transition: none;
    opacity: 0.95;
}

.win7-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
}

.win7-icon sl-icon {
    font-size: 14px;
    color: #fff;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3));
}

.win7-title {
    flex: 1;
    color: #fff;
    font-size: 12px;
    font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
    padding-left: 6px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    font-weight: normal;
}

.win7-controls {
    display: flex;
    height: 100%;
    align-items: flex-start;
}

.win7-btn {
    width: 28px;
    height: 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    position: relative;
    margin-top: 2px;
    border-radius: 0 0 2px 2px;
}

.win7-btn:hover {
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.3) 0%, 
        rgba(255, 255, 255, 0.1) 100%);
}

.win7-btn:active {
    background: linear-gradient(180deg, 
        rgba(0, 0, 0, 0.1) 0%, 
        rgba(0, 0, 0, 0.05) 100%);
}

/* 最小化按钮 */
.win7-minimize span {
    display: block;
    width: 10px;
    height: 2px;
    background: #fff;
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}

/* 最大化按钮 */
.win7-maximize span {
    display: block;
    width: 10px;
    height: 10px;
    border: 2px solid #fff;
    border-radius: 1px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
    box-sizing: border-box;
}

.win7-maximize span::before {
    content: '';
    display: block;
    width: 100%;
    height: 2px;
    background: #fff;
    position: absolute;
    top: 0;
    left: 0;
}

/* 重载按钮 */
.win7-reload {
    margin-right: 4px;
}

.win7-reload:hover {
    background: linear-gradient(180deg, 
        #6cb5e0 0%, 
        #4a9fd4 50%, 
        #3d8fc4 100%);
}

.win7-reload:active {
    background: linear-gradient(180deg, 
        #3d8fc4 0%, 
        #2d7fb4 100%);
}

.win7-reload sl-icon {
    font-size: 14px;
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}

/* 关闭按钮 */
.win7-close {
    border-radius: 0 4px 0 2px;
}

.win7-close:hover {
    background: linear-gradient(180deg, 
        #e04343 0%, 
        #c93535 50%, 
        #b92929 100%);
}

.win7-close:active {
    background: linear-gradient(180deg, 
        #a02020 0%, 
        #901818 100%);
}

.win7-close span {
    display: block;
    width: 12px;
    height: 12px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.win7-close span::before,
.win7-close span::after {
    content: '';
    display: block;
    width: 12px;
    height: 2px;
    background: #fff;
    position: absolute;
    top: 50%;
    left: 50%;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}

.win7-close span::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.win7-close span::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.win7-content {
    background: linear-gradient(180deg, 
        rgba(230, 240, 250, 0.95) 0%,
        rgba(220, 235, 250, 0.95) 100%);
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-top: none;
    border-radius: 0 0 6px 6px;
}

.win7-content #preview-container {
    background: #000;
    border: 1px solid #666;
    border-radius: 2px;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.3);
}

/* ========================================
   动画编辑器
   ======================================== */
.animation-editor-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 16px;
    min-height: 400px;
}

.animation-list-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-right: 1px solid var(--border-color);
    padding-right: 16px;
}

.animation-list-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 350px;
    overflow-y: auto;
}

.animation-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    background: var(--panel-bg);
    transition: background 0.15s;
}

.animation-list-item:hover {
    background: var(--hover-bg);
}

.animation-list-item.active {
    background: var(--accent-color);
    color: white;
}

.animation-list-item .anim-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.animation-list-item .delete-anim-btn {
    opacity: 0.5;
    font-size: 14px;
}

.animation-list-item:hover .delete-anim-btn {
    opacity: 1;
}

.animation-list-item.active .delete-anim-btn {
    color: white;
}

.no-animations {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

.animation-config-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    max-height: 400px;
}

.config-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.config-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
}

.config-row {
    display: grid;
    grid-template-columns: 80px 1fr;
    align-items: center;
    gap: 8px;
}

.config-row label {
    font-size: 12px;
    color: var(--text-muted);
}

.animation-frame-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
    padding: 4px;
    background: var(--editor-bg);
    border-radius: 4px;
}

.animation-frame-item {
    display: grid;
    grid-template-columns: 1fr 28px 28px 28px;
    gap: 4px;
    align-items: center;
}

.animation-frame-item sl-icon-button {
    font-size: 14px;
}

.no-frames {
    padding: 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

/* 动画编辑器对话框样式覆盖 */
#animation-editor-dialog::part(panel) {
    background: var(--panel-bg);
}

#animation-editor-dialog::part(body) {
    padding: 16px;
}

/* 属性面板中的编辑动画按钮 */
.edit-animation-btn {
    margin-left: auto;
}

/* ========================================
   用户认证相关样式
   ======================================== */
.user-area {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
    position: relative;
    z-index: 100;
}

/* 用户区域下拉菜单层次 */
.user-area sl-dropdown {
    position: relative;
    z-index: 101;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.user-info:hover {
    background: var(--hover-bg);
}

.user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.user-name {
    font-size: 12px;
    color: var(--text-color);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-error {
    color: #ef4444;
    font-size: 13px;
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 4px;
    text-align: center;
}

/* 登录按钮样式 */
#login-btn::part(base) {
    font-size: 12px;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 4px;
    color: var(--text-color);
}

#login-btn::part(base):hover {
    background: #3a3a3a;
    border-color: #505050;
}

/* ========================================
   项目列表对话框样式
   ======================================== */
.project-list-container {
    min-height: 300px;
}

.project-list-loading,
.project-list-empty,
.project-list-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 250px;
    gap: 16px;
    color: var(--text-muted);
}

.project-list-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.project-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--panel-bg);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.project-list-item:hover {
    background: var(--hover-bg);
}

.project-item-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-color);
    border-radius: 8px;
    color: white;
    font-size: 20px;
}

.project-item-info {
    flex: 1;
    min-width: 0;
}

.project-item-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-item-date {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.project-item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.project-list-item:hover .project-item-actions {
    opacity: 1;
}

.project-item-actions sl-icon-button::part(base) {
    font-size: 16px;
    color: var(--text-muted);
}

.project-item-actions sl-icon-button::part(base):hover {
    color: var(--text-color);
}

.project-item-actions .project-delete-btn::part(base):hover {
    color: #ef4444;
}

/* 我的项目和导出记录对话框边框 */
#project-list-dialog::part(panel),
.export-list-dialog::part(panel) {
    border: 3px solid white;
    border-radius: 8px;
}

/* ========================================
   图集资源角标
   ======================================== */
.asset-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    color: white;
}

.atlas-badge {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.sprite-atlas-badge {
    background: linear-gradient(135deg, #10b981, #059669);
}

.tilemap-badge {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.asset-thumb {
    position: relative;
}

/* ========================================
   动画编辑器 - Atlas 帧预览
   ======================================== */
.atlas-frame-preview {
    margin-top: 8px;
}

.atlas-frames-info {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
    background: var(--editor-bg);
    border-radius: 4px;
    max-height: 80px;
    overflow-y: auto;
}

.frame-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 20px;
    padding: 0 6px;
    background: var(--accent-color);
    color: white;
    font-size: 10px;
    font-weight: 500;
    border-radius: 3px;
    cursor: default;
}

.frame-badge:hover {
    background: #0088ee;
}

/* ========================================
   VIP 标签样式
   ======================================== */
.vip-badge {
    margin-right: 6px;
    animation: vip-glow 2s ease-in-out infinite;
}

@keyframes vip-glow {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.2);
    }
}

.user-info {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.user-info:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.user-info .vip-badge {
    font-size: 10px;
    padding: 2px 6px;
}

/* ========================================
   图片合集对话框
   ======================================== */
.sprite-atlas-layout {
    display: flex;
    gap: 16px;
    min-height: 500px;
}

.atlas-images-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 300px;
}

.atlas-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    background: var(--panel-bg);
    cursor: pointer;
    transition: all 0.2s;
    gap: 8px;
    color: var(--text-muted);
}

.atlas-upload-area:hover,
.atlas-upload-area.dragover {
    border-color: var(--accent-color);
    background: rgba(0, 122, 204, 0.1);
}

.atlas-upload-area p {
    margin: 0;
    font-size: 12px;
}

.atlas-image-list {
    flex: 1;
    overflow-y: auto;
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 350px;
}

.atlas-image-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: var(--panel-bg);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.atlas-image-item img {
    width: 32px;
    height: 32px;
    object-fit: contain;
    background: repeating-conic-gradient(#3c3c3c 0% 25%, #2a2a2a 0% 50%) 50% / 8px 8px;
    border-radius: 2px;
}

.atlas-image-item .image-info {
    flex: 1;
    min-width: 0;
}

.atlas-image-item .image-name {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.atlas-image-item .image-size {
    font-size: 10px;
    color: var(--text-muted);
}

.atlas-image-item .remove-btn {
    opacity: 0.5;
    transition: opacity 0.2s;
}

.atlas-image-item:hover .remove-btn {
    opacity: 1;
}

.atlas-image-count {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.atlas-settings-panel {
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.atlas-settings {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.atlas-custom-size {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.atlas-custom-size sl-input {
    flex: 1;
}

.atlas-size-separator {
    padding-bottom: 8px;
    color: var(--text-muted);
}

.atlas-preview-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

.atlas-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    margin-bottom: 8px;
}

.atlas-preview-header span:last-child {
    color: var(--text-muted);
}

.atlas-preview {
    flex: 1;
    background: repeating-conic-gradient(#3c3c3c 0% 25%, #2a2a2a 0% 50%) 50% / 16px 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.atlas-preview .no-preview {
    color: var(--text-muted);
    font-size: 12px;
}

.atlas-preview canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.atlas-actions {
    display: flex;
    justify-content: flex-end;
}

.atlas-dialog-footer {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

#sprite-atlas-dialog::part(body) {
    padding: 16px;
}

#sprite-atlas-dialog::part(footer) {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

/* ========================================
   进度样式编辑器对话框
   ======================================== */
#loading-style-dialog::part(body) {
    padding: 0;
}

#loading-style-dialog::part(footer) {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

.loading-style-container {
    padding: 16px;
}

.loading-preview-section {
    margin-bottom: 20px;
}

.loading-preview-label {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.loading-preview-box {
    width: 100%;
    height: 200px;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: #1a1a2e;
}

.loading-preview-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.preview-loading-text {
    font-family: Arial, sans-serif;
}

.preview-progress-bg {
    position: relative;
    overflow: hidden;
}

.preview-progress-bar {
    height: 100%;
    position: relative;
}

.preview-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: rgba(255,255,255,0.2);
    border-radius: inherit;
}

.preview-progress-bar.no-highlight::after {
    display: none;
}

.preview-percent-text {
    font-family: Arial, sans-serif;
}

.loading-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.loading-settings-group {
    background: var(--panel-bg);
    border-radius: 8px;
    padding: 12px;
    border: 1px solid var(--border-color);
}

.loading-settings-group:last-child {
    grid-column: 1 / -1;
}

.settings-group-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.settings-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    align-items: flex-end;
}

.settings-row:last-child {
    margin-bottom: 0;
}

.settings-row > sl-input {
    flex: 1;
}

.color-picker-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.color-picker-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.color-picker-wrapper sl-color-picker {
    width: 100%;
}

#loading-style-dialog sl-color-picker::part(trigger) {
    width: 100%;
    min-width: 80px;
    height: 32px;
    border-radius: 4px;
}

.switch-wrapper {
    flex: 1;
    display: flex;
    align-items: flex-end;
    padding-bottom: 6px;
}

.loading-style-footer {
    display: flex;
    gap: 8px;
}

.loading-style-footer .footer-spacer {
    flex: 1;
}

/* Logo图片选择区域 */
.loading-logo-group {
    grid-column: 1 / -1;
}

.logo-select-area {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.logo-preview-box {
    width: 100px;
    height: 100px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    overflow: hidden;
    background: var(--editor-bg);
    transition: border-color 0.2s;
    flex-shrink: 0;
}

.logo-preview-box:hover {
    border-color: var(--accent-color);
}

.logo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
    padding: 8px;
}

.logo-placeholder sl-icon {
    font-size: 24px;
}

.logo-preview-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.logo-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.logo-size-controls {
    display: flex;
    gap: 8px;
    flex: 1;
}

.logo-size-controls sl-input {
    width: 80px;
}

.preview-logo {
    max-width: 120px;
    max-height: 120px;
    object-fit: contain;
    margin-bottom: 10px;
}

/* ========================================
   精灵图集对话框
   ======================================== */
.sprite-sheet-layout {
    display: flex;
    gap: 16px;
    min-height: 500px;
}

.sprite-sheet-groups-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 400px;
}

.sprite-sheet-groups-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 600;
}

.sprite-sheet-tip {
    margin: 0 0 12px 0;
    font-size: 12px;
    color: var(--text-muted);
}

.sprite-sheet-groups {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 420px;
}

.sprite-sheet-group {
    background: var(--panel-bg);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 12px;
    transition: all 0.2s;
}

.sprite-sheet-group:hover {
    border-color: var(--accent-color);
}

.sprite-sheet-group .group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.sprite-sheet-group .group-name-input {
    flex: 1;
    max-width: 200px;
}

.sprite-sheet-group .group-file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 40px;
}

.sprite-sheet-group .file-item {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--editor-bg);
    padding: 2px;
}

.sprite-sheet-group .file-item img {
    height: 36px;
    width: auto;
    object-fit: contain;
    display: block;
}

.sprite-sheet-settings-panel {
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sprite-sheet-settings {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sprite-sheet-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: var(--panel-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.sprite-sheet-preview-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

.sprite-sheet-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    margin-bottom: 8px;
}

.sprite-sheet-preview-header span:last-child {
    color: var(--text-muted);
}

.sprite-sheet-preview {
    flex: 1;
    background: repeating-conic-gradient(#3c3c3c 0% 25%, #2a2a2a 0% 50%) 50% / 16px 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.sprite-sheet-preview .no-preview {
    color: var(--text-muted);
    font-size: 12px;
}

.sprite-sheet-preview canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.sprite-sheet-actions {
    display: flex;
    justify-content: flex-end;
}

.sprite-sheet-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: white;
    z-index: 100;
}

.sprite-sheet-dialog-footer {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

#sprite-sheet-dialog::part(body) {
    padding: 16px;
    position: relative;
}

#sprite-sheet-dialog::part(footer) {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

/* ========================================
   帧图打包工具对话框样式
   ======================================== */

.frame-packer-layout {
    display: flex;
    gap: 16px;
    min-height: 500px;
}

.frame-packer-upload-panel {
    flex: 0 0 240px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.frame-packer-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.frame-packer-section .section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.frame-packer-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--editor-bg);
}

.frame-packer-upload-area.small {
    padding: 10px;
    flex-direction: row;
    justify-content: center;
}

.frame-packer-upload-area:hover {
    border-color: var(--accent-color);
    background: var(--hover-bg);
}

.frame-packer-upload-area p {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

.frame-packer-file-info {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}

.frame-packer-actions-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 320px;
}

.frame-packer-actions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.frame-packer-actions-header span {
    font-size: 14px;
    font-weight: 600;
}

.frame-packer-actions-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
}

.frame-packer-empty-tip {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding: 32px 16px;
}

.frame-packer-action-item {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.frame-packer-action-item:hover {
    border-color: var(--accent-color);
}

.frame-packer-action-item .action-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.frame-packer-action-item .action-name {
    flex: 1;
}

.frame-packer-action-item .action-frames {
    display: flex;
    align-items: center;
    gap: 8px;
}

.frame-packer-action-item .action-start,
.frame-packer-action-item .action-end {
    width: 90px;
}

.frame-packer-action-item .frame-separator {
    color: var(--text-muted);
    font-size: 14px;
}

.frame-packer-action-item .frame-count {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 8px;
}

.frame-packer-preview-panel {
    flex: 0 0 300px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.frame-packer-settings {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.frame-packer-custom-size {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.frame-packer-custom-size sl-input {
    flex: 1;
}

.frame-packer-size-separator {
    color: var(--text-muted);
    margin-bottom: 10px;
}

.frame-packer-preview-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.frame-packer-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.frame-packer-preview-header span:last-child {
    color: var(--text-muted);
}

.frame-packer-preview {
    flex: 1;
    min-height: 200px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: repeating-conic-gradient(#f0f0f0 0% 25%, transparent 0% 50%) 50% / 16px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.frame-packer-preview .no-preview {
    color: var(--text-muted);
    font-size: 12px;
}

.frame-packer-preview canvas {
    max-width: 100%;
    max-height: 100%;
}

.frame-packer-actions {
    display: flex;
    justify-content: flex-end;
}

.frame-packer-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 10;
}

.frame-packer-dialog-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.frame-packer-dialog-footer .footer-spacer {
    flex: 1;
}

#frame-packer-dialog::part(body) {
    padding: 16px;
    position: relative;
}

#frame-packer-dialog::part(footer) {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

/* ========================================
   共享对话框样式
   ======================================== */

/* 共享设置对话框 */
.share-settings-container {
    min-height: 300px;
}

.share-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    gap: 16px;
    color: var(--text-muted);
}

.share-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.share-link-section {
    margin-bottom: 8px;
}

.share-main-content {
    display: flex;
    gap: 20px;
}

.share-left-panel {
    flex: 0 0 240px;
    display: flex;
    flex-direction: column;
}

.share-right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.share-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.share-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.share-link-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.share-preview-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.share-preview-image {
    width: 100%;
    height: 180px;
    background: var(--editor-bg);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: border-color 0.2s;
    overflow: hidden;
}

.share-preview-image:hover {
    border-color: var(--accent-color);
}

.share-preview-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.share-preview-actions {
    display: flex;
    justify-content: flex-end;
}

.share-permissions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.share-permission-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.share-permission-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: 48px;
}

.share-limits {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.share-limit-item {
    display: flex;
    flex-direction: column;
}

.share-stats {
    background: var(--editor-bg);
    padding: 12px;
    border-radius: 8px;
}

.share-stats-content {
    color: var(--text-muted);
    font-size: 12px;
}

.share-stats-content strong {
    color: var(--accent-color);
}

/* 案例库发布区域 */
.share-case-status {
    font-size: 13px;
    color: var(--text-secondary);
}

.share-case-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.share-case-form sl-select,
.share-case-form sl-input,
.share-case-form sl-textarea {
    width: 100%;
}

/* 共享预览对话框 */
.share-preview-container {
    min-height: 400px;
}

.share-preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 16px;
    color: var(--text-muted);
}

.share-preview-closed {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 16px;
    text-align: center;
    color: var(--text-muted);
}

.share-preview-closed h3 {
    color: var(--text-color);
    margin: 0;
}

.share-preview-closed p {
    max-width: 300px;
    line-height: 1.5;
}

.share-preview-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.share-preview-image-container {
    width: 100%;
    height: 250px;
    background: var(--editor-bg);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.share-preview-image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.share-preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-muted);
}

.share-preview-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.share-preview-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.share-preview-desc {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}

.share-preview-author {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.share-preview-author sl-avatar {
    --size: 32px;
}

.share-preview-author span {
    color: var(--text-color);
    font-weight: 500;
}

.share-preview-permissions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.share-preview-access {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    padding: 8px 12px;
    background: var(--editor-bg);
    border-radius: 4px;
}

.share-preview-access strong {
    color: var(--accent-color);
}

/* 共享预览 - 播放覆盖层 */
.share-preview-image-container {
    position: relative;
    cursor: pointer;
}

.share-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    transition: background 0.2s;
    cursor: pointer;
    z-index: 1;
}

.share-play-overlay:hover {
    background: rgba(0, 0, 0, 0.35);
}

.share-play-overlay.loading {
    pointer-events: none;
    cursor: wait;
}

.share-play-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(76, 175, 80, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.share-play-overlay:hover .share-play-btn {
    transform: scale(1.1);
    background: rgba(76, 175, 80, 1);
}

.share-play-text {
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
