/* AI 工作台 / 会员中心: 左侧图标栏 + 顶栏 + 工具面板 + 画布 */
:root {
  --app-bg: #07090f;
  --panel: #0c0f18;
  --panel-2: #11151f;
  --panel-3: #171c29;
  --line-2: rgba(255, 255, 255, .07);
  --hover: rgba(255, 255, 255, .05);
  --rail-w: 76px;
  --top-h: 60px;
  --radius: 14px;
}
[hidden] { display: none !important; }
body.app-page { background: var(--app-bg); overflow: hidden; }
body.app-page::before { opacity: .35; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
kbd { font: 11px var(--mono); padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line-2); color: var(--muted); background: rgba(255, 255, 255, .03); }

.shell { display: grid; grid-template-columns: var(--rail-w) 1fr; height: 100vh; height: 100dvh; position: relative; z-index: 1; }

/* ---------- 图标栏 ---------- */
.rail { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 0; background: var(--panel); border-right: 1px solid var(--line-2); z-index: 20; }
.rail-logo { margin-bottom: 6px; display: grid; place-items: center; }
.rail-logo img { filter: drop-shadow(0 0 10px rgba(34, 211, 238, .5)); }
.rail-new { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: var(--grad); box-shadow: 0 6px 20px -6px rgba(139, 92, 246, .8); margin-bottom: 8px; transition: transform .15s; }
.rail-new:hover { transform: scale(1.06); }
.rail-nav { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; }
.rail-nav a { position: relative; width: 60px; padding: 8px 0 6px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; gap: 3px; color: #8d97b0; font-size: 10.5px; transition: background .15s, color .15s; }
.rail-nav a span { white-space: nowrap; max-width: 58px; overflow: hidden; text-overflow: ellipsis; }
.rail-nav a:hover { background: var(--hover); color: var(--fg); }
.rail-nav a.on { background: rgba(34, 211, 238, .1); color: #fff; }
.rail-nav a.on .ic { color: var(--cyan); }
.rail-sep { width: 28px; height: 1px; background: var(--line-2); margin: 8px 0; }
.rail-bottom { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.rail-lang { width: 36px; height: 30px; border-radius: 9px; display: grid; place-items: center; font: 600 12px var(--mono); color: var(--muted); border: 1px solid var(--line-2); }
.rail-lang:hover { color: var(--fg); border-color: var(--cyan); }
.rail-avatar { width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer; font: 700 15px var(--display); color: #fff; background: linear-gradient(135deg, #0e7490, #6d28d9); }
.menu-wrap { position: relative; }
.menu { position: absolute; z-index: 60; min-width: 220px; padding: 6px; border-radius: 12px; background: var(--panel-3); border: 1px solid var(--line-2); box-shadow: 0 20px 50px -10px rgba(0, 0, 0, .7); }
.menu-up { left: calc(100% + 10px); bottom: 0; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 8px; font: inherit; font-size: 14px; color: #cfd6ea; background: none; border: 0; cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--hover); color: #fff; }
.menu .ic { width: 17px; height: 17px; color: var(--muted); }
.menu form { margin: 0; border-top: 1px solid var(--line-2); margin-top: 4px; padding-top: 4px; }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; }
.menu-head b { display: block; font-size: 14px; }
.menu-head span { font-size: 12px; color: var(--muted); word-break: break-all; }

/* 图标栏悬停提示 */
@media (any-hover: hover) {
  .rail [data-tip]:hover::after { content: attr(data-tip); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%); white-space: nowrap; padding: 5px 10px; border-radius: 8px; font-size: 12px; color: #fff; background: #1e2536; border: 1px solid var(--line-2); pointer-events: none; z-index: 70; }
  .rail-lang { position: relative; }
}

/* ---------- 顶栏 ---------- */
.frame { display: flex; flex-direction: column; min-width: 0; height: 100vh; height: 100dvh; }
.topbar { flex: none; height: var(--top-h); display: flex; align-items: center; gap: 16px; padding: 0 22px; border-bottom: 1px solid var(--line-2); background: rgba(7, 9, 15, .7); backdrop-filter: blur(12px); }
.cmdk-btn { flex: 0 1 520px; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px 0 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; text-align: left; transition: border-color .15s; }
.cmdk-btn:hover { border-color: rgba(34, 211, 238, .4); }
.cmdk-btn span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cmdk-btn .ic { width: 18px; height: 18px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.top-link { font-size: 14px; color: var(--muted); padding: 0 6px; }
.top-link:hover { color: var(--fg); }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--panel-2); font-size: 14px; }
.pill .ic { width: 17px; height: 17px; color: #fbbf24; }
.pill.bump { animation: bump .6s; }
@keyframes bump { 30% { transform: scale(1.08); border-color: var(--cyan); } }
.upgrade span { display: inline-flex; align-items: center; gap: 6px; }
.upgrade .ic { width: 15px; height: 15px; }
.btn-sm { padding: 9px 16px; font-size: 14px; border-radius: 10px; }
.announce { flex: none; padding: 9px 22px; font-size: 13px; color: #a5f3fc; background: rgba(34, 211, 238, .06); border-bottom: 1px solid rgba(34, 211, 238, .15); }
.announce.warn { color: #fde68a; background: rgba(234, 179, 8, .06); border-color: rgba(234, 179, 8, .18); }
.announce form { display: inline; margin-left: 6px; }
.announce button.link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; color: var(--cyan); text-decoration: underline; }
.stage { flex: 1; min-height: 0; overflow-y: auto; position: relative; }

/* ---------- ⌘K ---------- */
.cmdk { position: fixed; inset: 0; z-index: 100; background: rgba(2, 4, 10, .6); backdrop-filter: blur(4px); display: flex; justify-content: center; padding: 12vh 16px 16px; }
.cmdk[hidden] { display: none; }
.cmdk-box { width: 100%; max-width: 620px; max-height: 70vh; display: flex; flex-direction: column; border-radius: 16px; background: var(--panel-3); border: 1px solid var(--line-2); box-shadow: 0 30px 80px -10px rgba(0, 0, 0, .8), var(--glow); overflow: hidden; }
.cmdk-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line-2); }
.cmdk-input input { flex: 1; height: 56px; border: 0; outline: 0; background: none; color: var(--fg); font: inherit; font-size: 16px; }
.cmdk-list { overflow-y: auto; padding: 6px; }
.cmdk-list a, .cmdk-ask { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.cmdk-list a span { flex: 1; min-width: 0; }
.cmdk-list a b, .cmdk-ask b { font-weight: 500; font-size: 14px; }
.cmdk-list a small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-list a em { font-style: normal; font-size: 11px; color: var(--muted); }
.cmdk-list a.on, .cmdk-ask.on { background: rgba(34, 211, 238, .1); }
.cmdk-list .ic, .cmdk-ask .ic { color: var(--cyan); }
.cmdk-ask { margin: 0 6px 6px; border-top: 1px solid var(--line-2); font-size: 14px; }
.cmdk-ask span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ---------- 工作台首页 ---------- */
.hub { max-width: 1180px; margin: 0 auto; padding: 44px 28px 70px; }
.hub-hero { text-align: center; margin-bottom: 38px; }
.hub-hero h1 { font-size: clamp(26px, 4vw, 40px); margin: 0 0 8px; letter-spacing: -.5px; }
.hub-hero p { margin: 0 0 26px; color: var(--muted); }
.ask-box { max-width: 760px; margin: 0 auto; text-align: left; border-radius: 18px; background: var(--panel-2); border: 1px solid var(--line-2); box-shadow: 0 20px 60px -20px rgba(139, 92, 246, .45); transition: border-color .2s, box-shadow .2s; }
.ask-box:focus-within { border-color: rgba(34, 211, 238, .45); box-shadow: 0 0 0 4px rgba(34, 211, 238, .08), 0 20px 60px -20px rgba(139, 92, 246, .6); }
.ask-box textarea { display: block; width: 100%; min-height: 64px; max-height: 220px; padding: 18px 20px 6px; border: 0; outline: 0; resize: none; background: none; color: var(--fg); font: inherit; font-size: 16px; line-height: 1.6; }
.ask-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px 12px 14px; flex-wrap: wrap; }
.ask-bar .seg { margin-right: auto; }
.send-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; display: grid; place-items: center; color: #fff; background: var(--grad); cursor: pointer; flex: none; transition: transform .15s, opacity .15s; }
.send-btn:disabled { opacity: .4; cursor: default; }
.send-btn:not(:disabled):hover { transform: scale(1.05); }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line-2); flex-wrap: wrap; }
.seg label, .seg a, .seg button { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px; font-size: 13px; color: var(--muted); cursor: pointer; border: 0; background: none; font-family: inherit; white-space: nowrap; }
.seg .ic { width: 15px; height: 15px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:hover, .seg a:hover { color: var(--fg); }
.seg input:checked + span, .seg a.on, .seg label.on { color: #fff; }
.seg label:has(input:checked), .seg a.on { background: var(--panel-3); color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset; }
.seg input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 4px; }

.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 40px 0 16px; flex-wrap: wrap; }
.sec-head h2 { margin: 0; font-size: 20px; }
.sec-head a.more { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.sec-head a.more:hover { color: var(--cyan); }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.tool-card { position: relative; display: flex; gap: 14px; padding: 18px; border-radius: var(--radius); background: var(--panel-2); border: 1px solid var(--line-2); transition: transform .15s, border-color .15s, background .15s; }
.tool-card:hover { transform: translateY(-2px); border-color: rgba(34, 211, 238, .35); background: var(--panel-3); }
.tool-ic { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; }
.tool-ic .ic { width: 22px; height: 22px; }
.tool-ic.cat-text { background: linear-gradient(135deg, #0891b2, #2563eb); }
.tool-ic.cat-image { background: linear-gradient(135deg, #7c3aed, #db2777); }
.tool-ic.cat-audio { background: linear-gradient(135deg, #059669, #0891b2); }
.tool-card b { display: block; font-size: 15px; margin-bottom: 3px; }
.tool-card p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.tag-new { position: absolute; top: 12px; right: 12px; font: 600 10px var(--mono); letter-spacing: 1px; padding: 2px 7px; border-radius: 99px; color: #f0abfc; background: rgba(236, 72, 153, .14); border: 1px solid rgba(236, 72, 153, .35); }
.hub-banner { display: flex; align-items: center; gap: 18px; justify-content: space-between; padding: 20px 24px; margin-top: 36px; border-radius: 16px; background: linear-gradient(110deg, rgba(34, 211, 238, .12), rgba(139, 92, 246, .14)); border: 1px solid rgba(139, 92, 246, .3); flex-wrap: wrap; }
.hub-banner b { font-size: 17px; }
.hub-banner p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

/* ---------- 工具页 ---------- */
.studio { display: grid; grid-template-columns: 380px 1fr; height: 100%; min-height: 0; }
.tpanel { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line-2); background: var(--panel); }
.tpanel-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--line-2); }
.crumb-back { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.crumb-back:hover { color: var(--cyan); }
.crumb-back .ic { width: 16px; height: 16px; }
.tool-title { display: flex; align-items: center; gap: 12px; }
.tool-title .tool-ic { width: 38px; height: 38px; border-radius: 10px; }
.tool-title b { font-size: 16px; display: block; }
.tool-title small { font-size: 12.5px; color: var(--muted); display: block; line-height: 1.45; }
.tool-switch { display: flex; gap: 6px; overflow-x: auto; margin-top: 14px; scrollbar-width: none; }
.tool-switch::-webkit-scrollbar { display: none; }
.tool-switch a { flex: none; font-size: 12.5px; padding: 5px 11px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--muted); }
.tool-switch a:hover { color: var(--fg); border-color: rgba(255, 255, 255, .2); }
.tool-switch a.on { color: #fff; border-color: rgba(34, 211, 238, .5); background: rgba(34, 211, 238, .1); }
.tpanel-body { flex: 1; overflow-y: auto; padding: 16px 18px 22px; }
.tpanel-foot { flex: none; padding: 14px 18px 16px; border-top: 1px solid var(--line-2); background: var(--panel); }
.cost-line { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.cost-line b { color: var(--fg); font-weight: 600; }
.gen-btn { width: 100%; height: 48px; font-size: 15px; }
.gen-btn kbd { margin-left: 10px; border-color: rgba(255, 255, 255, .25); color: rgba(255, 255, 255, .8); background: rgba(255, 255, 255, .1); }

.f-label { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 600; letter-spacing: .6px; color: #9aa4bf; text-transform: uppercase; margin: 0 0 8px; }
.f-label small { font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 12px; }
.fld { margin-bottom: 20px; }
.fld textarea.input { min-height: 120px; font-size: 14.5px; background: var(--panel-2); }
.fld .input { background: var(--panel-2); font-size: 14px; }
.examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.examples button { font: inherit; font-size: 12px; padding: 5px 10px; border-radius: 99px; border: 1px dashed var(--line); background: none; color: var(--muted); cursor: pointer; text-align: left; }
.examples button:hover { color: var(--fg); border-color: var(--cyan); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips label { position: relative; cursor: pointer; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips span { display: inline-block; padding: 6px 12px; border-radius: 9px; font-size: 13px; border: 1px solid var(--line-2); background: var(--panel-2); color: #b9c2da; transition: all .15s; }
.chips label:hover span { border-color: rgba(255, 255, 255, .2); color: #fff; }
.chips input:checked + span { color: #fff; border-color: var(--cyan); background: rgba(34, 211, 238, .12); }
.chips input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: 2px; }
.aspects { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.aspects label { position: relative; cursor: pointer; }
.aspects input { position: absolute; opacity: 0; pointer-events: none; }
.aspects span { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0 8px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); font: 11px var(--mono); color: var(--muted); transition: all .15s; }
.aspects i { display: block; border: 1.5px solid currentColor; border-radius: 3px; }
.aspects input:checked + span { color: #fff; border-color: var(--cyan); background: rgba(34, 211, 238, .12); }
.aspects input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: 2px; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input { flex: 1; accent-color: var(--cyan); }
.range-row output { font: 13px var(--mono); min-width: 40px; text-align: right; }

/* 模型选择 */
.model-pick { position: relative; }
.model-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--fg); font: inherit; font-size: 14px; cursor: pointer; text-align: left; }
.model-btn:hover { border-color: rgba(255, 255, 255, .2); }
.model-btn .m-dot { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: rgba(34, 211, 238, .12); color: var(--cyan); }
.model-btn .m-dot .ic { width: 15px; height: 15px; }
.model-btn b { flex: 1; font-weight: 500; }
.m-cost { font: 12px var(--mono); color: #fbbf24; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.m-cost .ic { width: 13px; height: 13px; }
.model-menu { left: 0; right: 0; top: calc(100% + 6px); max-height: 340px; overflow-y: auto; }
.model-menu button { flex-wrap: wrap; align-items: flex-start; }
.model-menu button .m-name { flex: 1; font-weight: 500; }
.model-menu button small { width: 100%; font-size: 12px; color: var(--muted); }
.model-menu button.sel { background: rgba(34, 211, 238, .08); }
.model-menu button.locked { opacity: .6; }
.lock-tag { font-size: 11px; color: #fde68a; display: inline-flex; gap: 3px; align-items: center; }
.lock-tag .ic { width: 12px; height: 12px; }

/* 画布 / 结果 */
.canvas { min-width: 0; overflow-y: auto; padding: 24px 28px 60px; }
.canvas-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; }
.canvas-head h2 { margin: 0; font-size: 16px; font-family: inherit; font-weight: 600; color: #cfd6ea; }
.canvas-head a { font-size: 13px; color: var(--muted); }
.canvas-head a:hover { color: var(--cyan); }
.feed { display: flex; flex-direction: column; gap: 18px; max-width: 980px; }
.empty-canvas { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 52vh; color: var(--muted); }
.empty-canvas .big { width: 76px; height: 76px; border-radius: 22px; display: grid; place-items: center; margin-bottom: 18px; background: var(--panel-2); border: 1px solid var(--line-2); }
.empty-canvas .big .ic { width: 34px; height: 34px; color: var(--cyan); }
.empty-canvas b { color: var(--fg); font-size: 17px; }
.empty-canvas p { margin: 6px 0 0; font-size: 14px; max-width: 360px; }

.rcard { border-radius: var(--radius); background: var(--panel-2); border: 1px solid var(--line-2); overflow: hidden; animation: rise .35s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.rcard-head { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px 0; }
.rcard-head .p { flex: 1; font-size: 14px; color: #dfe5f4; line-height: 1.55; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rcard-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 16px 0; font-size: 12px; color: var(--muted); }
.rcard-meta .mono { font-size: 11.5px; }
.rcard-body { padding: 14px 16px; }
.rcard-acts { display: flex; gap: 4px; flex-wrap: wrap; padding: 0 12px 12px; }
.act { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 8px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; }
.act:hover { background: var(--hover); color: var(--fg); }
.act .ic { width: 16px; height: 16px; }
.act.fav-on { color: #fbbf24; }
.act.fav-on .ic { fill: #fbbf24; }
.act.danger:hover { color: #fca5a5; }
.act-primary { color: var(--cyan); }
.rcard.err { border-color: rgba(239, 68, 68, .35); }
.rcard.err .rcard-body { color: #fca5a5; font-size: 14px; }

.img-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.img-grid.n1 { grid-template-columns: minmax(0, 520px); }
.img-cell { position: relative; border-radius: 12px; overflow: hidden; background: var(--panel-3); }
.img-cell img { display: block; width: 100%; height: auto; cursor: zoom-in; transition: transform .3s; }
.img-cell:hover img { transform: scale(1.02); }
.img-cell .over { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; opacity: 0; transition: opacity .15s; }
.img-cell:hover .over, .img-cell:focus-within .over { opacity: 1; }
.over a, .over button { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; border: 0; cursor: pointer; color: #fff; background: rgba(5, 7, 15, .7); backdrop-filter: blur(6px); }
.over .ic { width: 17px; height: 17px; }
.skeleton { position: relative; overflow: hidden; border-radius: 12px; background: var(--panel-3); display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(34, 211, 238, .09) 50%, transparent 70%); transform: translateX(-100%); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.skeleton .sk-in { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.orb { width: 30px; height: 30px; border-radius: 50%; background: conic-gradient(from var(--angle), var(--cyan), var(--violet), var(--pink), var(--cyan)); animation: orb 1.2s linear infinite; -webkit-mask: radial-gradient(circle, transparent 50%, #000 52%); mask: radial-gradient(circle, transparent 50%, #000 52%); }
@keyframes orb { to { --angle: 360deg; } }
audio { width: 100%; max-width: 520px; height: 40px; }
audio::-webkit-media-controls-panel { background: var(--panel-3); }

/* 文字结果 (简易 Markdown) */
.md { font-size: 14.5px; line-height: 1.75; color: #e3e8f5; word-break: break-word; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 12px; }
.md h1, .md h2, .md h3, .md h4 { font-family: inherit; font-size: 15.5px; margin: 18px 0 8px; }
.md ul, .md ol { margin: 0 0 12px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md code { font: 13px var(--mono); padding: 1px 6px; border-radius: 5px; background: rgba(255, 255, 255, .07); }
.md pre { position: relative; margin: 0 0 12px; padding: 14px 16px; border-radius: 10px; background: #05070d; border: 1px solid var(--line-2); overflow-x: auto; }
.md pre code { padding: 0; background: none; font-size: 13px; line-height: 1.6; }
.md blockquote { margin: 0 0 12px; padding-left: 12px; border-left: 3px solid var(--violet); color: var(--muted); }
.md a { color: var(--cyan); text-decoration: underline; }
.md strong { color: #fff; }
.cursor::after { content: ""; display: inline-block; width: 7px; height: 1.05em; vertical-align: -.15em; margin-left: 2px; background: var(--cyan); animation: blink 1s steps(1) infinite; }

/* ---------- 对话 ---------- */
.studio.is-chat { grid-template-columns: 300px 1fr; }
.conv-list { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.conv-list a { display: block; padding: 9px 12px; border-radius: 9px; font-size: 13.5px; color: #c3cbe0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-list a:hover { background: var(--hover); color: #fff; }
.conv-list a.on { background: rgba(34, 211, 238, .1); color: #fff; }
.conv-list small { display: block; font-size: 11px; color: var(--muted); }
.new-chat { width: 100%; justify-content: center; margin-bottom: 14px; }
.chat-wrap { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 26px 28px 20px; }
.chat-inner { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.bubble { display: flex; gap: 12px; animation: rise .3s ease-out; }
.bubble .who { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font: 700 12px var(--display); }
.bubble.user { flex-direction: row-reverse; }
.bubble.user .who { background: linear-gradient(135deg, #0e7490, #6d28d9); color: #fff; }
.bubble.ai .who { background: var(--panel-3); border: 1px solid var(--line-2); }
.bubble.ai .who img { width: 18px; }
.bubble .txt { min-width: 0; max-width: calc(100% - 50px); }
.bubble.user .txt { padding: 10px 14px; border-radius: 14px 4px 14px 14px; background: rgba(34, 211, 238, .1); border: 1px solid rgba(34, 211, 238, .2); white-space: pre-wrap; word-break: break-word; font-size: 14.5px; }
.bubble.ai .txt { padding-top: 4px; flex: 1; }
.bubble .b-acts { display: flex; gap: 2px; margin-top: 6px; opacity: .7; }
.bubble .b-acts .act { height: 28px; padding: 0 8px; font-size: 12px; }
.composer { flex: none; padding: 0 28px 20px; }
.composer-box { max-width: 820px; margin: 0 auto; display: flex; align-items: flex-end; gap: 10px; padding: 10px 10px 10px 16px; border-radius: 16px; background: var(--panel-2); border: 1px solid var(--line-2); transition: border-color .2s; }
.composer-box:focus-within { border-color: rgba(34, 211, 238, .45); }
.composer-box textarea { flex: 1; min-height: 26px; max-height: 200px; padding: 8px 0; border: 0; outline: 0; resize: none; background: none; color: var(--fg); font: inherit; font-size: 15px; line-height: 1.55; }
.composer-hint { max-width: 820px; margin: 8px auto 0; font-size: 11.5px; color: var(--muted); text-align: center; }
.chat-empty { text-align: center; padding: 8vh 0 0; }
.chat-empty h2 { font-size: 26px; margin: 14px 0 6px; }
.chat-empty p { color: var(--muted); margin: 0 0 22px; }
.starter { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; max-width: 720px; margin: 0 auto; }
.starter button { text-align: left; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel-2); color: #cfd6ea; font: inherit; font-size: 13.5px; cursor: pointer; transition: border-color .15s, background .15s; }
.starter button:hover { border-color: rgba(34, 211, 238, .4); background: var(--panel-3); }

/* ---------- 我的作品 ---------- */
.lib { padding: 28px 28px 70px; max-width: 1400px; margin: 0 auto; }
.lib-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.lib-head h1 { margin: 0 auto 0 0; font-size: 24px; }
.search-mini { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); }
.search-mini input { border: 0; outline: 0; background: none; color: var(--fg); font: inherit; font-size: 14px; width: 180px; }
.search-mini .ic { width: 16px; height: 16px; color: var(--muted); }
.masonry { columns: 4 260px; column-gap: 14px; }
.tile { break-inside: avoid; margin-bottom: 14px; border-radius: var(--radius); overflow: hidden; background: var(--panel-2); border: 1px solid var(--line-2); cursor: pointer; transition: border-color .15s, transform .15s; position: relative; }
.tile:hover { border-color: rgba(34, 211, 238, .35); transform: translateY(-2px); }
.tile img { display: block; width: 100%; height: auto; }
.tile .t-body { padding: 12px 14px; }
.tile .t-title { font-size: 13.5px; color: #dfe5f4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .t-text { font-size: 13px; color: var(--muted); margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.tile .t-meta { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 11.5px; color: var(--muted); }
.tile .t-meta .ic { width: 14px; height: 14px; }
.tile .t-count { position: absolute; top: 8px; left: 8px; font: 11px var(--mono); padding: 2px 7px; border-radius: 6px; color: #fff; background: rgba(5, 7, 15, .65); }
.tile .t-fav { position: absolute; top: 8px; right: 8px; color: #fbbf24; }
.tile .t-fav .ic { fill: #fbbf24; width: 18px; height: 18px; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .6)); }

/* 作品详情 */
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(2, 4, 10, .82); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 24px; }
.lightbox[hidden] { display: none; }
.lb-box { width: 100%; max-width: 1180px; max-height: calc(100vh - 48px); display: grid; grid-template-columns: 1fr 340px; border-radius: 18px; overflow: hidden; background: var(--panel); border: 1px solid var(--line-2); }
.lb-media { min-height: 0; overflow: auto; display: flex; align-items: center; justify-content: center; padding: 18px; background: #05070c; }
.lb-media img { max-width: 100%; max-height: calc(100vh - 100px); border-radius: 10px; }
.lb-media .md { max-width: 720px; width: 100%; align-self: flex-start; }
.lb-side { overflow-y: auto; padding: 20px; border-left: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 16px; }
.lb-side h3 { margin: 0; font-size: 16px; font-family: inherit; }
.lb-side dl { display: grid; grid-template-columns: 70px 1fr; gap: 8px 10px; margin: 0; font-size: 13px; }
.lb-side dt { color: var(--muted); }
.lb-side dd { margin: 0; word-break: break-word; }
.lb-prompt { font-size: 13.5px; line-height: 1.6; padding: 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line-2); white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow-y: auto; }
.lb-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.lb-close { position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel-2); color: #fff; cursor: pointer; display: grid; place-items: center; }
.lb-thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.lb-thumbs img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; cursor: pointer; opacity: .6; border: 2px solid transparent; }
.lb-thumbs img.on { opacity: 1; border-color: var(--cyan); }

/* ---------- 会员中心 (在工作台框架里) ---------- */
.console { max-width: 1180px; margin: 0 auto; padding: 22px 28px 70px; }
.ctabs { display: flex; gap: 4px; overflow-x: auto; margin: 0 0 26px; padding-bottom: 2px; border-bottom: 1px solid var(--line-2); scrollbar-width: none; }
.ctabs::-webkit-scrollbar { display: none; }
.ctabs a { flex: none; display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.ctabs a .ic { width: 16px; height: 16px; }
.ctabs a:hover { color: var(--fg); }
.ctabs a.on { color: #fff; border-bottom-color: var(--cyan); }
.console .box.glass, .console .stat.glass { background: var(--panel-2); backdrop-filter: none; -webkit-backdrop-filter: none; border-color: var(--line-2); }
.chip { display: inline-block; padding: 4px 10px; border-radius: 8px; font-size: 12.5px; border: 1px solid var(--line-2); background: var(--panel-2); color: #c3cbe0; }
a.chip:hover { border-color: var(--cyan); color: #fff; }
.model-chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 320px; overflow-y: auto; }
.thumb { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; display: block; }

/* 后台供应商卡片 */
.prov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-bottom: 22px; }
.prov { display: flex; flex-direction: column; gap: 12px; margin: 0; transition: border-color .15s, transform .15s; }
.prov:hover { border-color: rgba(34, 211, 238, .4); transform: translateY(-2px); }
.prov-top { display: flex; align-items: center; gap: 12px; }
.prov-top .grow { flex: 1; min-width: 0; }
.prov-logo { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font: 700 18px var(--display); color: #fff; background: linear-gradient(135deg, #0891b2, #7c3aed); }
.prov-url { font-size: 12px; color: var(--muted); word-break: break-all; }
.prov-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.prov-meta b { color: var(--fg); font-weight: 500; }

/* ---------- 窄屏 ---------- */
@media (max-width: 1100px) {
  .studio { grid-template-columns: 340px 1fr; }
  .lb-box { grid-template-columns: 1fr; overflow-y: auto; }
  .lb-side { border-left: 0; border-top: 1px solid var(--line-2); }
}
@media (max-width: 860px) {
  body.app-page { overflow: auto; }
  .shell { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 100dvh; }
  .frame, .stage, .studio > * { min-width: 0; }
  .frame { height: auto; min-height: 100dvh; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .rail { position: fixed; left: 0; right: 0; bottom: 0; top: auto; flex-direction: row; height: calc(62px + env(safe-area-inset-bottom)); padding: 4px 6px env(safe-area-inset-bottom); border-right: 0; border-top: 1px solid var(--line-2); background: rgba(12, 15, 24, .96); backdrop-filter: blur(12px); }
  .rail-logo, .rail-new, .rail-sep, .rail-more { display: none; }
  .rail-nav { flex-direction: row; justify-content: space-around; flex: 1; min-width: 0; }
  .rail-nav a { width: auto; flex: 1; min-width: 0; padding: 6px 0; font-size: 10px; }
  .rail-bottom { margin: 0; flex-direction: row; gap: 6px; padding-left: 4px; }
  .rail-lang { width: 32px; height: 28px; font-size: 11px; }
  .rail-avatar { width: 32px; height: 32px; font-size: 13px; }
  .menu-up { left: auto; right: 0; bottom: calc(100% + 10px); }
  .topbar { position: sticky; top: 0; z-index: 30; padding: 0 14px; gap: 10px; }
  .cmdk-btn kbd, .top-link { display: none; }
  .cmdk-btn { flex: 1; min-width: 0; }
  .cmdk-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .upgrade { display: none; }
  .stage { overflow: visible; }
  .studio, .studio.is-chat { grid-template-columns: minmax(0, 1fr); height: auto; }
  .tpanel { border-right: 0; border-bottom: 1px solid var(--line-2); }
  .tpanel-body { overflow: visible; }
  .tpanel-foot { position: sticky; bottom: calc(62px + env(safe-area-inset-bottom)); z-index: 10; }
  .canvas { overflow: visible; padding: 20px 16px 40px; }
  .is-chat .tpanel-body { display: none; }
  .is-chat .tpanel.show-convs .tpanel-body { display: block; }
  .chat-wrap { height: calc(100dvh - var(--top-h) - 62px - 120px); min-height: 420px; }
  .chat-scroll { padding: 18px 14px; }
  .composer { padding: 0 12px 12px; }
  .hub, .lib, .console { padding-left: 16px; padding-right: 16px; }
  .hub { padding-top: 28px; }
  .masonry { columns: 2 150px; column-gap: 10px; }
  .tile { margin-bottom: 10px; }
  .lightbox { padding: 0; }
  .lb-box { max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .toasts { left: 12px; right: 12px; bottom: 76px; align-items: stretch; }
}
@media (max-width: 420px) {
  .rail-nav a span { font-size: 9.5px; }
  .aspects { grid-template-columns: repeat(3, 1fr); }
  .pill { padding: 0 10px; }
}
