.tw-topbar{background:rgba(255,255,255,.92);backdrop-filter:saturate(180%) blur(12px);-webkit-backdrop-filter:saturate(180%) blur(12px);border-bottom:1px solid rgba(226,232,240,.8);position:sticky;top:0;z-index:50;}
.tw-topbar-in{max-width:1200px;margin:0 auto;padding:0 20px;height:60px;display:flex;align-items:center;gap:22px;}
.tw-brand{color:#1f2937;font-weight:900;font-size:18px;letter-spacing:.5px;text-decoration:none;}
.tw-brand span{background:linear-gradient(90deg,#2563eb,#7c3aed);-webkit-background-clip:text;-webkit-text-fill-color:transparent;margin-left:4px;}
.tw-topnav{display:flex;align-items:center;gap:22px;flex:1;font-size:14px;}
.tw-topnav a{color:#4b5563;text-decoration:none;white-space:nowrap;padding:6px 2px;position:relative;transition:.2s;}
.tw-topnav a:hover{color:#2563eb;}
.tw-btn{background:linear-gradient(90deg,#2563eb,#4f46e5);color:#fff;padding:8px 18px;border-radius:24px;font-size:13px;font-weight:600;white-space:nowrap;text-decoration:none;box-shadow:0 4px 14px rgba(37,99,235,.25);transition:.2s;}
.tw-btn:hover{transform:translateY(-1px);box-shadow:0 6px 20px rgba(37,99,235,.32);}

.tw-page{max-width:1120px;margin:0 auto;padding:24px 16px 56px;}
.tw-crumb{font-size:13px;color:#909399;margin-bottom:18px;}
.tw-crumb a{color:#2563eb;text-decoration:none;}
.tw-crumb a:hover{text-decoration:underline;}
.tw-crumb span.sep{margin:0 8px;color:#dcdfe6;}

.tw-head{display:flex;align-items:flex-start;justify-content:space-between;gap:24px;margin-bottom:24px;flex-wrap:wrap;}
.tw-head-main{flex:1;min-width:0;}
.tw-title{font-size:28px;font-weight:700;color:#1f2329;margin:0 0 8px;line-height:1.25;}
.tw-desc{color:#909399;font-size:14px;line-height:1.6;margin:0;max-width:640px;}
.tw-head-side{display:flex;flex-direction:column;align-items:flex-end;gap:10px;}

.tw-ops{display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end;}
.tw-op{display:inline-flex;align-items:center;gap:5px;background:#fff;border:1px solid #e4e7ed;border-radius:20px;padding:6px 12px;font-size:13px;color:#606266;cursor:pointer;transition:.15s;white-space:nowrap;line-height:1;}
.tw-op svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;}
.tw-op:hover{border-color:#2563eb;color:#2563eb;background:#f5f9ff;}
.tw-op.active{background:#fff7e6;border-color:#f0a020;color:#d9820a;}
.tw-meta-line{display:flex;align-items:center;gap:12px;flex-wrap:wrap;justify-content:flex-end;font-size:13px;color:#909399;}
.tw-meta-line .tw-useful,.tw-meta-line .tw-ucount{display:inline-flex;align-items:center;gap:4px;cursor:default;}
.tw-meta-line .tw-useful b{color:#606266;font-weight:500;}
.tw-meta-line svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;}
.tw-useful#tw-useful{cursor:pointer;}
.tw-useful#tw-useful:hover{color:#2563eb;}
.tw-pt{position:relative;}
.tw-pt-menu{position:absolute;right:0;top:38px;z-index:20;background:#fff;border:1px solid #e4e7ed;border-radius:10px;box-shadow:0 8px 28px rgba(0,0,0,.1);min-width:170px;padding:6px;display:none;}
.tw-pt-item{padding:9px 12px;font-size:13.5px;color:#3a3f47;border-radius:6px;cursor:pointer;}
.tw-pt-item:hover{background:#f2f6fd;color:#2563eb;}

.tw-main{display:flex;gap:24px;align-items:flex-start;--tw-left-width:340px;}
.tw-left{flex:none;min-width:0;width:var(--tw-left-width);}
.tw-right{flex:1;min-width:0;max-width:none;position:sticky;top:20px;}
body[data-tw-left="fixed"] .tw-left{flex:none;width:var(--tw-left-width);min-width:0;}
body[data-tw-left="fixed"] .tw-right{flex:1;min-width:0;max-width:calc(100% - var(--tw-left-width) - 24px);}

/* 全宽上下布局：参考站非左右结构时，不要强行左右 */
.tw-layout-vertical .tw-main{display:block;}
/* 流式上下布局：输入在上，输出在下（生成/检测页） */
.tw-layout-vertical.tw-layout-flow .tw-left{display:block;width:100%;max-width:none;flex:none;margin-bottom:24px;}
.tw-layout-vertical.tw-layout-flow .tw-right{width:100%;max-width:none;position:static;}
/* 输出占满布局：左侧无输入，只展示结果（尺寸查询页） */
.tw-layout-vertical.tw-layout-output .tw-left{display:none;}
.tw-layout-vertical.tw-layout-output .tw-right{width:100%;max-width:none;position:static;}
.tw-layout-vertical .tw-right .tw-card{border:0;box-shadow:none;padding:0;background:transparent;}
.tw-layout-vertical .tw-result-hd{display:none;}
.tw-layout-vertical .tw-out-wrap{padding:0;background:transparent;}
.tw-layout-vertical .tw-out{border:0;background:transparent;padding:0;white-space:normal;}

/* 文件/图片结果区：预览卡片 + 下载按钮 */
.tw-out-file{display:flex;flex-direction:column;gap:14px;}
.tw-out-file .tw-file-preview{max-width:100%;border-radius:12px;border:1px solid #eceef1;background:#fff;box-shadow:0 4px 16px rgba(0,0,0,.06);overflow:hidden;}
.tw-out-file .tw-file-preview img,.tw-out-file .tw-file-preview video{display:block;max-width:100%;height:auto;}
.tw-file-acts{display:flex;align-items:center;gap:12px;flex-wrap:wrap;}
.tw-btn-dl{display:inline-flex;align-items:center;gap:8px;background:linear-gradient(90deg,#2563eb,#4f46e5);color:#fff;padding:10px 18px;border-radius:24px;font-size:14px;font-weight:600;text-decoration:none;box-shadow:0 4px 14px rgba(37,99,235,.25);transition:.2s;white-space:nowrap;}
.tw-btn-dl:hover{transform:translateY(-1px);box-shadow:0 6px 20px rgba(37,99,235,.32);}
.tw-btn-dl svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}
.tw-file-detail{font-size:13px;color:#606266;}

.tw-card{background:#fff;border:1px solid #eceef1;border-radius:16px;padding:22px;box-shadow:0 4px 20px rgba(0,0,0,.04);}
.tw-field{margin-bottom:18px;position:relative;}
.tw-field:last-child{margin-bottom:0;}
.tw-field label{display:block;font-size:14px;font-weight:600;color:#1f2329;margin-bottom:8px;}
.tw-field label .hint{font-weight:400;color:#c0c4cc;font-size:12px;margin-left:6px;}
.tw-field input[type=text],.tw-field input[type=number],.tw-field select,.tw-field textarea{
    width:100%;box-sizing:border-box;border:1px solid #e4e7ed;border-radius:8px;padding:10px 12px;font-size:14px;color:#1f2329;outline:none;transition:.15s;font-family:inherit;background:#fff;line-height:1.5;
}
.tw-field input:focus,.tw-field select:focus,.tw-field textarea:focus{border-color:#2563eb;box-shadow:0 0 0 3px rgba(37,99,235),.1);}
.tw-field textarea{min-height:140px;resize:vertical;line-height:1.65;padding-bottom:28px;}
.tw-field select{cursor:pointer;appearance:none;-webkit-appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23909399' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 10px center;padding-right:30px;}
.tw-check{display:flex;align-items:center;gap:8px;}
.tw-check input{width:16px;height:16px;}
.tw-field-hint{font-size:12px;color:#909399;margin-top:6px;line-height:1.5;}
/* 颜色取色器（控件 control:color）：原生色块 + 十六进制文本框并排 */
.tw-color-wrap{display:flex;align-items:center;gap:8px;}
.tw-color-wrap input[type=color]{width:44px;height:30px;padding:2px;border:1px solid #dcdfe6;border-radius:6px;background:#fff;cursor:pointer;flex:none;}
.tw-color-hex{flex:1;min-width:0;height:30px;padding:0 8px;border:1px solid #dcdfe6;border-radius:6px;font-size:13px;font-family:ui-monospace,Menlo,Consolas,monospace;color:#303133;}
/* 背景色 / 单项选择 单选组（控件 control:radio） */
.tw-radio-group{display:flex;flex-wrap:wrap;gap:10px;}
.tw-radio{display:inline-flex;align-items:center;gap:7px;cursor:pointer;font-size:13px;color:#374151;border:1px solid #d0d5dd;border-radius:999px;padding:6px 14px;transition:.15s;user-select:none;background:#fff;}
.tw-radio:hover{border-color:#2563eb;}
.tw-radio input{position:absolute;opacity:0;width:0;height:0;}
.tw-radio-dot{width:14px;height:14px;border-radius:50%;border:1px solid #c0c4cc;display:inline-block;box-sizing:border-box;flex:none;}
.tw-radio.active{border-color:#2563eb;color:#2563eb;background:#f0f7ff;}
.tw-radio.active .tw-radio-dot{border-color:#2563eb;box-shadow:inset 0 0 0 3px #2563eb;}
/* 模板卡片组（控件 control:radio-cards）：带背景色/边框色缩略图，可选 PRO 角标 */
.tw-radio-cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;}
.tw-rcard{display:flex;align-items:center;gap:8px;padding:8px 10px;border:1px solid #d0d5dd;border-radius:8px;background:#fff;cursor:pointer;font-size:13px;color:#374151;transition:.15s;user-select:none;}
.tw-rcard:hover{border-color:#d97706;}
.tw-rcard.active{border-color:#d97706;box-shadow:0 0 0 2px rgba(217,119,6,.15);background:#fffbf5;}
.tw-rcard-thumb{flex:0 0 auto;width:30px;height:40px;border-radius:3px;box-sizing:border-box;background:#fff;}
.tw-rcard-label{line-height:1.3;}
.tw-rcard-pro{position:relative;}
.tw-rcard-pro::after{content:'PRO';position:absolute;top:-6px;right:-6px;background:#4f46e5;color:#fff;font-size:10px;line-height:1;padding:3px 5px;border-radius:4px;font-weight:700;letter-spacing:.5px;}
/* 图片上传控件（file 字段 + control:image-upload）：上传按钮 + 缩略图 + 恢复内置 */
.tw-upload-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap;}
.tw-upload-thumb{max-width:96px;max-height:64px;border:1px solid #e5e7eb;border-radius:6px;display:block;}
.tw-btn-mini{border:1px solid #d0d5dd;background:#fff;border-radius:6px;padding:6px 12px;font-size:13px;color:#374151;cursor:pointer;transition:.12s;}
.tw-btn-mini:hover{border-color:#2563eb;color:#2563eb;}
/* 滑动条（控件 control:range） */
.tw-range-wrap{display:flex;align-items:center;gap:14px;}
.tw-range-wrap input[type=range]{flex:1;accent-color:#2563eb;height:4px;}
.tw-range-val{font-size:13px;color:#2563eb;font-weight:600;min-width:36px;text-align:right;}
/* 多选 checkbox 组（控件 control:checkbox-group）：多个独立开关并存 */
.tw-grid-wrap{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;}
.tw-grid-wrap .tw-cb-item{display:flex;align-items:center;gap:6px;padding:6px 10px;border:1px solid #e4e7ed;border-radius:6px;background:#fff;cursor:pointer;font-size:13px;color:#374151;transition:.12s;}
.tw-grid-wrap .tw-cb-item:hover{border-color:#2563eb;color:#2563eb;}
.tw-grid-wrap .tw-cb-item input[type=checkbox]{accent-color:#2563eb;cursor:pointer;}
.tw-grid-wrap .tw-cb-item.checked{border-color:#2563eb;background:#f0f7ff;color:#2563eb;}
/* 胶囊 chip 单选组（控件 control:chips）：横向排列、自动换行的药丸按钮 */
.tw-chips{display:flex;flex-wrap:wrap;gap:8px;}
.tw-chips .tw-chip{padding:5px 14px;border:1px solid #e4e7ed;border-radius:999px;background:#fff;font-size:13px;line-height:20px;color:#4b5563;cursor:pointer;transition:.12s;user-select:none;}
.tw-chips .tw-chip:hover{border-color:#2563eb;color:#2563eb;}
.tw-chips .tw-chip.active{border-color:#2563eb;background:#2563eb;color:#fff;}
/* 高级设置折叠分组（字段带 group 属性） */
.tw-group{border:1px solid #eceef1;border-radius:12px;padding:6px 16px;margin-bottom:14px;background:#fafbfc;overflow:hidden;}
.tw-group > summary{cursor:pointer;font-size:14px;font-weight:600;color:#1f2329;padding:8px 0;outline:none;list-style:none;}
.tw-group > summary::-webkit-details-marker{display:none;}
.tw-group > summary::before{content:'▸';display:inline-block;margin-right:8px;color:#909399;transition:.15s;}
.tw-group[open] > summary::before{transform:rotate(90deg);}
/* 高级选项紧凑栅格：短选项（下拉/勾选）一行多列，避免页面过高 */
.tw-opt-grid{display:flex;flex-wrap:wrap;align-items:flex-start;gap:14px 18px;margin-bottom:18px;}
.tw-opt-grid .tw-field{flex:1 1 120px;min-width:100px;margin-bottom:0;}
.tw-opt-grid .tw-field label{margin-bottom:6px;}

/* 模式 Tab */
.tw-tabs{display:flex;width:100%;border:1px solid #e4e7ed;border-radius:8px;overflow:hidden;background:#fff;}
.tw-tab{display:flex;flex:1;align-items:center;justify-content:center;gap:6px;background:#fff;border:0;padding:9px 22px;font-size:14px;color:#606266;cursor:pointer;border-right:1px solid #f0f2f5;transition:.12s;}
.tw-tab:last-child{border-right:0;}
.tw-tab:hover{background:#f5f9ff;color:#2563eb;}
.tw-tab.active{background:#f0f7ff;color:#2563eb;box-shadow:inset 3px 0 0 #2563eb;}
.tw-tab svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;}

/* 数字步进 */
.tw-numbox{display:flex;align-items:stretch;border:1px solid #e4e7ed;border-radius:8px;overflow:hidden;background:#fff;}
.tw-numbox input{flex:1;border:0;border-radius:0;text-align:left;min-width:0;padding:10px 12px;}
.tw-numbox .tw-step-wrap{display:flex;flex-direction:column;border-left:1px solid #e4e7ed;}
.tw-numbox button{width:32px;background:#f5f7fa;color:#606266;font-size:14px;cursor:pointer;user-select:none;line-height:1;border:0;flex:1;display:flex;align-items:center;justify-content:center;transition:.12s;}
.tw-numbox button:hover{background:#eef3fb;color:#2563eb;}
.tw-numbox button:first-child{border-bottom:1px solid #e4e7ed;}

/* 文本框工具栏 */
.tw-ta-wrap{position:relative;}
.tw-tb{position:absolute;top:8px;right:8px;display:flex;gap:6px;z-index:2;}
.tw-tb button{width:28px;height:28px;display:flex;align-items:center;justify-content:center;background:#fff;border:1px solid #e4e7ed;border-radius:6px;color:#909399;cursor:pointer;transition:.12s;padding:0;}
.tw-tb button svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;}
.tw-tb button:hover{color:#2563eb;border-color:#2563eb;}
.tw-cc{position:absolute;right:10px;bottom:8px;font-size:12px;color:#c0c4cc;background:rgba(255,255,255,.95);padding:2px 6px;border-radius:4px;z-index:2;pointer-events:none;}

.tw-actions{margin-top:18px;display:none;}
.tw-actions.custom-actions{display:flex;gap:10px;flex-wrap:wrap;}
.tw-actions .tw-run{background:linear-gradient(90deg,#2563eb,#4f46e5);color:#fff;border:0;border-radius:8px;padding:10px 24px;font-size:15px;font-weight:600;cursor:pointer;transition:.15s;box-shadow:0 4px 14px rgba(37,99,235,.25);}
.tw-actions .tw-run:hover{background:linear-gradient(90deg,#1d4ed8,#4338ca);}
.tw-actions .tw-run:disabled{opacity:.6;cursor:not-allowed;}
.tw-actions .tw-btn-sec{display:inline-flex;align-items:center;gap:6px;background:#fff;border:1px solid #d0d5dd;border-radius:8px;padding:9px 18px;font-size:14px;color:#374151;cursor:pointer;transition:.15s;}
.tw-actions .tw-btn-sec:hover{border-color:#2563eb;color:#2563eb;background:#f8fafc;}
.tw-actions .tw-btn-sec svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;}

/* 结果区 */
.tw-right .tw-card{padding:0;overflow:hidden;}
.tw-result-hd{display:flex;align-items:center;justify-content:space-between;padding:14px 18px;border-bottom:1px solid #f0f2f5;}
.tw-result-hd span{font-size:15px;font-weight:600;color:#1f2329;}
.tw-copy{width:32px;height:32px;display:flex;align-items:center;justify-content:center;background:#fff;border:1px solid #e4e7ed;border-radius:8px;color:#909399;cursor:pointer;transition:.15s;padding:0;}
.tw-copy svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;}
.tw-copy:hover{background:#f5f7fa;border-color:#2563eb;color:#2563eb;}
.tw-copy.ok{background:#e6f7ed;border-color:#34c759;color:#1e8a43;}
.tw-out-wrap{padding:18px;background:#fff;position:relative;}
.tw-out{background:#f8f9fa;color:#1f2329;border-radius:10px;padding:16px;font:13.5px/1.65 ui-monospace,SFMono-Regular,Menlo,monospace;white-space:pre-wrap;word-break:break-all;min-height:140px;}
.tw-out.err{background:#fef2f2;color:#b91c1c;}
.tw-placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:180px;color:#c0c4cc;text-align:center;padding:24px;background:#f8f9fa;border-radius:10px;}
.tw-placeholder .tw-arrow{font-size:38px;color:#dcdfe6;margin-bottom:10px;line-height:1;}
.tw-out-cc{position:absolute;right:26px;bottom:26px;font-size:12px;color:#c0c4cc;background:rgba(248,249,250,.95);padding:2px 6px;border-radius:4px;pointer-events:none;}

/* 说明 */
.tw-usage{margin-top:24px;background:#fff;border:1px solid #eceef1;border-radius:16px;padding:4px 0;overflow:hidden;box-shadow:0 4px 20px rgba(0,0,0,.04);}
.tw-usage details{border-top:1px solid #f0f2f5;}
.tw-usage details:first-child{border-top:0;}
.tw-usage summary{cursor:pointer;padding:15px 20px;font-size:15px;font-weight:600;color:#1f2329;list-style:none;display:flex;align-items:center;gap:8px;user-select:none;}
.tw-usage summary::-webkit-details-marker{display:none;}
.tw-usage summary::before{content:"▸";color:#2563eb;font-size:12px;transition:.15s;}
.tw-usage details[open] summary::before{transform:rotate(90deg);}
.tw-usage .u-body{padding:0 20px 18px;font-size:14px;line-height:1.85;color:#4a5159;}
.tw-usage .u-body p{margin:0 0 10px;}
.tw-usage .u-body p:last-child{margin-bottom:0;}
.tw-usage .u-body code{background:#f0f2f5;padding:2px 6px;border-radius:4px;font-family:ui-monospace,Menlo,monospace;font-size:12.5px;color:#c0392b;}

.tw-footer{max-width:1120px;margin:28px auto 0;padding:18px 16px;color:#c0c4cc;font-size:13px;text-align:center;}
.tw-toast{position:fixed;left:50%;top:24px;transform:translateX(-50%);background:#1f2329;color:#fff;padding:9px 18px;border-radius:8px;font-size:13.5px;z-index:99;opacity:0;transition:.25s;pointer-events:none;}
.tw-toast.show{opacity:1;}

@media(max-width:820px){
    .tw-main{flex-direction:column;}
    .tw-left{width:100%;max-width:none;flex:none;}
    .tw-right{width:100%;max-width:none;position:static;}
    body[data-tw-left="fixed"] .tw-left{width:100%;max-width:none;}
    body[data-tw-left="fixed"] .tw-right{width:100%;max-width:none;}
    .tw-head-side{align-items:flex-start;width:100%;}
    .tw-ops,.tw-meta-line{justify-content:flex-start;}
}
