/* 打印台：纸白、墨黑、一种钴蓝。颜色交给模型自己的耗材色。 */
:root {
  --paper: #f1f1ec;
  --surface: #fafaf7;
  --sunken: #e9e9e3;
  --ink: #16181b;
  --ink-2: #4d5257;
  --ink-3: #6c7175;
  --line: #dcddd5;
  --line-strong: #bfc1b8;
  --cobalt: #1f44d6;
  --cobalt-press: #1836ad;
  --cobalt-tint: #e3e8fb;
  --danger: #b5321c;
  --danger-tint: #f8e4de;

  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --r-control: 6px;
  --r-card: 10px;
  --bar-h: 56px;
  --drawer-w: 468px;

  /* 咔嗒：卡扣吸合；滑入：抽屉阻尼 */
  --click: cubic-bezier(0.3, 1.4, 0.5, 1);
  --slide: cubic-bezier(0.2, 0.9, 0.25, 1);
  --leave: cubic-bezier(0.5, 0, 0.9, 0.4);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-y: scroll;
}
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.nowrap { white-space: nowrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.icon {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: square; stroke-linejoin: miter;
}

:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; }

/* ---------- 控件 ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 13px;
  border: 1px solid var(--line-strong); border-radius: var(--r-control);
  background: var(--surface); color: var(--ink);
  font-weight: 550; white-space: nowrap; cursor: pointer;
  transition: transform 180ms var(--click), background-color 120ms, border-color 120ms, color 120ms;
}
.btn:hover { border-color: var(--ink); }
.btn:active { transform: translateY(1px) scale(0.975); transition-duration: 60ms; }
.btn-primary { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }
.btn-primary:hover { background: var(--cobalt-press); border-color: var(--cobalt-press); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--ink-2); padding: 0 9px; }
.btn-quiet:hover { border-color: transparent; background: var(--sunken); color: var(--ink); }
.btn-icon { width: 34px; padding: 0; border-color: transparent; background: transparent; }
.btn-icon:hover { border-color: transparent; background: var(--sunken); }
.btn-block { width: 100%; height: 42px; font-size: 15px; }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }
.btn-danger.is-arming { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-quiet:hover { background: var(--danger-tint); color: var(--danger); }

.seg { display: inline-flex; padding: 3px; border-radius: 8px; background: var(--sunken); gap: 2px; }
.seg button {
  height: 28px; padding: 0 11px; border: 0; border-radius: 5px; background: transparent;
  color: var(--ink-2); font-weight: 550; cursor: pointer;
  transition: background-color 140ms, color 140ms, box-shadow 140ms, transform 180ms var(--click);
}
.seg button:hover { color: var(--ink); }
.seg button:active { transform: scale(0.96); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line-strong); }
.seg button .n { margin-left: 5px; color: var(--ink-3); font-size: 12px; }

/* ---------- 顶栏 ---------- */

.bar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 20px;
  height: var(--bar-h); padding: 0 24px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; letter-spacing: 0.02em; }
.brand-mark { width: 22px; height: 22px; stroke-width: 1.4; }

.tabs { position: relative; display: flex; align-self: stretch; gap: 4px; }
.tabs a {
  display: flex; align-items: center; gap: 6px; padding: 0 12px;
  color: var(--ink-3); font-weight: 600; transition: color 140ms;
}
.tabs a:hover, .tabs a[aria-current="page"] { color: var(--ink); }
.tab-count { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.tabs-thumb {
  position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: var(--ink);
  transition: transform 260ms var(--slide), width 260ms var(--slide);
}
.tabs-thumb.no-anim { transition: none; }

.search {
  display: flex; align-items: center; gap: 8px;
  flex: 1; max-width: 400px; height: 34px; margin-left: auto; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: var(--r-control); background: var(--surface);
  color: var(--ink-3); cursor: text;
  transition: border-color 120ms;
}
.search:focus-within { border-color: var(--cobalt); outline: 2px solid var(--cobalt-tint); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); }
.search input::placeholder { color: var(--ink-3); }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd {
  font: 12px var(--mono); color: var(--ink-3);
  padding: 0 6px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--paper);
}
.search:focus-within kbd { visibility: hidden; }

/* ---------- 模型库 ---------- */

.main { transition: padding-right 320ms var(--slide); }
.drawer-open .main { padding-right: var(--drawer-w); }

.library-folders { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 18px 24px 0; }
.folder-path { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.folder-path a { flex: none; color: var(--ink-2); }
.folder-path a:hover { text-decoration: underline; }
.folder-path a[aria-current], .folder-path span { font-weight: 650; color: var(--ink); }
.folder-path span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-path .icon { width: 12px; color: var(--ink-3); }
.folder-actions { display: flex; gap: 2px; }
.folder-list { flex-basis: 100%; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.folder-list a { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface); }
.folder-list a:hover { border-color: var(--ink); }
.folder-list li { min-width: 0; max-width: 100%; }
.folder-list a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-dialog { width: min(360px, calc(100% - 32px)); padding: 20px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-card); }
.folder-dialog::backdrop { background: rgb(22 24 27 / 35%); }
.folder-dialog form { display: grid; gap: 14px; }
.folder-dialog h2 { font-size: 18px; }
.folder-dialog input, .model-folder select { min-width: 0; border: 1px solid var(--line-strong); border-radius: var(--r-control); background: var(--surface); padding: 7px 9px; }
.folder-dialog p { color: var(--danger); }
.folder-dialog form > div { display: flex; justify-content: flex-end; gap: 8px; }
.model-folder { display: flex; align-items: center; gap: 8px; margin: 2px 0 12px; color: var(--ink-2); }
.model-folder select { max-width: calc(100% - 24px); }

.filters {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 24px 6px;
  min-height: 54px;
}
.tagbar { display: flex; gap: 6px; flex: 1; min-width: 0; overflow: hidden; mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
.chip {
  flex: none; height: 28px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: 14px; background: transparent;
  color: var(--ink-2); cursor: pointer;
  transition: background-color 140ms, border-color 140ms, color 140ms, transform 180ms var(--click);
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip:active { transform: scale(0.96); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.summary { flex: none; color: var(--ink-3); font-size: 12.5px; }
.sort select {
  height: 30px; padding: 0 26px 0 10px; border: 1px solid transparent; border-radius: var(--r-control);
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%234d5257' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 9px center;
  appearance: none; color: var(--ink-2); font-weight: 550; cursor: pointer;
}
.sort select:hover { background-color: var(--sunken); color: var(--ink); }

.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 16px;
  padding: 10px 24px 64px;
}

.card {
  position: relative; display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface);
  cursor: pointer; text-align: left;
  transition: border-color 140ms, box-shadow 200ms, transform 200ms var(--slide);
}
.card:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: 0 10px 22px -16px rgba(22, 24, 27, 0.45); }
.card:active { transform: translateY(0) scale(0.992); transition-duration: 70ms; }
.card.is-open { border-color: var(--cobalt); box-shadow: 0 0 0 1px var(--cobalt); }
.card-open { position: absolute; inset: 0; z-index: 1; border: 0; border-radius: inherit; background: none; cursor: pointer; }
.card-open:focus-visible { outline-offset: 3px; }

.stage { position: relative; aspect-ratio: 1 / 0.9; overflow: hidden; border-radius: 9px 9px 0 0; }
.stage canvas { display: block; width: 100%; aspect-ratio: 1; margin-top: -5%; }
.stage-ext {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 4px;
  font: 700 30px/1 var(--mono); color: var(--ink); letter-spacing: 0.04em;
}
.stage-ext small { font: 500 12.5px/1.4 var(--sans); color: var(--ink-3); letter-spacing: 0; }

.mark-ai {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  height: 20px; padding: 0 6px; border-radius: 4px;
  background: var(--cobalt-tint); color: var(--cobalt);
  font: 700 11.5px/20px var(--mono); letter-spacing: 0.04em;
}
.card-dl {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  display: grid; place-items: center; width: 32px; height: 32px;
  border: 1px solid var(--line-strong); border-radius: var(--r-control); background: var(--surface); color: var(--ink);
  opacity: 0; transform: translateY(-3px);
  transition: opacity 140ms, transform 180ms var(--click), background-color 120ms, border-color 120ms, color 120ms;
}
.card:hover .card-dl, .card-dl:focus-visible { opacity: 1; transform: none; }
.card-dl:hover { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }
.card-dl:active { transform: scale(0.94); }
@media (hover: none) { .card-dl { opacity: 1; transform: none; } }

.meter {
  position: absolute; left: 10px; bottom: 8px; z-index: 2;
  padding: 2px 7px; border-radius: 4px; background: var(--cobalt); color: #fff;
  font-size: 12px; line-height: 18px;
  opacity: 0; transform: translateY(4px); transition: opacity 200ms, transform 240ms var(--click), background-color 200ms;
  pointer-events: none;
}
.is-printing .meter, .is-printed .meter { opacity: 1; transform: none; }
.is-printed .meter { background: var(--ink); }
.upload-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--cobalt); transform-origin: left; transform: scaleX(0); transition: transform 160ms linear; }

.card-text { padding: 10px 12px 12px; border-top: 1px solid var(--line); min-width: 0; }
.card-name { font-size: 14px; font-weight: 600; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { margin-top: 3px; color: var(--ink-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta b { color: var(--ink-2); font-weight: 500; }

.card.is-failed { border-color: var(--danger); }
.card.is-failed .meter { opacity: 1; transform: none; background: var(--danger); }
.card-retry { position: relative; z-index: 2; display: flex; gap: 6px; margin: 0 12px 12px; }

/* 首次进入：卡片按阅读顺序落到台面上 */
.grid.is-entering .card { animation: card-in 420ms var(--slide) both; animation-delay: calc(min(var(--i), 12) * 40ms); }
@keyframes card-in { from { opacity: 0; transform: translateY(14px); } }

.empty { display: grid; justify-items: center; gap: 10px; padding: 12vh 24px; text-align: center; color: var(--ink-2); }
.empty canvas { width: 240px; height: 240px; margin-bottom: -28px; }
.empty strong { font-size: 18px; color: var(--ink); }
.empty .row { display: flex; gap: 10px; margin-top: 10px; }

/* ---------- 详情抽屉 ---------- */

.drawer {
  position: fixed; top: var(--bar-h); right: 0; bottom: 0; z-index: 20;
  width: var(--drawer-w); display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--line-strong);
  transform: translateX(100%); visibility: hidden;
  transition: transform 220ms var(--leave), visibility 0s 220ms;
}
.drawer-open .drawer { transform: none; visibility: visible; transition: transform 340ms var(--slide), visibility 0s; }
.drawer-head { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 8px 0 20px; flex: none; }
.origin { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13px; }
.origin .mark-ai { position: static; }
.saved { margin-left: auto; color: var(--ink-3); font-size: 12px; opacity: 0; transition: opacity 200ms; }
.saved.is-on { opacity: 1; }
.drawer-body { flex: 1; overflow-y: auto; padding: 0 20px 20px; overscroll-behavior: contain; }

.viewer {
  position: relative; aspect-ratio: 1 / 0.86; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r-card); background: var(--paper);
}
.viewer-poster, .viewer-canvas { position: absolute; left: 0; top: 50%; width: 100%; aspect-ratio: 1; transform: translateY(-50%); }
.viewer-canvas { top: 0; height: 100%; aspect-ratio: auto; transform: none; opacity: 0; cursor: grab; touch-action: none; transition: opacity 200ms; }
.viewer-canvas:active { cursor: grabbing; }
.viewer-canvas.is-live { opacity: 1; }
.viewer.is-live .viewer-poster { visibility: hidden; }
.viewer-note { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px; text-align: center; color: var(--ink-3); font-size: 13px; padding: 24px; }
.viewer-note b { font: 700 34px/1 var(--mono); color: var(--ink); letter-spacing: 0.04em; }
.viewer-scale { position: absolute; left: 12px; bottom: 10px; color: var(--ink-3); font-size: 12px; pointer-events: none; }
.viewer-reset { position: absolute; right: 6px; bottom: 6px; height: 30px; font-size: 13px; }

.title-input {
  width: calc(100% + 16px); margin: 14px -8px 0; padding: 4px 8px;
  border: 1px solid transparent; border-radius: var(--r-control); background: transparent;
  font-size: 19px; font-weight: 700; line-height: 1.35; text-overflow: ellipsis;
}
.title-input:hover { border-color: var(--line); }
.title-input:focus { border-color: var(--cobalt); outline: 2px solid var(--cobalt-tint); background: #fff; }

.specs { display: grid; grid-template-columns: repeat(4, auto); justify-content: space-between; gap: 4px 12px; margin: 10px 0 16px; }
.specs div { display: grid; gap: 1px; }
.specs dt { font: 12px/1.4 var(--sans); color: var(--ink-3); }
.specs dd { font-size: 13.5px; color: var(--ink); white-space: nowrap; }

.field { margin-top: 22px; }
.field > header { display: flex; align-items: center; justify-content: space-between; height: 30px; margin-bottom: 6px; }
.field h3 { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .btn-quiet { height: 28px; font-size: 13px; margin-right: -9px; }

.files li { display: flex; align-items: center; gap: 8px; height: 40px; border-top: 1px solid var(--line); }
.files li:last-child { border-bottom: 1px solid var(--line); }
.files .ext { flex: none; width: 46px; font-size: 11.5px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; }
.files .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.files .fsize { flex: none; color: var(--ink-3); font-size: 12.5px; }
.files .btn-icon { width: 30px; height: 30px; }

.swatches { display: flex; gap: 8px; margin-bottom: 10px; }
.swatch {
  width: 30px; height: 30px; padding: 0; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(22, 24, 27, 0.22); background: var(--c);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 2px var(--surface);
  transition: transform 200ms var(--click), box-shadow 160ms;
}
.swatch:hover { transform: scale(1.08); }
.swatch:active { transform: scale(0.94); }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.seg-small button { height: 26px; font-size: 13px; }

.tag-edit {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 6px;
  border: 1px solid var(--line-strong); border-radius: var(--r-control); background: #fff;
}
.tag-edit:focus-within { border-color: var(--cobalt); outline: 2px solid var(--cobalt-tint); }
.tag-edit .tag { display: inline-flex; align-items: center; gap: 2px; height: 26px; padding: 0 2px 0 9px; border-radius: 13px; background: var(--sunken); font-size: 13px; animation: pop 220ms var(--click); }
.tag-edit .tag button { display: grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 50%; background: none; color: var(--ink-3); cursor: pointer; }
.tag-edit .tag button:hover { background: var(--line-strong); color: var(--ink); }
.tag-edit .tag .icon { width: 10px; height: 10px; }
.tag-edit input { flex: 1; min-width: 120px; height: 26px; border: 0; outline: 0; background: transparent; }
@keyframes pop { from { transform: scale(0.8); opacity: 0; } }

textarea {
  display: block; width: 100%; padding: 8px 10px; resize: vertical; min-height: 76px;
  border: 1px solid var(--line-strong); border-radius: var(--r-control); background: #fff; line-height: 1.6;
}
textarea:focus { border-color: var(--cobalt); outline: 2px solid var(--cobalt-tint); }
textarea::placeholder, .tag-edit input::placeholder { color: var(--ink-3); }

.drawer-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 12.5px; }
.drawer-foot .btn { margin-right: -9px; font-size: 13px; }

/* ---------- AI 接入 ---------- */

.view-ai { display: grid; grid-template-columns: minmax(0, 640px) minmax(300px, 420px); justify-content: center; gap: 56px; padding: 40px 24px 80px; }
.ai-main h1 { font-size: 26px; line-height: 1.3; font-weight: 700; letter-spacing: 0.01em; }
.lead { margin-top: 10px; font-size: 15px; line-height: 1.7; color: var(--ink-2); }
.ai-block { margin-top: 34px; }
.ai-block > header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.ai-block h2 { font-size: 16px; font-weight: 700; }
.step { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--paper); font-size: 12px; font-weight: 700; }
.ai-block p { color: var(--ink-2); line-height: 1.7; }
.code { position: relative; margin-top: 10px; border-radius: 8px; background: var(--ink); color: #e8e8e2; }
.code pre { margin: 0; padding: 14px 92px 14px 16px; font-size: 13px; line-height: 1.7; white-space: pre-wrap; word-break: break-all; }
.code .copy { position: absolute; top: 8px; right: 8px; height: 30px; color: #c9cbc4; font-size: 13px; }
.code .copy:hover { background: #2c3035; color: #fff; }
.code .tok { color: #9fb3ff; }
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; margin-top: 12px; font-size: 13px; }
.tools li { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.tools b { font-weight: 600; }
.tools span { font-family: var(--sans); color: var(--ink-3); }
.token-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.token { flex: 1; min-width: 220px; height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-control); background: #fff; font-size: 13px; line-height: 32px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ai-log { align-self: start; position: sticky; top: calc(var(--bar-h) + 40px); }
.ai-log > header { display: flex; align-items: baseline; justify-content: space-between; padding-bottom: 10px; border-bottom: 2px solid var(--ink); }
.ai-log h2 { font-size: 16px; font-weight: 700; }
.ai-log li a { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); transition: background-color 120ms; }
.ai-log li a:hover { background: var(--surface); }
.ai-log img, .ai-log .log-blank { width: 52px; height: 52px; flex: none; }
.ai-log .log-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-log .log-meta { color: var(--ink-3); font-size: 12.5px; }
.ai-log .log-text { min-width: 0; }
.ai-empty { padding: 28px 0; color: var(--ink-3); line-height: 1.7; }

/* ---------- 拖放、提示、令牌门 ---------- */

.drop { position: fixed; inset: 0; z-index: 60; display: grid; padding: 14px; background: color-mix(in srgb, var(--paper) 86%, transparent); opacity: 0; visibility: hidden; transition: opacity 140ms, visibility 0s 140ms; pointer-events: none; }
.drop.is-on { opacity: 1; visibility: visible; transition: opacity 140ms; }
.drop-frame { display: grid; place-content: center; justify-items: center; gap: 8px; border: 2px dashed var(--cobalt); border-radius: 16px; color: var(--cobalt); transform: scale(0.985); transition: transform 240ms var(--click); }
.drop.is-on .drop-frame { transform: none; }
.drop-frame strong { font-size: 22px; }
.drop-frame span { font-size: 13px; color: var(--ink-2); }
.drop-mark { width: 56px; height: 56px; stroke-width: 0.9; }

.toasts { position: fixed; left: 24px; bottom: 24px; z-index: 70; display: flex; flex-direction: column-reverse; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 14px; max-width: min(460px, calc(100vw - 48px));
  padding: 10px 14px; border-radius: 8px; background: var(--ink); color: #f1f1ec; font-size: 13.5px;
  box-shadow: 0 12px 28px -12px rgba(22, 24, 27, 0.5); pointer-events: auto;
  animation: toast-in 260ms var(--click) both;
}
.toast span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast button { flex: none; border: 0; background: none; color: #a9b8ff; font-weight: 600; cursor: pointer; padding: 2px 0; }
.toast button:hover { color: #fff; }
.toast.is-leaving { animation: toast-out 160ms var(--leave) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

.gate { position: fixed; inset: 0; z-index: 90; display: grid; place-content: center; justify-items: start; gap: 12px; background: var(--paper); padding: 24px; }
.gate > * { width: min(360px, calc(100vw - 48px)); }
.gate .brand-mark { width: 36px; height: 36px; }
.gate h1 { font-size: 22px; }
.gate p { color: var(--ink-2); line-height: 1.7; }
.gate input { height: 42px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r-control); background: #fff; font-family: var(--mono); }
.gate-error { color: var(--danger); min-height: 1.7em; }
.gate input:focus { border-color: var(--cobalt); outline: 2px solid var(--cobalt-tint); }
.gate .btn:disabled { opacity: 0.6; cursor: default; }

/* ---------- 视图过渡 ---------- */

::view-transition-group(*) { animation-duration: 320ms; animation-timing-function: var(--slide); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 160ms; }
/* 同一个模型从卡片变成详情：只变形状，不做交叉淡化 */
::view-transition-old(hero) { display: none; }
::view-transition-new(hero) { animation: none; height: 100%; object-fit: cover; }
::view-transition-group(hero) { z-index: 5; }

/* ---------- 窄屏 ---------- */

@media (max-width: 960px) {
  .view-ai { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .ai-log { position: static; }
  .drawer-open .main { padding-right: 0; }
  .drawer { width: min(var(--drawer-w), 100vw); box-shadow: -24px 0 48px -32px rgba(22, 24, 27, 0.5); }
}
@media (max-width: 640px) {
  .bar { gap: 6px; padding: 0 10px; }
  .brand span, .search kbd, .tab-count { display: none; }
  .tabs a { padding: 0 8px; }
  .search { min-width: 0; }
  #upload-btn { padding: 0 10px; }
  .library-folders { padding: 14px 14px 0; gap: 6px; }
  .filters { flex-wrap: wrap; padding: 12px 14px 4px; }
  .tagbar { order: 3; flex-basis: 100%; overflow-x: auto; mask-image: none; }
  .summary { margin-left: auto; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 10px 14px 56px; }
  .view-ai { padding: 28px 14px 64px; }
  .tools { grid-template-columns: 1fr; }
  .specs { grid-template-columns: repeat(2, auto); justify-content: start; gap: 8px 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0s !important; transition-duration: 1ms !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
