:root {
  --bg: #08080a;
  --panel: rgba(26, 26, 30, .88);
  --panel-solid: #1a1a1e;
  --line: #2d2d33;
  --line-soft: #242429;
  --text: #e8e8ec;
  --muted: #8b8b96;
  --blue: #3b82f6;
  --blue-2: #2f6fe4;
  --radius: 10px;
  --lib-w: 244px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 15px; }
button, input, textarea, select { font-family: inherit; }
button { cursor: pointer; }
#app { height: 100vh; display: flex; flex-direction: column; }

/* 顶栏 */
.topbar { height: 48px; flex: 0 0 48px; background: #0b0b0d; border-bottom: 1px solid #1c1c20; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; z-index: 30; }
.top-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; letter-spacing: .2px; }
.top-logo { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, #4b9bff, #7b6cff); display: grid; place-items: center; font-size: 13px; }
.top-right { display: flex; align-items: center; gap: 18px; }
.top-status { display: flex; align-items: center; gap: 8px; color: #9a9aa5; font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #f5b544; display: inline-block; }
.dot.ok { background: #35d39a; }
.dot.demo { background: #7b6cff; }
.top-icon { background: none; border: 0; color: #9a9aa5; font-size: 20px; padding: 4px; border-radius: 6px; }
.top-icon:hover { color: #fff; background: #1a1a20; }

/* 视口 */
.stage { flex: 1; position: relative; min-height: 0; }
.viewport { position: absolute; inset: 0 var(--lib-w) 0 0; background: radial-gradient(ellipse at 50% 38%, #151922 0%, #0a0b0f 62%, #060608 100%); overflow: hidden; transition: right .2s ease; }
.stage.lib-hidden .viewport { right: 0; }
.viewport canvas { display: block; width: 100%; height: 100%; }
.stage-glow { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 65% 60%, rgba(48,76,130,.08), transparent 60%); z-index: 1; }
.viewport-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #656571; pointer-events: none; z-index: 2; font-size: 17px; }
.empty-icon { font-size: 56px; color: #2f3b52; }
.empty-sub { color: #4d4d58; font-size: 13px; }
.viewport-tools { position: absolute; right: 18px; top: 16px; display: flex; gap: 8px; z-index: 5; }
.viewport-tools button { width: 36px; height: 36px; border-radius: 8px; border: 1px solid #2a2a31; background: rgba(18,18,22,.8); color: #a0a0ac; font-size: 18px; }
.viewport-tools button:hover { color: #fff; border-color: #3b82f6; }
.model-stats { position: absolute; right: 18px; top: 62px; z-index: 5; background: rgba(18,18,22,.78); border: 1px solid #26262c; border-radius: 8px; padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; min-width: 148px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.stage.lib-hidden .model-stats { right: 56px; }
.model-stats .row { display: flex; justify-content: space-between; gap: 16px; }
.stat-k { color: #8b8b96; }
.stat-v { color: #e8e8ec; font-weight: 600; font-variant-numeric: tabular-nums; }

/* 底部中央工具栏 */
.viewer-dock { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 10px; background: rgba(16,16,20,.9); border: 1px solid #2a2a31; border-radius: 12px; padding: 8px 12px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.dock-modes { display: flex; gap: 8px; }
.dock-btn { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; background: #1c1c22; display: grid; place-items: center; padding: 0; }
.dock-btn:hover { border-color: #3b82f6; }
.dock-btn.active { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,.25); }
.dock-btn.icon { color: #b9b9c4; font-size: 15px; }
.dock-btn .swatch { width: 18px; height: 18px; border-radius: 50%; display: block; }
.sw-clay { background: radial-gradient(circle at 32% 30%, #f2f3f5, #b9bcc4 70%); }
.sw-wire { background: repeating-linear-gradient(45deg, rgba(53,80,122,.85) 0 1px, transparent 1px 5px), radial-gradient(circle at 32% 30%, #f2f3f5, #b9bcc4 70%); }
.sw-tex { background: conic-gradient(#e5533f, #e8b23a, #3fae6a, #3b82f6, #8b5cf6, #e5533f); }
.sw-alb { background: radial-gradient(circle at 32% 30%, #ffd9a8, #e2834f 75%); }
.sw-nrm { background: linear-gradient(135deg, #7aa2ff, #b06ad6 55%, #ff8bb0); }
.sw-lit { background: radial-gradient(circle at 34% 30%, #ffffff 0 18%, #d8d4c8 45%, #6d6a60 100%); }
.dock-sep { width: 1px; height: 22px; background: #33343c; }
.dock-download { position: relative; }
.dl-btn { height: 32px; padding: 0 14px; border-radius: 8px; border: 0; background: linear-gradient(100deg, #2f6fe4, #4f8dff); color: #fff; font-weight: 700; font-size: 13px; }
.dl-btn:hover { filter: brightness(1.08); }
.dl-menu { position: absolute; bottom: calc(100% + 8px); right: 0; background: #1b1b20; border: 1px solid #2e2e36; border-radius: 8px; padding: 6px; display: flex; flex-direction: column; min-width: 96px; box-shadow: 0 12px 30px rgba(0,0,0,.5); z-index: 8; }
.dl-menu button { background: none; border: 0; color: #c9c9d3; text-align: left; padding: 7px 10px; border-radius: 6px; font-size: 13px; }
.dl-menu button:hover { background: #26262e; color: #fff; }
.dl-menu button.na { color: #55555f; }

/* 场景设置（灯光）面板 */
.scene-panel { position: absolute; right: 18px; bottom: 74px; width: 232px; background: rgba(20,20,24,.96); border: 1px solid #2c2c33; border-radius: 12px; padding: 14px; z-index: 7; box-shadow: 0 16px 44px rgba(0,0,0,.5); }
.stage.lib-hidden .scene-panel { right: 56px; }
.sp-head { display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.sp-actions { display: flex; gap: 4px; }
.sp-actions button { background: none; border: 0; color: #8b8b96; font-size: 15px; padding: 2px 5px; border-radius: 5px; }
.sp-actions button:hover { color: #fff; background: #26262c; }
.sp-label { color: #9a9aa5; font-size: 12px; margin: 10px 0 6px; }
.dial { position: relative; width: 120px; height: 120px; margin: 4px auto 2px; border-radius: 50%; background: radial-gradient(circle, #26262c 0 60%, #1b1b20 61%); border: 1px solid #303038; cursor: pointer; touch-action: none; }
.dial-ball { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; transform: translate(-50%,-50%); border-radius: 50%; background: radial-gradient(circle at 35% 30%, #f4f5f7, #a9adb6 75%); }
.dial-sun { position: absolute; font-size: 15px; color: #ffd76a; transform: translate(-50%,-50%); pointer-events: none; text-shadow: 0 0 8px rgba(255,200,80,.8); }
.sp-color-row { display: flex; gap: 8px; align-items: center; }
.sp-color-row input[type=color] { width: 34px; height: 30px; padding: 2px; border: 1px solid #2c2c33; border-radius: 6px; background: #101014; cursor: pointer; }
.sp-color-row input[type=text] { flex: 1; }
.sp-slider-row { display: flex; justify-content: space-between; align-items: center; color: #9a9aa5; font-size: 12px; margin: 10px 0 4px; }
.sp-val { color: #e8e8ec; background: #111116; border: 1px solid #26262c; border-radius: 5px; padding: 1px 8px; font-size: 12px; font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; accent-color: #3b82f6; }

.result-dock { position: absolute; right: 18px; bottom: 18px; max-width: 420px; background: rgba(20,20,24,.92); border: 1px solid #2c2c33; border-radius: 10px; padding: 12px 14px; z-index: 6; }
.result-head { display: flex; justify-content: space-between; gap: 14px; font-size: 13px; margin-bottom: 10px; color: #aaaab4; }
code { background: #111116; padding: 2px 6px; border-radius: 4px; color: #8fb6ff; font-size: 12px; }
.file-list { display: flex; flex-wrap: wrap; gap: 10px; }
.file-chip { display: flex; align-items: center; gap: 10px; background: #121217; border: 1px solid #2a2a31; border-radius: 8px; padding: 9px 11px; font-size: 13px; }
.file-chip img { width: 46px; height: 46px; object-fit: cover; border-radius: 6px; }
.file-chip a { color: #8fb6ff; text-decoration: none; font-size: 13px; }
.file-chip a:hover { text-decoration: underline; }
.toast { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); background: rgba(24,24,28,.94); border: 1px solid #333; border-radius: 8px; padding: 10px 16px; color: #ccc; z-index: 40; font-size: 14px; }

/* 悬浮控制面板 */
.panel { position: absolute; left: 12px; top: 12px; bottom: 12px; width: 268px; background: var(--panel); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border: 1px solid #303036; border-radius: var(--radius); z-index: 10; display: flex; flex-direction: column; box-shadow: 0 12px 40px rgba(0,0,0,.45); transition: transform .18s ease; }
.panel.collapsed { transform: translateX(calc(-100% - 14px)); }
.panel.collapsed::after { content: '⇤'; position: absolute; right: -34px; top: 12px; width: 30px; height: 30px; border: 1px solid #303036; border-radius: 8px; background: rgba(26,26,30,.9); color: #aaa; display: grid; place-items: center; cursor: pointer; font-size: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 14px 15px 12px; border-bottom: 1px solid var(--line-soft); }
.panel-title { font-weight: 700; font-size: 17px; }
.panel-sub { color: #7d7d88; font-size: 13px; margin-top: 3px; }
.collapse-btn { background: none; border: 0; color: #7d7d88; font-size: 17px; padding: 0 2px; }
.panel-scroll { padding: 14px 15px; overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: #333 transparent; }
.panel-scroll::-webkit-scrollbar { width: 6px; }
.panel-scroll::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

.segmented { display: flex; background: #101014; border: 1px solid #2a2a30; border-radius: 8px; padding: 4px; margin-bottom: 12px; }
.seg { flex: 1; border: 0; background: transparent; color: #8b8b96; padding: 9px 0; border-radius: 6px; font-size: 14px; }
.seg.active { background: linear-gradient(135deg, #3b82f6, #5b7cff); color: #fff; font-weight: 600; }
.dual { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.dual-btn { background: #141418; border: 1px solid #2c2c33; color: #92929d; border-radius: 7px; padding: 9px 2px; font-size: 13px; }
.dual-btn.active { border-color: #3b82f6; color: #9dc2ff; background: rgba(59,130,246,.12); }
.label { display: block; color: #a9a9b4; font-size: 13px; margin-bottom: 6px; }
.tip { color: #70707c; font-size: 12px; line-height: 1.6; margin-top: 6px; }
textarea, input[type=text], input[type=password], select { width: 100%; background: #101014; border: 1px solid #2c2c33; color: #e2e2e8; border-radius: 7px; padding: 9px 10px; outline: none; font-size: 13px; }
textarea:focus, input:focus, select:focus { border-color: #3b82f6; }
textarea { resize: vertical; line-height: 1.6; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #777 50%), linear-gradient(135deg, #777 50%, transparent 50%); background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 26px; }
.dropzone { border: 1px dashed #35353d; border-radius: 9px; background: #101014; min-height: 106px; display: grid; place-items: center; text-align: center; cursor: pointer; position: relative; overflow: hidden; }
.dropzone:hover { border-color: #3b82f6; }
.dropzone.drag { border-color: #3b82f6; background: rgba(59,130,246,.08); }
.drop-inner { padding: 12px; color: #84848f; font-size: 13px; }
.upload-icon { font-size: 24px; color: #5b8cff; margin-bottom: 4px; }
#imagePreview { max-width: 100%; max-height: 170px; display: block; }
.add-ref { width: 100%; margin-top: 12px; background: #141418; border: 1px solid #2c2c33; color: #9a9aa5; border-radius: 7px; padding: 9px; font-size: 13px; }
.add-ref:hover { border-color: #3b82f6; color: #9dc2ff; }
.limit-hint { color: #70707c; font-size: 12px; margin: 10px 0 16px; }
.section-title { color: #b6b6c0; font-size: 14px; font-weight: 600; margin: 16px 0 8px; }
.beta { background: rgba(59,130,246,.16); color: #79aaff; font-size: 11px; padding: 2px 6px; border-radius: 5px; margin-left: 5px; font-weight: 500; }
.face-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.face-presets button { background: #141418; border: 1px solid #2c2c33; color: #8d8d98; border-radius: 6px; padding: 8px 0; font-size: 12px; }
.face-presets button.active { border-color: #3b82f6; background: rgba(59,130,246,.14); color: #9dc2ff; }
.custom-face { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
#faceCountLabel { color: #9dc2ff; font-size: 12px; min-width: 52px; text-align: right; font-variant-numeric: tabular-nums; }
.texture-row { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; color: #b6b6c0; font-size: 14px; }
.texture-row.compact { margin-top: 0; font-size: 13px; color: #a9a9b4; }
#faceCountBody { margin-top: 8px; }
.info { color: #70707c; font-size: 12px; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: 0 0 38px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: #3a3a44; border-radius: 22px; transition: .2s; }
.slider:before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: #3b82f6; }
.switch input:checked + .slider:before { transform: translateX(16px); }
.mode-tabs { display: flex; gap: 6px; margin-top: 14px; }
.mode-tab { flex: 1; background: #141418; border: 1px solid #2c2c33; color: #8d8d98; border-radius: 6px; padding: 8px 0; font-size: 13px; }
.mode-tab.active { border-color: #3b82f6; color: #9dc2ff; background: rgba(59,130,246,.12); }
.more { margin-top: 16px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.more summary { cursor: pointer; color: #9a9aa5; font-size: 13px; list-style: none; }
.more-body { padding-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.switch-row { display: flex; align-items: center; gap: 10px; color: #a9a9b4; margin-top: 10px; font-size: 13px; }
.generate-btn { width: 100%; margin-top: 16px; background: linear-gradient(100deg, #2f6fe4, #4f8dff); border: 0; border-radius: 8px; color: #fff; padding: 12px; font-size: 15px; font-weight: 700; box-shadow: 0 6px 18px rgba(47,111,228,.25); }
.generate-btn:hover { filter: brightness(1.08); }
.generate-btn:disabled { opacity: .5; cursor: not-allowed; }
.submit-msg { color: #83838e; font-size: 12px; min-height: 18px; margin-top: 8px; line-height: 1.5; }
.submit-msg.error { color: #ff7272; }

/* 右侧多视图卡片 */
.mv-card { position: absolute; left: 292px; top: 12px; width: 340px; max-height: calc(100% - 24px); background: rgba(26,26,30,.95); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid #303036; border-radius: 12px; z-index: 12; display: flex; flex-direction: column; box-shadow: 0 16px 48px rgba(0,0,0,.5); }
.panel.collapsed ~ .mv-card { left: 58px; }
.mv-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); flex: 0 0 auto; }
.mv-title { font-size: 16px; font-weight: 700; }
.mv-sub { color: #7d7d88; font-size: 12px; margin-top: 3px; }
.mv-close { background: none; border: 0; color: #8b8b96; font-size: 22px; line-height: 1; padding: 0 2px; }
.mv-close:hover { color: #fff; }
.mv-body { flex: 0 1 auto; min-height: 0; overflow-y: auto; padding: 14px 16px; scrollbar-width: thin; transition: box-shadow .15s, background .15s; }
.mv-body.dragover { background: rgba(59,130,246,.08); box-shadow: inset 0 0 0 2px rgba(59,130,246,.5); }
.mv-grid { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 92px; gap: 9px; }
.mv-slot { position: relative; border: 1px dashed #3a3a43; border-radius: 8px; background: #101014; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; cursor: pointer; overflow: hidden; color: #8b8b96; font-size: 12px; transition: border-color .15s, background .15s; }
.mv-slot:hover { border-color: #3b82f6; background: rgba(59,130,246,.07); }
.mv-slot.dragover { border-color: #4f8dff; border-style: solid; background: rgba(59,130,246,.2); box-shadow: inset 0 0 0 1px #4f8dff; }
.mv-slot.required { border-color: rgba(91,140,255,.6); background: rgba(59,130,246,.07); }
.mv-slot.filled { border-style: solid; border-color: rgba(59,130,246,.6); }
.mv-slot.filled img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mv-slot.disabled { opacity: .28; cursor: not-allowed; }
.mv-slot.disabled:hover { border-color: #3a3a43; background: #101014; }
.mv-slot .slot-icon { font-size: 20px; color: #5b8cff; line-height: 1; z-index: 1; }
.mv-slot .slot-name { position: relative; z-index: 1; text-align: center; padding: 0 2px; text-shadow: 0 1px 3px #000; }
.mv-slot.filled .slot-name { position: absolute; bottom: 4px; left: 0; right: 0; color: #fff; }
.mv-slot .slot-del { position: absolute; top: 4px; right: 4px; z-index: 2; width: 19px; height: 19px; border: 0; border-radius: 50%; background: rgba(0,0,0,.7); color: #fff; font-size: 13px; line-height: 19px; padding: 0; }
.mv-slot .slot-badge { position: absolute; top: 4px; left: 4px; z-index: 2; font-size: 10px; padding: 1px 4px; border-radius: 4px; background: rgba(0,0,0,.6); color: #9dc2ff; }
.mv-center { border: 1px solid rgba(91,140,255,.28); border-radius: 8px; background: radial-gradient(circle at 50% 45%, rgba(59,130,246,.18), rgba(16,16,20,.6) 70%); display: grid; place-items: center; color: #6ea8ff; font-size: 30px; }
.mv-tip { color: #70707c; font-size: 12px; line-height: 1.6; margin-top: 12px; }

/* 右侧我的资源库 */
.library { position: absolute; right: 0; top: 0; bottom: 0; width: var(--lib-w); background: #101014; border-left: 1px solid #232329; z-index: 8; display: flex; flex-direction: column; transition: transform .2s ease; }
.stage.lib-hidden .library { transform: translateX(100%); }
.stage.lib-hidden .viewport-tools { right: 56px; }
.lib-restore { position: absolute; right: 12px; top: 12px; z-index: 9; width: 30px; height: 30px; border: 1px solid #303036; border-radius: 8px; background: rgba(26,26,30,.92); color: #aaa; display: grid; place-items: center; font-size: 16px; }
.lib-restore:hover { color: #fff; border-color: #3b82f6; }
.lib-head { height: 50px; flex: 0 0 50px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid #222228; }
.lib-tab { background: linear-gradient(135deg, #3b82f6, #5b7cff); color: #fff; font-weight: 600; font-size: 14px; padding: 7px 18px; border-radius: 7px; }
.lib-count { color: #6f6f7b; font-size: 12px; }
.lib-collapse { margin-left: auto; background: none; border: 0; color: #7d7d88; font-size: 18px; padding: 4px; border-radius: 6px; }
.lib-collapse:hover { color: #fff; background: #1c1c22; }
.lib-toolbar { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid #1e1e24; }
.lib-tool { width: 30px; height: 28px; border: 1px solid #2a2a31; border-radius: 6px; background: #17171c; color: #85858f; font-size: 15px; display: grid; place-items: center; }
.lib-tool:hover { color: #fff; border-color: #3b82f6; }
.lib-tool.active { border-color: #3b82f6; color: #9dc2ff; background: rgba(59,130,246,.14); }
.lib-refresh { margin-left: auto; }
.lib-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; scrollbar-width: thin; scrollbar-color: #333 transparent; }
.lib-scroll::-webkit-scrollbar { width: 6px; }
.lib-scroll::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
.lib-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lib-grid.list { grid-template-columns: 1fr; gap: 7px; }
.lib-card { position: relative; aspect-ratio: 1 / 1; border: 1px solid #2a2a31; border-radius: 8px; background: linear-gradient(160deg, #232329, #17171c); overflow: hidden; cursor: pointer; transition: border-color .15s, transform .15s; }
.lib-card:hover { border-color: #5b8cff; transform: translateY(-1px); }
.lib-card.selected { border: 2px solid #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,.22); }
.lib-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-card .ph { position: absolute; inset: 0; display: grid; place-items: center; background: radial-gradient(circle at 50% 42%, rgba(59,130,246,.18), rgba(16,16,20,.5) 72%); color: #5b8cff; font-size: 30px; }
.lib-card .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 6px 5px; background: linear-gradient(transparent, rgba(0,0,0,.82)); color: #ddd; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity .15s; }
.lib-card:hover .cap { opacity: 1; }
.lib-card .status { position: absolute; top: 5px; left: 5px; font-size: 10px; padding: 1px 5px; border-radius: 4px; background: rgba(0,0,0,.72); }
.lib-card .status.s-wait { color: #e8c268; }
.lib-card .status.s-run { color: #7fb2ff; }
.lib-card .status.s-fail { color: #ff8a8a; }
.lib-card .status.s-run::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #7fb2ff; margin-right: 4px; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.lib-card .del { position: absolute; top: 4px; right: 4px; width: 18px; height: 18px; border: 0; border-radius: 50%; background: rgba(0,0,0,.75); color: #fff; font-size: 12px; line-height: 18px; padding: 0; opacity: 0; transition: opacity .15s; }
.lib-card:hover .del { opacity: 1; }
.lib-card .del:hover { background: #d04545; }
.lib-grid.list .lib-card { aspect-ratio: auto; height: 58px; display: flex; align-items: center; gap: 10px; padding: 6px; }
.lib-grid.list .lib-card img, .lib-grid.list .lib-card .ph { position: relative; inset: auto; width: 44px; height: 44px; flex: 0 0 44px; border-radius: 6px; font-size: 22px; }
.lib-grid.list .lib-card .cap { position: static; opacity: 1; background: none; padding: 0; font-size: 12px; flex: 1; }
.lib-grid.list .lib-card .status { position: static; flex: 0 0 auto; }
.lib-grid.list .lib-card .del { position: static; opacity: 1; flex: 0 0 auto; margin-left: auto; }
.lib-empty { color: #5f5f6b; font-size: 13px; text-align: center; line-height: 1.9; padding: 42px 8px; }

/* 设置弹窗 */
.modal-mask { position: absolute; inset: 0; background: rgba(0,0,0,.62); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); z-index: 50; display: grid; place-items: center; }
.modal { width: 560px; max-width: calc(100vw - 32px); max-height: calc(100vh - 80px); background: #16161a; border: 1px solid #34343c; border-radius: 14px; box-shadow: 0 24px 80px rgba(0,0,0,.6); display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #26262c; }
.modal-head h2 { font-size: 18px; margin: 0; }
.modal-head button { background: none; border: 0; color: #8b8b96; font-size: 24px; line-height: 1; }
.modal-head button:hover { color: #fff; }
.modal-tabs { display: flex; border-bottom: 1px solid #26262c; }
.modal-tab { flex: 1; background: none; border: 0; color: #82828d; padding: 12px 0; font-size: 14px; }
.modal-tab.active { color: #9dc2ff; box-shadow: inset 0 -2px #3b82f6; }
.badge { background: #26262e; border-radius: 10px; padding: 1px 6px; font-size: 11px; }
.modal-body { flex: 1; overflow-y: auto; padding: 20px; }
.modal-pane { display: none; }
.modal-pane.active { display: block; }
.keys { display: flex; flex-direction: column; gap: 8px; }
.key-status { background: #111116; border: 1px solid #2a2a31; border-radius: 8px; padding: 10px 12px; color: #9dc2ff; font-size: 13px; }
.keys a { color: #8fb6ff; }.keys a:hover { text-decoration: underline; }
.primary-btn { background: linear-gradient(100deg, #2f6fe4, #4f8dff); border: 0; border-radius: 8px; color: #fff; padding: 11px; font-size: 14px; font-weight: 700; }
.primary-btn:hover { filter: brightness(1.08); }
.logout-btn { margin-top: 6px; }
.ghost-btn { background: #141418; border: 1px solid #2c2c33; color: #9a9aa5; border-radius: 7px; padding: 8px 12px; font-size: 13px; }
.ghost-btn:hover { border-color: #3b82f6; color: #9dc2ff; }
.history-list { display: flex; flex-direction: column; gap: 9px; }
.history-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #121217; border: 1px solid #2a2a31; border-radius: 8px; padding: 11px 12px; }
.history-item .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }
.history-item .sub { color: #70707c; font-size: 12px; margin-top: 4px; }
.history-item button { background: none; border: 1px solid #2c2c33; color: #8fb6ff; border-radius: 6px; padding: 6px 9px; font-size: 12px; white-space: nowrap; }
.history-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.history-actions .del-btn { color: #ff8a8a; }
.clear-row { display: flex; align-items: center; gap: 12px; }
.empty { color: #70707c; text-align: center; padding: 30px 0; }

@media (max-width: 1100px) {
  :root { --lib-w: 210px; }
  .mv-card { width: 300px; }
  .mv-grid { grid-auto-rows: 82px; gap: 7px; }
  .lib-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  :root { --lib-w: 190px; }
  .panel { width: 248px; }
  .mv-card { width: 270px; left: 272px; }
  .modal { max-width: calc(100vw - 20px); }
}
