        /* --- 基础布局 --- */
        html, body { height: 100%; margin: 0; overflow: hidden; }
        body { background-color: rgb(var(--mdui-color-surface-container-lowest)); font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; }
        
        .main-container {
            height: calc(100vh - 64px); display: grid; gap: 16px; padding: 16px;
            grid-template-columns: 1fr; grid-template-rows: auto 1fr; overflow: hidden;
        }
        @media (min-width: 1000px) {
            .main-container { grid-template-columns: 3fr 2fr; grid-template-rows: 1fr; }
        }

        /* --- 左侧编辑区 --- */
        .left-column { display: flex; flex-direction: column; gap: 16px; height: 100%; overflow: hidden; position: relative; }
        .tab-content { display: none; flex-grow: 1; overflow-y: auto; padding: 4px; height: 100%; flex-direction: column; }
        .tab-content.active { display: flex; }

        /* 可视化列表 */
        #rawtext-list { display: flex; flex-direction: column; gap: 12px; padding-bottom: 80px; }
        .segment-row {
            padding: 16px; border: 1px solid rgb(var(--mdui-color-outline-variant)); border-radius: 12px;
            background-color: rgb(var(--mdui-color-surface-container)); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); position: relative;
        }
        .segment-row.highlight { 
            border-color: rgb(var(--mdui-color-primary)); 
            box-shadow: 0 0 0 4px rgba(var(--mdui-color-primary), 0.3); 
            transform: scale(1.01);
            z-index: 2;
        }
        .segment-top-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
        .drag-handle { cursor: grab; color: rgb(var(--mdui-color-on-surface-variant)); }
        
        /* --- 右侧预览区 --- */
        .right-column { display: flex; flex-direction: column; gap: 16px; height: 100%; overflow-y: auto; }
        
        #preview-card { flex-shrink: 0; display: flex; flex-direction: column; transition: all 0.3s; }
        
        /* 预览容器 - 流式布局 */
        #preview-output {
            background-color: rgba(0,0,0,0.8);
            border-radius: 8px; padding: 20px;
            min-height: 150px;
            font-family: 'Minecraft', 'Unifont', monospace; font-size: 16px; line-height: 1.5;
            color: white; text-shadow: 2px 2px 0 #3f3f3f;
            white-space: pre-wrap;
            word-break: break-word;
            cursor: context-menu;
            position: relative;
            overflow: auto;
        }

        /* 全屏预览模式 */
        #preview-output.fullscreen-mode {
            position: fixed; inset: 0; z-index: 9999;
            width: 100vw; height: 100vh;
            border-radius: 0;
            
            /* 修正布局：确保长文本和换行能正常向下延伸 */
            display: block;      /* 改为 block 布局 */
            overflow-y: auto;    /* 允许长文本滚动 */
            padding: 10vh 15vw;  /* 利用 padding 实现视觉上的居中 */
            
            font-size: 24px;     /* 全屏模式下加大字号更有感觉 */
            line-height: 1.6;
            white-space: pre-wrap !important; /* 强制保留换行 */
        }
        #fullscreen-close-btn {
            position: fixed; top: 20px; right: 20px; z-index: 10000;
            display: none; background: rgba(0,0,0,0.5); color: white;
        }
        body.has-fullscreen #fullscreen-close-btn { display: flex; }

        /* 预览组件 */
        .preview-segment {
            display: inline;
            position: relative;
            cursor: grab;
            border: 1px solid transparent;
            border-radius: 2px;
            transition: background-color 0.1s;
        }
        .preview-segment:hover { 
            background: rgba(255,255,255,0.15); 
            border-color: rgba(255,255,255,0.3);
        }
        
        /* 类型图标 */
        .type-badge {
            font-size: 0px; width: 0; display: inline-block; vertical-align: middle; 
            overflow: hidden; transition: all 0.2s;
        }
        .show-icons .type-icon-inner {
            font-family: 'Material Icons'; font-size: 14px; color: #aaa; margin-right: 2px;
        }
        .show-icons .type-badge { width: auto; font-size: 14px; }

        /* --- 代码编辑器 --- */
        .editor-container {
            position: relative; flex-grow: 1; border-radius: 8px; 
            background: #1e1e1e; border: 1px solid rgb(var(--mdui-color-outline-variant)); overflow: hidden;
        }
        .editor-layer {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            margin: 0; padding: 16px; border: 0; box-sizing: border-box;
            font-family: 'Consolas', 'Monaco', 'Courier New', monospace; font-size: 14px; line-height: 1.5;
            white-space: pre-wrap; word-wrap: break-word; overflow: auto;
        }
        #highlight-layer { z-index: 1; color: #d4d4d4; pointer-events: none; }
        #edit-layer { z-index: 2; background: transparent; color: transparent; caret-color: white; resize: none; outline: none; }
        
        .token.string { color: #ce9178; }
        .token.number { color: #b5cea8; }
        .token.boolean { color: #569cd6; }
        .token.key { color: #9cdcfe; }
        .token.null { color: #569cd6; }

        #apply-code-btn {
            position: absolute; bottom: 16px; right: 16px; z-index: 10;
            display: none; box-shadow: 0 4px 8px rgba(0,0,0,0.4);
        }

        /* 自动补全 */
        #autocomplete-list {
            position: absolute; z-index: 20; background: #252526; 
            border: 1px solid #454545; width: 200px; max-height: 150px; overflow-y: auto;
            display: none; flex-direction: column; box-shadow: 0 4px 8px rgba(0,0,0,0.5);
        }
        .ac-item {
            padding: 4px 8px; cursor: pointer; color: #cccccc; font-family: monospace; font-size: 13px;
            display: flex; align-items: center; gap: 6px;
        }
        .ac-item:hover { background: #04395e; color: white; }

        /* --- 轮盘菜单 (Quick Select) --- */
        #quick-select-overlay {
            position: fixed; inset: 0; z-index: 10000;
            background: rgba(0,0,0,0.4); backdrop-filter: blur(4px);
            display: none; align-items: center; justify-content: center;
            opacity: 0; transition: opacity 0.2s;
        }
        #quick-select-overlay.open { display: flex; opacity: 1; }
        .wheel-container {
            position: relative; width: 300px; height: 300px;
            display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 16px;
        }
        .wheel-btn {
            background: rgb(var(--mdui-color-surface)); 
            border: 2px solid rgb(var(--mdui-color-outline-variant));
            border-radius: 16px; cursor: pointer;
            display: flex; flex-direction: column; align-items: center; justify-content: center;
            transition: all 0.2s; box-shadow: 0 4px 12px rgba(0,0,0,0.2);
        }
        .wheel-btn:hover {
            background: rgb(var(--mdui-color-primary-container));
            border-color: rgb(var(--mdui-color-primary));
            transform: scale(1.05);
        }
        .wheel-btn mdui-icon { font-size: 32px; margin-bottom: 8px; color: rgb(var(--mdui-color-primary)); }
        .wheel-label { font-weight: bold; font-size: 1.1em; }

        /* --- 右键菜单 --- */
        #context-menu {
            position: fixed; z-index: 9999; background: rgb(var(--mdui-color-surface-container-highest));
            border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.5); padding: 4px 0; min-width: 180px;
            display: none; flex-direction: column; border: 1px solid rgb(var(--mdui-color-outline-variant));
        }
        .ctx-item {
            padding: 8px 16px; cursor: pointer; display: flex; align-items: center; gap: 8px; font-size: 0.9em;
            color: rgb(var(--mdui-color-on-surface));
        }
        .ctx-item:hover { background: rgba(var(--mdui-color-on-surface), 0.1); }
        .ctx-divider { height: 1px; background: rgb(var(--mdui-color-outline-variant)); margin: 4px 0; }
        .ctx-header { padding: 4px 16px; font-size: 0.75em; opacity: 0.6; font-weight: bold; margin-top: 4px;}

        /* 虚拟数据列表 */
        .virtual-list { display: flex; flex-direction: column; gap: 8px; }
        .virtual-item {
            display: flex; align-items: center; justify-content: space-between;
            padding: 12px; background: rgb(var(--mdui-color-surface-container-high)); border-radius: 8px;
        }

        /* 格式化代码格 */
        #format-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; padding-top: 16px; }
        .fmt-cell { 
            border: 1px solid rgb(var(--mdui-color-outline-variant)); border-radius: 4px; 
            text-align: center; cursor: pointer; padding: 6px; user-select: none;
            transition: background 0.2s;
        }
        .fmt-cell:hover { background: rgb(var(--mdui-color-surface-container-high)); }

        /* 颜色选择器 */
        .color-dot { width: 32px; height: 32px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: transform 0.2s; }
        .color-dot:hover { transform: scale(1.1); }
        .color-dot.active { border-color: rgb(var(--mdui-color-primary)); transform: scale(1.1); }

        /* 确保进度条在编辑器最上方 */
        #code-progress {
            --mdui-color-primary: rgb(var(--mdui-color-primary));
        }