/* ══════════════════════════════════════════════════════════════
   518.PLUS components — the ONLY shared visual vocabulary.
   Pages compose these; page CSS (518.css / samelabs.css) does
   page layout only. Every component uses tokens.css variables.
   ══════════════════════════════════════════════════════════════ */

/* ── Element control defaults (moved from 518.css — one baseline) ──
   16px floor: iOS/Android auto-zoom any focused input <16px;
   font-family: inherit — UA default differs from page font otherwise.
   NOTE: this selector must stay UNPREFIXED. A prior revision glued the
   comment to `.controls`, silently scoping the floor to `.controls
   input` — every input elsewhere kept UA ~13px and iOS zoomed on focus. */
input, select, textarea {
  font-family: inherit;
  font-size: 16px;
}
select { width: auto; margin-top: 0; }

/* Element baseline = STRUCTURAL ONLY: layout, cursor, tap, press feedback,
   icon sizing. No fill, radius, shadow or weight lives here — a naked
   button is neutral ink, never a crimson CTA; every visual is carried by
   an explicit component class (.btn*, .x-login, .send, .seg button,
   .sb-btn, ...). Raising this selector's specificity is forbidden: page
   rules outrank it at (0,1,0)+ by design. */
button { border: 0; background: none; color: var(--ink); padding: 0; font: inherit; font-size: var(--fs-base); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); transition: transform var(--ease-in); -webkit-tap-highlight-color: transparent; }
.x-login { border: 0; background: linear-gradient(180deg, var(--brand), var(--brand-deep)); color: var(--brand-ink); border-radius: var(--r-sm); padding: 11px 22px; font-size: var(--fs-base); font-weight: 700; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 40px; box-shadow: var(--sh-1), inset 0 1px 0 rgba(255, 255, 255, 0.16); transition: opacity var(--ease), box-shadow var(--ease), filter var(--ease), transform var(--ease-in); -webkit-tap-highlight-color: transparent; }
.x-login:active, button:active { transform: scale(0.96); }
.user-dropdown a:active, .user-dropdown button:active { transform: none; } /* menu rows must not wobble */
@media (hover:hover) and (pointer:fine) { .x-login:hover { background: linear-gradient(180deg, var(--brand-deep), var(--brand-deep-strong)); } }
.x-login.loading { pointer-events: none; opacity: .7; }
button:disabled { opacity: .4; cursor: not-allowed; }
button svg { width: 18px; height: 18px; display: block; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.x-glyph { font-family: ui-serif, Georgia, "Times New Roman", serif; font-size: 18px; line-height: 1; font-weight: 800; }
/* X brand button (auth surfaces only): black plate, white ink — narrow
   selector, global button palette untouched. */
.auth-x-wrap .x-login { background: var(--ink); color: var(--brand-ink); }
@media (hover:hover) and (pointer:fine) { .auth-x-wrap .x-login:hover { background: var(--ink-hover); opacity: 1; } }
.auth-x-wrap .x-login:focus-visible { outline: 2px solid var(--ink-3); outline-offset: 2px; }

/* ── Buttons ─────────────────────────────────────────────────
   .btn base; variants primary/secondary/ghost/danger; sizes
   .btn-sm/.btn-lg; .btn-icon = square icon-only (REQUIRES
   aria-label + title). */
/* Variant classes are STANDALONE (usable without the .btn base) — the
   base block applies to every variant so page-level legacy callers and
   composite "btn btn-primary" render identically. */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s2); height: 40px; padding: 0 var(--s4);
  border: var(--border-w) solid transparent; border-radius: var(--r-sm);
  font: inherit; font-size: var(--fs-base); font-weight: 650;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--ease), border-color var(--ease),
    color var(--ease), transform var(--ease-in), opacity var(--ease);
  background: none; color: var(--ink);
  /* 元素基线带 CTA 阴影; 非主行动变体在此显式归零, 主行动自带阴影声明 */
  box-shadow: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: default; pointer-events: none; }
.btn svg {
  width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.75;
  fill: none; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0;
}

/* 主行动 = 品牌红第一表达 (亮端 --brand, 深端 --brand-deep 承担立体
   效果; hover 落暗红响应位); ink 版主按钮不再使用——一个页面一个红,
   中性面交给 secondary */
.btn.btn-primary, .btn.btn-p, a.btn-primary, a.btn-p {
  background: linear-gradient(180deg, var(--brand), var(--brand-deep));
  border-color: var(--brand); color: var(--brand-ink);
  box-shadow: var(--sh-1), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
@media (hover:hover) and (pointer:fine) { .btn-primary:hover, .btn-p:hover { background: linear-gradient(180deg, var(--brand-deep), var(--brand-deep-strong)); border-color: var(--brand-deep-strong); box-shadow: var(--sh-2), inset 0 1px 0 rgba(255, 255, 255, 0.16); } }
.btn.btn-b, a.btn-b { background: linear-gradient(180deg, var(--brand), var(--brand-deep)); border-color: var(--brand); color: var(--brand-ink); box-shadow: var(--sh-1), inset 0 1px 0 rgba(255, 255, 255, 0.16); }

.btn-secondary, .btn-s { background: var(--card); border-color: var(--line-2); color: var(--ink); }
@media (hover:hover) and (pointer:fine) { .btn-secondary:hover, .btn-s:hover { border-color: var(--ink-2); } }

/* quiet: 无面无框的低声动作 (历史类名 btn-q, 用于次要链接型钮) */
.btn-q { background: none; border-color: transparent; color: var(--ink-2); }
@media (hover:hover) and (pointer:fine) { .btn-q:hover { background: var(--gray-100); color: var(--ink); } }

.btn-ghost { background: none; color: var(--ink-2); }
@media (hover:hover) and (pointer:fine) { .btn-ghost:hover { background: var(--gray-100); color: var(--ink); } }

.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--brand-ink); }
@media (hover:hover) and (pointer:fine) { .btn-danger:hover { background: var(--danger-strong); border-color: var(--danger-strong); } }
.btn-danger-soft { background: var(--danger-50); border-color: transparent; color: var(--danger); }
@media (hover:hover) and (pointer:fine) { .btn-danger-soft:hover { border-color: var(--danger); } }

.btn-sm { height: 32px; padding-inline: var(--s3); font-size: var(--fs-sm); }
.btn-sm svg { width: 15px; height: 15px; }
.btn-lg { height: 48px; padding-inline: var(--s5); font-size: var(--fs-md); }

/* Small secondary: surface + hover live in the .btn-secondary group
   above (single source); only the sm sizing differs here. */
.btn-s { height: 34px; padding-inline: var(--s3); font-size: var(--fs-sm); }
.btn-s svg { width: 15px; height: 15px; }
.tab-panel .tab-copy { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.18); color: rgba(255,255,255,0.85); }
@media (hover:hover) and (pointer:fine) { .tab-panel .tab-copy:hover { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.3); color: var(--card); } }

.btn-icon { width: 40px; padding-inline: 0; }
.btn-icon.btn-sm { width: 32px; }

@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--card); border: var(--border-w) solid var(--line);
  border-radius: var(--r-lg);
}
.card-pad { padding: var(--s4); }
@media (min-width: 600px) { .card-pad { padding: var(--s5); } }
.card-head {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s4) var(--s5); border-block-end: var(--border-w) solid var(--line);
}
.card-head h2 { font-size: var(--fs-md); font-weight: 700; }

/* ── Form controls ─────────────────────────────────────────── */
.input, .textarea, .select {
  width: 100%; border: var(--border-w) solid var(--line-2);
  border-radius: var(--r-sm); padding: 10px var(--s3);
  font: inherit; font-size: var(--fs-base); color: var(--ink);
  background: var(--card); transition: border-color var(--ease);
}
/* 聚焦表达 (表单控件单源): 仅边框变色 — 无描边叠加、无阴影光环 */
.input:focus, .textarea:focus, .select:focus,
.input:focus-visible, .textarea:focus-visible, .select:focus-visible {
  outline: none; border-color: var(--ink-3);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.textarea { resize: vertical; min-height: 96px; line-height: var(--lh-loose); }
.select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23536471' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right var(--s3) center;
  background-size: 14px; padding-inline-end: var(--s6);
}
[dir="rtl"] .select { background-position: left var(--s3) center; }
.field { display: flex; flex-direction: column; gap: var(--s1); }
.field > .field-label { font-size: var(--fs-sm); font-weight: 650; color: var(--ink); }

.field .field-note { font-size: var(--fs-sm); color: var(--ink-2); }

/* checkbox row */
.check { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-base); cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); }

/* switch */
.switch { position: relative; display: inline-flex; align-items: center; width: 40px; height: 22px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch .switch-track { position: absolute; inset: 0; background: var(--gray-300); border-radius: var(--r-full); transition: background var(--ease); }
.switch .switch-track::after {
  content: ""; position: absolute; inset-block-start: 2px; inset-inline-start: 2px;
  width: 18px; height: 18px; border-radius: 50%; background: var(--card);
  box-shadow: var(--sh-1); transition: transform var(--ease);
}
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
[dir="rtl"] .switch input:checked + .switch-track::after { transform: translateX(-18px); }

/* ── Result card ("out") + items — the tool-page result area AND
   the /r result page share this structure: .out > .out-h + .out-b >
   .linkbar + items. Structure classes rs-* stay stable (/r page
   server-side markup + browser suites ride on them). ── */
.out { overflow: hidden; }
.out-h {
  display: flex; align-items: center; gap: 10px; padding: 16px 20px;
  border-block-end: var(--border-w) solid var(--line);
}
.out-h .ok {
  width: 22px; height: 22px; border-radius: 50%; background: var(--ok);
  color: var(--brand-ink); display: grid; place-items: center; flex: none;
}
.out-h .ok svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.out-h b { font-weight: 650; font-size: var(--fs-md); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.out-h .t { flex: none; }
.out-h .t { font-size: var(--fs-xs); color: var(--ink-3); margin-inline-start: auto; display: inline-flex; gap: var(--s2); align-items: center; }
.out-b { padding: 20px; display: flex; flex-direction: column; gap: 14px; }

/* Lightweight one-line link strip: no heavy border, no fill — a quiet
   bottom line only; the URL is tertiary text on a single ellipsized
   line and the copy action is a compact secondary button (visual
   weight stays below the primary actions). */
.linkbar {
  display: flex; align-items: center; gap: 8px; padding: 5px 2px 5px 12px;
  border-radius: 0; background: none;
  border: 0; border-bottom: var(--border-w) solid var(--line);
}
.linkbar > svg { width: 15px; height: 15px; color: var(--ink-3); stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.linkbar > span {
  flex: 1; min-width: 0; font-family: var(--font-mono); font-size: var(--fs-sm);
  color: var(--ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.linkbar .btn { flex: none; height: 28px; min-height: 0; padding-inline: var(--s2); font-size: var(--fs-xs); }
.linkbar .btn svg { width: 14px; height: 14px; }

.item-text {
  background: var(--sunk); border-radius: var(--r); padding: 14px 16px;
  font-size: var(--fs-base); position: relative;
}.item-text pre.rs-text { padding: 0; background: none; border-radius: 0; font-family: var(--font-sans); font-size: var(--fs-base); }
.item-text pre.rs-text a, .rs-link-card { color: var(--brand-600); }
.rs-link-card {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
  padding: 12px 14px; border: var(--border-w) solid var(--line); border-radius: var(--r);
  background: var(--card); text-decoration: none; min-width: 0;
}
.rs-link-card b { font-size: var(--fs-md); color: var(--ink); overflow-wrap: anywhere; }
.rs-link-card small { flex-basis: 100%; order: 2; color: var(--ink-3); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-link-card .btn { margin-inline-start: auto; }
.item-text .lbl {
  font-size: var(--fs-xs); font-weight: 650; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-3); display: flex;
  justify-content: space-between; align-items: center; margin-block-end: 6px;
}
.item-text .lbl .btn { background: none; border: 0; height: 28px; }

.item-file {
  display: flex; gap: 14px; align-items: center;
  border: var(--border-w) solid var(--line); border-radius: var(--r);
  padding: 10px; background: var(--card);
}
.item-file .pv {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  object-fit: cover; background: var(--card);
}
.item-file .pv.doc {
  display: grid; place-items: center;
  background: var(--sunk); border: var(--border-w) solid var(--line-2);
  color: var(--ink-2);
}
/* per-glyph shell tint = same pair grammar as the history fmt-badge
   (one icon language across surfaces; tokens flip with the theme) */
.item-file .pv.doc.g-image { background: var(--brand-soft); border-color: var(--line); color: var(--brand); }
.item-file .pv.doc.g-pdf { background: var(--danger-50); border-color: var(--danger-50); color: var(--danger); }
.item-file .pv.doc.g-doc, .item-file .pv.doc.g-archive { background: var(--brand-soft); border-color: var(--line); color: var(--info); }
.item-file .pv.doc.g-sheet { background: var(--ok-50); border-color: var(--ok-50); color: var(--ok); }
.item-file .pv.doc.g-slides { background: var(--brand-soft); border-color: var(--line); color: var(--warn); }
.item-file .pv.doc.g-text { background: var(--sunk); border-color: var(--line-2); color: var(--ink-2); }
.item-file .pv.doc.g-video { background: var(--info-50); border-color: var(--info-50); color: var(--info); }
.item-file .pv.doc.g-audio { background: var(--warn-50); border-color: var(--warn-50); color: var(--warn); }
.item-file .pv.doc.g-cad3d { background: var(--brand-soft); border-color: var(--line); color: var(--brand); }
.item-file .pv.doc svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 1.75; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.item-file .if-body { min-width: 0; flex: 1; }
/* single-line filename, middle ellipsis: the stem span ellipsizes, the
   extension span stays pinned; b[title] carries the full name */
.item-file b.if-name { font-size: var(--fs-base); font-weight: 600; display: flex; align-items: baseline; min-width: 0; }
.item-file b.if-name .if-stem { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-file b.if-name .if-ext { flex: none; white-space: nowrap; }
.item-file small { font-size: var(--fs-xs); color: var(--ink-3); display: block; margin-block-start: 2px; }
.item-file .a { margin-inline-start: auto; display: flex; gap: 6px; flex: none; }

/* ── Result media (inline result card + /r page, one structure):
   single image = full main view (≤60vh, never cropped; download +
   size-delta line BELOW the image); multiple images = grid (phone 2
   cols / desktop 3) with click-to-zoom cells. ── */
.rs-media { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.rs-image { margin: 0; background: var(--sunk); text-align: center; border-radius: var(--r); overflow: hidden; }
.rs-image img {
  display: block; margin-inline: auto;
  max-width: 100%; max-height: 60vh; height: auto; width: auto;
  object-fit: contain;
}
/* size-delta + name + download under the media — small text only,
   never larger than body copy, never inside the card title */
.rs-img-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); min-width: 0; }
.rs-img-meta small { font-size: var(--fs-xs); color: var(--ink-3); }
.rs-img-meta .rs-dl { margin-inline-start: auto; flex: none; }
.rs-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.rs-cell {
  margin: 0; display: flex; flex-direction: column; gap: var(--s1); min-width: 0;
  border: var(--border-w) solid var(--line); border-radius: var(--r-sm);
  padding: var(--s1); background: var(--card);
}
.rs-cell-img {
  display: block; width: 100%; padding: 0; border: 0; min-height: 0;
  border-radius: var(--r-xs); background: var(--sunk); cursor: zoom-in; overflow: hidden;
}
.rs-cell-img img {
  display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
}
.rs-cell figcaption { min-width: 0; }
.rs-cell figcaption small { font-size: var(--fs-xs); color: var(--ink-3); }
.rs-cell figcaption .if-name { display: flex; min-width: 0; font-size: var(--fs-xs); font-weight: 600; color: var(--ink-2); }
.rs-cell figcaption .if-stem { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-cell figcaption .if-ext { flex: none; }
.rs-cell .rs-dl { align-self: flex-start; }
@media (max-width: 767px) {
  .rs-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Full-size lightbox (shared authority: common.js wireImageZoom) */
.img-zoom {
  position: fixed; inset: 0; z-index: var(--z-modal);
  display: grid; place-items: center; padding: var(--s4);
  background: var(--overlay); cursor: zoom-out;
}
.img-zoom.hidden { display: none; }
.img-zoom img {
  max-width: 92vw; max-height: 92vh; width: auto; height: auto;
  object-fit: contain; border-radius: var(--r-sm);
}

/* Standalone-PWA video viewer (shared authority: base-engine.js
   pwaVideoView — play on the inline channel + controlled save) */
.video-view {
  position: fixed; inset: 0; z-index: var(--z-modal);
  display: grid; place-items: center; padding: var(--s4);
  background: var(--overlay);
}
.video-view.hidden { display: none; }
.video-view-panel {
  display: flex; flex-direction: column; gap: var(--s3);
  width: min(720px, 94vw); max-height: 94vh;
  padding: var(--s4); position: relative;
  background: var(--bg); border-radius: var(--r);
  box-shadow: var(--sh-1);
}
.video-view-panel video {
  width: 100%; max-height: 62vh; background: var(--overlay);
  border-radius: var(--r-sm);
}
.video-view-name {
  font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.video-view-actions { display: flex; justify-content: center; }
.video-view-msg {
  margin: 0; font-size: var(--fs-sm); color: var(--ink-2);
  text-align: center;
}
.video-view-msg.hidden { display: none; }
.video-view-msg-actions { display: flex; justify-content: center; }
.video-view-close {
  position: absolute; top: var(--s2); inset-inline-end: var(--s2);
  display: grid; place-items: center; width: 36px; height: 36px;
  border: 0; border-radius: var(--r-sm); cursor: pointer;
  background: transparent; color: var(--ink-2);
}
.video-view-close:hover { background: var(--sunk); color: var(--ink); }

/* json item: collapsible code block. 标题行 = 平面标签行 (label + 箭头 +
   模式切换 + 复制), 不带盒壳 — 与 text 项的 .lbl 同一语法; 代码体自带
   sunk 底, 无第二层壳 */
.rs-json-details { border: 0; border-radius: 0; overflow: visible; }
pre.rs-text, pre.rs-json {
  font-family: var(--font-mono); font-size: var(--fs-sm); line-height: var(--lh-loose);
  white-space: pre-wrap; word-break: break-word; width: auto;
  background: var(--sunk); border-radius: var(--r-sm);
  padding: var(--s3); max-height: 380px; overflow: auto; margin: 0;
  overscroll-behavior: contain;
}
.rs-item.rs-json { white-space: normal; font-family: var(--font-sans); }
.rs-json-details summary {
  list-style: none; cursor: pointer; padding: 0; margin-block-end: 6px;
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--ink-3);
  display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap;
  user-select: none; transition: color var(--ease);
}
@media (hover: hover) and (pointer: fine) {
  .rs-json-details summary:hover { color: var(--ink); }
}
.rs-json-details summary::-webkit-details-marker { display: none; }
/* 展开箭头: CSS 描线三角, 尺寸可读, 随开合旋转 (RTL 镜像) */
.rs-json-details summary::before {
  content: ""; width: 8px; height: 8px; flex: none;
  border-inline-end: 2px solid currentColor; border-block-end: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform var(--ease);
}
[dir="rtl"] .rs-json-details summary::before { transform: rotate(135deg); }
.rs-json-details[open] summary::before { transform: rotate(135deg); }
[dir="rtl"] .rs-json-details[open] summary::before { transform: rotate(-45deg); }
.rs-json-details summary > span { flex: 1; min-width: 0; }
.rs-json-details summary .btn { flex: none; height: 26px; min-height: 0; padding-inline: var(--s2); font-size: var(--fs-xs); }
.rs-json-details .rs-body { padding: 0; }
.rs-item { border-radius: var(--r); }

@media (max-width: 767px) {
  .item-file { flex-wrap: wrap; }
  .item-file .a { margin-inline-start: 0; width: 100%; }
  .item-file .a .btn { flex: 1; }
  .item-file .pv { width: 44px; height: 44px; }
}

/* ── Tags & badges ─────────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center; gap: var(--s1);
  height: 22px; padding-inline: var(--s2);
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.02em;
  background: var(--gray-100); color: var(--ink-2);
  border-radius: var(--r-xs);
}
.tag-brand { background: var(--brand-soft); color: var(--brand); }
.tag-success { background: var(--ok-50); color: var(--ok); }
.tag-warning { background: var(--warn-50); color: var(--warn); }
.tag-danger { background: var(--danger-50); color: var(--danger); }
.tag-neutral { background: var(--gray-200); color: var(--gray-700); }
/* tool-card price/free variants (single .tag family) */
.tag.free { background: var(--ok-50); color: var(--ok-700); }
.tag.cost { background: var(--brand-50); color: var(--brand-600); }

/* ── Verified badge (membership mark; colors baked into the icon) ── */
.verified { display: inline-flex; width: 14px; height: 14px; vertical-align: -2px; flex: none; }
.verified svg { width: 100%; height: 100%; display: block; }
.user-menu { position: relative; display: flex; align-items: center; }
/* 语言入口 = 顶栏唯一挂载点: 菜单锚定到按钮自身 (所有视口可见),
   右对齐且永不超出视口 (RTL 由 518.css 镜像规则翻转)。 */
.lang-switch { position: relative; display: flex; align-items: center; }
.av-verified {
  position: absolute; inset-block-end: -3px; inset-inline-start: 20px;
  width: 15px; height: 15px; z-index: 1;
  box-shadow: 0 0 0 2px var(--bg); border-radius: 50%;
}

/* ── Hint / empty / note ───────────────────────────────────── */
.hint {
  display: flex; gap: var(--s2); align-items: flex-start;
  font-size: var(--fs-sm); color: var(--ink-2); line-height: var(--lh-base);
}
.hint svg { width: 15px; height: 15px; flex-shrink: 0; stroke: currentColor; stroke-width: 1.75; fill: none; margin-block-start: 2px; }
.empty {
  display: flex; flex-direction: column; align-items: center; gap: var(--s2);
  padding: var(--s8) var(--s4); text-align: center; color: var(--ink-2);
  font-size: var(--fs-base);
}
.empty svg { width: 36px; height: 36px; stroke: var(--gray-400); stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.empty .empty-title { font-size: var(--fs-md); font-weight: 700; color: var(--ink); }
.empty .empty-sub { font-size: var(--fs-sm); max-width: 44ch; }
.empty .empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s2); }
.empty .empty-actions > * { margin: 0; }
.composer .error-note {
  margin: 0 16px 14px; padding: 8px 12px;
  font-size: var(--fs-sm); font-weight: 500; line-height: var(--lh-tight);
}
.error-note {
  padding: var(--s3); border-radius: var(--r-sm);
  background: var(--danger-50); color: var(--danger-strong);
  font-size: var(--fs-base); font-weight: 600;
}

/* ── Table ─────────────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }
.tbl th {
  text-align: start; font-size: var(--fs-xs); font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3);
  padding: var(--s2) var(--s3); border-block-end: var(--border-w) solid var(--line-2);
}
.tbl td { padding: var(--s3); border-block-end: var(--border-w) solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-block-end: 0; }

/* ── Page head (title block above page content) ────────────── */
.page-head { display: flex; flex-direction: column; gap: var(--s2); margin-block-end: var(--s5); }
.page-head h1 { font-size: var(--fs-xl); font-weight: 750; line-height: var(--lh-tight); }

.facts { display: flex; flex-direction: column; gap: var(--s1); font-size: var(--fs-sm); color: var(--ink-2); }
.facts .fact { display: flex; gap: var(--s2); align-items: baseline; }
.facts .fact svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 1.75; fill: none; align-self: center; flex-shrink: 0; }
.facts .fact b { color: var(--ink); font-weight: 650; }

/* ── Breadcrumb / back ─────────────────────────────────────── */
.crumbs { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-sm); color: var(--ink-2); margin-block-end: var(--s4); }
.crumbs a { color: var(--ink-2); display: inline-flex; align-items: center; gap: var(--s1); }
.crumbs a:hover { color: var(--brand); }
.crumbs .crumb-sep { color: var(--gray-400); }
.crumbs svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* ── Modal ─────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; background: var(--overlay);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  z-index: var(--z-modal); display: flex; align-items: center; justify-content: center;
  padding: var(--s4);
}
.modal.hidden { display: none; }
.modal-panel {
  width: min(420px, 100%); background: var(--bg);
  border: var(--border-w) solid var(--line); border-radius: var(--r-lg);
  padding: var(--s5) var(--s4) var(--s4); position: relative; box-shadow: var(--sh-4);
  /* 矮视口 (横屏手机/小窗) 底座保证: 面板永不越过 .modal 的 s4 内边距,
     超高内容转内部滚动 (所有 .modal-panel 弹窗共享, 不逐弹窗另写) */
  max-height: calc(100dvh - 2 * var(--s4));
  overflow-y: auto; overscroll-behavior: contain;
}
/* 图标关闭钮 (5 个弹窗面共用): 32×32 正方形热区 + grid 居中;
   min-height:0 抵消全局 button 基样的 40px 高 (不抵消则钮被拉高、
   字形贴顶, 呈失控观感) */
.modal-close {
  position: absolute; inset-block-start: var(--s2); inset-inline-end: var(--s2);
  width: 32px; height: 32px; min-height: 0; padding: 0;
  display: grid; place-items: center;
  background: none; border: 0; cursor: pointer; color: var(--ink-2);
  border-radius: var(--r-full);
}
/* 字形尺寸有意走全局 svg 基样 (svg:not([width]) 的 20px, 特异度
   (0,2,1) 高于本规则的 class 级写法 — 写 width 只会留下永不生效的
   死声明); 这里只管描边语言 */
.modal-close svg { stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }
@media (hover:hover) and (pointer:fine) { .modal-close:hover { background: var(--gray-100); color: var(--ink); } }

/* 就地复制确认 (window.copyFeedback): 图标钮翻对勾; 文本钮变
   "✓ 已复制" 并带确认色 */
.copied { color: var(--ok); }

/* ── Toast ─────────────────────────────────────────────────── */
/* Driven by window.globalToast (base-engine.js): enter (.on) fades in,
   dismiss removes .on and the node after the transition. */
.toast {
  position: fixed; inset-block-end: var(--s5); inset-inline: 0;
  margin-inline: auto; width: fit-content; max-width: min(420px, calc(100% - var(--s6)));
  display: flex; align-items: center; gap: var(--s3);
  background: var(--gray-900); color: var(--brand-ink); border-radius: var(--r);
  padding: var(--s3) var(--s4); font-size: var(--fs-base); font-weight: 600;
  box-shadow: var(--sh-3); z-index: var(--z-toast);
  opacity: 0; transform: translateY(6px);
  transition: opacity .22s var(--ease), transform .22s var(--ease);
}
.toast.on { opacity: 1; transform: translateY(0); }
.toast svg { width: 17px; height: 17px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.chip {
  display: inline-flex; align-items: center; height: 22px; padding-inline: var(--s2);
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.03em;
  background: var(--gray-100); color: var(--ink-2); border-radius: var(--r-xs);
}

/* ── Copy field (value + copy button, e.g. MCP name) ───────── */
.copyfield { display: flex; gap: var(--s2); align-items: stretch; }
.copyfield .input { font-family: var(--font-mono); }
/* 桌面紧凑字号; ≤767 回落底部输入地板 16px (防聚焦放大) */
@media (min-width: 768px) { .copyfield .input { font-size: var(--fs-sm); } }

/* ── Tool search (market + home tools section — one component) ── */
.tool-search { position: relative; width: 100%; }
.tool-search > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; stroke: var(--ink-2); fill: none; pointer-events: none; }
.tool-search input { width: 100%; box-sizing: border-box; padding: 10px 14px 10px 38px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--bg); color: var(--ink); }
.tool-search input:focus { outline: none; border-color: var(--ink-3); }

/* ── Tool card (.tc — ONE card: home bento + market + author page +
   favorites; interior markup single-sourced in
   partials/tool_identity.html tool_card). Fixed rows: icon+name /
   description (fixed 2-line clamp) / footer of exactly TWO rows
   (tags / author+star) pinned to the card bottom — grid rows stretch,
   so same-row cards are equal height and bottom-aligned.
   结构: 卡片是 <article>; 标题链接 ::after 铺满整卡 (整卡可点);
   作者链接与收藏星标 position/z-index 在铺满层之上 (独立可点)。── */
.tc {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  background: var(--card); border: var(--border-w) solid var(--line);
  border-radius: var(--r-lg); padding: var(--s4);
  color: var(--ink);
  box-shadow: var(--sh-1);
  transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease);
  content-visibility: auto;
  contain-intrinsic-size: auto 180px;
}
@media (hover:hover) and (pointer:fine) {
  .tc:hover {
    border-color: var(--line-2);
    box-shadow: var(--sh-2);
    transform: translateY(-2px);
  }
  .tc:hover .ic {
    border-color: var(--brand-100);
    color: var(--brand);
  }
}
.tc-title { color: inherit; text-decoration: none; }
/* 铺满层: 标题链接的命中区扩展到整卡 — 卡片是 article, 无嵌套 <a> */
.tc-title::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.tc:has(.tc-title:focus-visible) { outline: 2px solid var(--ink-3); outline-offset: 2px; }
.tc-h { display: flex; align-items: center; gap: 10px; min-width: 0; }
/* 图标块: 与工具页头部图标同一表达 — 浅色底 + 细线 + 深灰轮廓 */
.tc .ic {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: grid; place-items: center; background: var(--card);
  border: var(--border-w) solid var(--line); box-shadow: var(--sh-1);
  color: var(--ink);
  transition: border-color var(--ease), color var(--ease);
}
.tc .ic svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.tool-ident-icon {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: grid; place-items: center; background: var(--card);
  border: var(--border-w) solid var(--line); box-shadow: var(--sh-1);
  color: var(--ink);
}
.tool-ident-icon svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.tc-h h4 {
  margin: 0; font-size: var(--fs-md); font-weight: 650; letter-spacing: -0.01em;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* 手机两列窄卡: 单行省略号吃掉长标题 — 允许两行后截断
   (.tc 是 flex 列, .ft2 margin-top:auto 钉底, 多一行不破坏底栏对齐) */
@media (max-width: 767px) {
  .tc-h h4 {
    white-space: normal; text-overflow: clip;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  }
}
.tc-desc {
  margin: 8px 0 0; font-size: 13px; color: var(--ink-2); line-height: var(--lh-base);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: calc(2 * var(--lh-base) * 1em);
}
/* 底栏恒两行 (与卡宽无关, 同排卡片由网格拉伸等高): 第一行 = 文件数 +
   价格标签; 第二行 = 作者 + 收藏星标。两行各自 nowrap, 永不折行 */
.tc .ft2 {
  margin-top: auto; padding-top: 12px; min-width: 0;
  display: flex; flex-direction: column; gap: 8px;
  font-size: 12px; color: var(--ink-3);
}
/* 第一行: 价格标签永不截断; 过长的文件数标签只截断自己 (省略号)。
   .tag 基类是 inline-flex 容器 — text-overflow 在 flex 容器上无效,
   文件数标签覆盖为块级显示让省略号作用在文本本身 (line-height 补
   .tag 的 22px 高度保持文本垂直居中) */
.tc .ft-tags {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  flex-wrap: nowrap;
}
.tc .ft-tags .tag { white-space: nowrap; }
.tc .ft-tags .ft-files {
  display: block;
  flex: 0 1 auto; min-width: 0;
  line-height: 22px;
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.tc .ft-tags .tag.cost, .tc .ft-tags .tag.free { flex: none; }
/* 第二行: 作者在左 (头像加名称, 名称超长省略号截断), 星标在右;
   收藏页的 mcp 名 (caller 块) 落两者之间, 填充中段不破坏两行 */
.tc .ft2 .ft-end {
  min-width: 0;
  display: flex; align-items: center; gap: 6px; flex-wrap: nowrap;
}
.tc .by, .tc .fav-btn { position: relative; z-index: 1; }
.tc .by {
  flex: 0 1 auto; min-width: 0;
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--ink-3); white-space: nowrap;
  text-decoration: none;
}
@media (hover:hover) and (pointer:fine) { .tc a.by:hover { color: var(--ink); text-decoration: underline; } }
.tc .by .by-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* 作者头像 = 全局首字母兜底单源 (.avatar-fallback), 卡内只定尺寸 */
.tc .by .tc-av { width: 18px; height: 18px; font-size: 9px; flex: none; }
/* 平台官方作者 = 品牌 mark (与工具页 .tp-h .auth 同一表达), 名称与
   用户名称同字号同色 */
.tc .by .official-mark {
  width: 18px; height: 18px; border-radius: 5px;
  display: inline-block; flex: none;
}
/* ── 收藏星标 (.fav-btn — 全站单源) ─────────────────────────
   全站统一形态: 裸星无壳无底 (background 恒 transparent, 禁灰底);
   尺寸全站统一定为 26×26 (内嵌 svg 恒 18×18, 细描边 stroke-width: 1.6);
   严禁加重图标 (hover 禁变黑 --ink);
   严禁黄色以外的任何填充;
   仅由轮廓 (stroke) 与黄色填充 (fill: var(--warn)) 表达状态与 hover 切换:
   - 未收藏默认: 灰色细轮廓, fill none
   - 未收藏 hover: 黄色轮廓 + 黄色填充 (点亮预览)
   - 已收藏默认: 黄色轮廓 + 黄色填充
   - 已收藏 hover: 黄色轮廓, fill none (退回轮廓预览取消)
   [data-fav] 由 favorites.js 全站委托处理。 */
.fav-btn {
  flex: none; width: 26px; height: 26px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent !important; color: var(--ink-3); cursor: pointer;
  border-radius: var(--r-sm);
  transition: color var(--ease);
}
.fav-btn svg {
  width: 18px; height: 18px; display: block;
  stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round;
  fill: none;
  transition: fill var(--ease), stroke var(--ease);
}
.fav-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.fav-btn[aria-pressed="true"] { color: var(--warn); }
.fav-btn[aria-pressed="true"] svg { fill: var(--warn); }
@media (hover:hover) and (pointer:fine) {
  .fav-btn:hover { color: var(--warn); background: transparent !important; }
  .fav-btn:not([aria-pressed="true"]):hover svg { fill: var(--warn); }
  .fav-btn[aria-pressed="true"]:hover svg { fill: none; }
}
.tc .fav-btn { margin-inline-start: auto; }
.tc .fav-mcp {
  flex: 1; min-width: 0; text-align: right;
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* 收藏卡上的暂停徽章: 该工具调用会答 tool_paused, 卡片保持可见 */
.tc .fav-paused-tag {
  font-family: var(--font); font-size: 11px; color: var(--warn);
  border: 1px solid var(--warn); border-radius: var(--r-full);
  padding: 1px 8px; margin-inline-start: 6px;
  background: var(--warn-50);
}
@media (max-width: 767px) {
  .tc { padding: 14px; }
  .tc-desc { font-size: 12px; }
  .tc .ic { width: 34px; height: 34px; border-radius: 10px; }
  /* 触屏命中区扩展 (与工具页星标同法): 26px 星标 + ::after ≈ 44px */
  .tc .fav-btn::after { content: ""; position: absolute; inset: -9px; }
}

/* ── Tool input — the composer (shared component: home + tool page).
   Structure lives in pages/tool-input.js; DOM:
   .composer > .c-files + .ti-drop/.c-text/.params + .c-bar + .ti-error/.ti-quota (bottom):
   .prow (label + .seg/.input/.switch) + .c-bar (.ib clip + .opt
   delivery pill + .sp + .send). Legacy hooks kept for tests/JS:
   .ti-file-input (hidden file input), .ti-run (submit), .ti-error,
   .ti-progress. ──────────────────────────────────────────────── */
.composer {
  background: var(--card); border: var(--border-w) solid var(--line-2);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-2);
  text-align: start; overflow: visible; position: relative;
}
/* .focus 类仅是 JS 状态钩子: 最外壳边框恒稳 — 聚焦高亮只发生在
   内部输入件 (.ti-drop / 文本框), 外壳不再变色 */
.composer.dragover { border-color: var(--brand); border-style: dashed; }

/* 文件列表: 等宽网格 — 多文件整齐排列, 长名省略号; 拖放区常驻其下 */
.c-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--s2); padding: 14px 16px 0; }
.c-files:empty { display: none; }
/* 空态上传区: 整块点击/拖入 (files_max>0 才渲染)。
   静态 = 沉底浅实线的"槽"; 虚线只属于拖拽/悬停反馈 (composer.dragover
   与下方 hover/focus/dragover 规则), 不再作为静态装饰。 */
.ti-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; margin: 14px 16px 0; min-height: 136px; padding: var(--s3);
  width: calc(100% - 32px); box-sizing: border-box;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--sunk); font: inherit; cursor: pointer; text-align: center;
  transition: background var(--ease), border-color var(--ease);
}
.ti-drop[hidden] { display: none; }
.ti-drop .dz-ic {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line);
  box-shadow: var(--sh-1);
  display: grid; place-items: center;
  transition: transform var(--ease), border-color var(--ease);
}
.ti-drop .dz-ic svg { width: 22px; height: 22px; stroke: var(--ink-2); stroke-width: 1.75; fill: none; stroke-linecap: round; stroke-linejoin: round; transition: stroke var(--ease); }
.ti-drop b { font-size: var(--fs-md); font-weight: 650; color: var(--ink); }
.ti-drop small { font-size: var(--fs-xs); color: var(--ink-3); }
@media (hover:hover) and (pointer:fine) {
  .ti-drop:hover { background: var(--brand-50); border-color: var(--brand-100); }
  .ti-drop:hover .dz-ic { border-color: var(--brand-100); transform: translateY(-1px); }
  .ti-drop:hover .dz-ic svg { stroke: var(--brand); }
}
.ti-drop:focus-visible { border-color: var(--ink-3); outline: none; }
.ti-drop.dragover { border-color: var(--brand); background: var(--brand-50); }
.ti-drop.dragover .dz-ic { border-color: var(--brand-100); }
.ti-drop.dragover .dz-ic svg { stroke: var(--brand); }
/* 已满态 (files_max 上限): 尺寸不变, 不再是入口 — 降透明度、去手型与悬停反馈 */
.ti-drop.ti-drop-full { cursor: default; opacity: 0.55; }
.ti-drop.ti-drop-full .dz-ic svg { stroke: var(--line-2); }
@media (hover:hover) and (pointer:fine) {
  .ti-drop.ti-drop-full:hover { border-color: var(--line); background: var(--sunk); }
  .ti-drop.ti-drop-full:hover .dz-ic { border-color: var(--line); transform: none; }
  .ti-drop.ti-drop-full:hover .dz-ic svg { stroke: var(--line-2); }
}
/* 已有文件: 上传区收成一行 "继续添加" (图标 + 文案同行, 透明底), 不再
   在文件卡下方叠一整块灰槽 — 卡内只剩 文件 → 添加 → 运行 */
.c-files:not(:empty) + .ti-drop {
  flex-direction: row; gap: 8px; min-height: 44px; padding: 8px var(--s3);
  background: transparent;
}
.c-files:not(:empty) + .ti-drop .dz-ic {
  width: auto; height: auto; border: 0; border-radius: 0; background: none; box-shadow: none;
}
.c-files:not(:empty) + .ti-drop .dz-ic svg { width: 18px; height: 18px; }
.c-files:not(:empty) + .ti-drop b { font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
@media (max-width: 767px) { .c-files:not(:empty) + .ti-drop small { display: none; } }
/* 24h 额度低余量提示 (上传区下方一行; 数据 = limits 投影 dailyRemaining) */
.ti-quota { margin: 8px 16px 14px; font-size: var(--fs-xs); color: var(--warn); }
.chipf {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 6px;
  border: var(--border-w) solid var(--line); border-radius: 12px;
  background: var(--sunk); font-size: 13px; min-width: 0;
}
.chipf > span { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.chipf .th { width: 36px; height: 36px; border-radius: 8px; flex: none; object-fit: cover; background: var(--brand-100); }
.chipf .th.d { background: var(--sunk); border: var(--border-w) solid var(--line-2); display: grid; place-items: center; }
.chipf .th.d svg { width: 17px; height: 17px; stroke: var(--ink-2); stroke-width: 1.75; fill: none; stroke-linecap: round; stroke-linejoin: round; }
/* 名字/元信息行吃满剩余宽度 (省略号跟随可用宽度, 不再 160px 截断) */
.chipf b { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chipf small { color: var(--ink-3); font-size: var(--fs-xs); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chipf .x {
  color: var(--ink-3); margin-inline-start: auto; flex: none; min-height: 0;
  background: none; border: 0;
  cursor: pointer; display: grid; place-items: center; padding: var(--s1);
  border-radius: var(--r-xs);
}
.chipf .x svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }
@media (hover:hover) and (pointer:fine) { .chipf .x:hover { color: var(--danger); background: var(--danger-50); } }

/* 字段形态的 text/json 框: json 等宽 + 语法色底; multiline 自动增高
   (JS 贴合高度, CSS 封顶同正文框) */
.composer .textarea.tp-text.tp-json {
  font-family: var(--font-mono); font-size: 13px;
}
.composer .textarea.tp-text.tp-multi {
  min-height: calc(4 * var(--lh-base) * 1em + 24px);
  max-height: calc(10 * var(--lh-base) * 1em + 24px + 2px);
  overflow-y: auto;
}
/* 文本框角上的清空钮 (有内容才显示): 绝对定位于框内右上角,
   文本为其让出右侧内边距, 长文本不压在按钮下。正文框与字段框
   (.ti-text-wrap) 同一表达 */
.composer .params .ti-text-wrap { position: relative; }

.composer .params .ti-text-wrap .textarea.tp-text { padding-inline-end: 38px; }
.composer .params .ti-text-wrap .ti-clear {
  top: 6px; inset-inline-end: 6px; width: 24px; height: 24px;
}
.composer .ti-clear {
  position: absolute; top: 22px; inset-inline-end: 24px;
  display: grid; place-items: center; width: 28px; height: 28px; padding: 0;
  border: 0; border-radius: var(--r-full); background: var(--line); color: var(--ink-2);
  cursor: pointer;
}
.composer .ti-clear[hidden] { display: none; }
.composer .ti-clear svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2.2; fill: none; stroke-linecap: round; }
.composer .ti-clear:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (hover:hover) and (pointer:fine) { .composer .ti-clear:hover { background: var(--ink-3); color: var(--card); } }

.params { display: flex; flex-direction: column; gap: 14px; padding: 4px 20px 6px; }
.params:empty { display: none; }
.params .divider { height: 1px; background: var(--line); margin: 4px 0 0; }
/* 参数行: 桌面 = 标签在左、控件在右; 手机 = 标签在上、控件占满宽度
   (首页与工具页同一套 — 首页 hero 与 .toolpage 共用本组件) */
.prow { display: flex; align-items: center; gap: var(--s2) var(--s3); }
.prow > label, .prow > .prow-label {
  font-size: 13px; color: var(--ink-3);
  flex: 0 0 auto; min-width: 56px; max-width: 44%;
  overflow-wrap: anywhere;
}
/* 控件自适应宽度 (不再写死 180px): 输入框按内容伸缩, seg 随选项换行 */
.prow .input { width: auto; min-width: 96px; max-width: 240px; flex: 0 1 auto; }
.prow .seg, .prow .switch { flex: 0 1 auto; max-width: 100%; }
.prow-text { align-items: flex-start; }
.prow-text > .prow-label { padding-top: 8px; }
.prow-text > .textarea { flex: 1; min-width: 220px; }
@media (max-width: 767px) {
  .prow { flex-direction: column; align-items: stretch; gap: var(--s1); }
  .prow > .prow-label { min-width: 0; max-width: none; padding-top: 0; }
  .prow .input { width: 100%; max-width: none; }
  .prow-text > .textarea { min-width: 0; width: 100%; }
}
/* 参数分段选项: 超出一行自动换行; 外框普通圆角 (换行后不再是胶囊形) */
.seg { display: inline-flex; padding: 3px; background: var(--sunk); border-radius: var(--r-sm); gap: 2px; flex-wrap: wrap; }
.seg button, .seg a {
  height: 30px; padding: 0 13px; border-radius: var(--r-xs); border: 0;
  background: none; display: inline-flex; align-items: center;
  font: inherit; font-size: 13px; font-weight: 550; color: var(--ink-2); cursor: pointer;
}
.seg a { text-decoration: none; }
.seg button.on, .seg a.on { background: var(--card); color: var(--ink); }
@media (hover:hover) and (pointer:fine) { .seg button:not(.on):hover, .seg a:not(.on):hover { color: var(--ink); } }

/* 参数卡片: 参数区每行 = 标签在上、控件在下 (各宽度一致); 枚举参数的
   每个选项是一张独立卡片, 网格自动换行, 选中 = 品牌色描边。开关行保持
   标签与开关同一行。比例值 (W:H) 的选项卡内画出该比例的小框。 */
.params .prow { flex-direction: column; align-items: stretch; gap: var(--s2); }
.params .prow > .prow-label {
  min-width: 0; max-width: none; padding-top: 0;
  font-size: 13px; font-weight: 400; color: var(--ink-2);
}
.params .prow.prow-bool { flex-direction: row; align-items: center; justify-content: space-between; }
.params .prow-text > .textarea { min-width: 0; width: 100%; }
/* 行内字段错误 (预校验失败/服务端 param_* 拒绝落到字段行): 行内一句
   提示 + 控件描边, 与卡片底部 ti-error 分层 */
.params .prow.prow-err > .input,
.params .prow.prow-err > .ti-text-wrap > .textarea,
.params .prow.prow-err > .tp-seg { border-color: var(--danger); }
.params .prow .tp-field-err {
  display: block; margin: 0; font-size: var(--fs-xs);
  font-style: normal; color: var(--danger);
}
.params .prow .tp-seg {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(84px, 100%), 1fr));
  gap: 8px; width: 100%; padding: 0; background: none; border-radius: 0;
}
/* 手机: 桌面 84px 最小列宽在窄容器里挤出 3+1 换行 — 提高最小列宽
   让选项成对换行 (2 列), 枚举卡上下均衡 */
@media (max-width: 767px) {
  .params .prow .tp-seg { grid-template-columns: repeat(auto-fill, minmax(min(148px, 100%), 1fr)); }
}
.tp-seg .tp-option {
  height: auto; min-height: 40px; min-width: 0; padding: 8px 10px; gap: 6px;
  /* 按词换行 (CJK 字间自然断): anywhere 会把拉丁词从词中硬拆
     ("Smart (recommended)" 断成三行); break-word 只对放不下的
     单个超长词兜底断词 */
  flex-direction: column; overflow-wrap: break-word; justify-content: center; text-align: center;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--card); color: var(--ink-2); box-shadow: none; font-weight: 500;
  transition: border-color .15s, color .15s, background .15s, box-shadow .15s;
}
/* 选中 = 1px 品牌色细描边 + 浅底 + 轻量立体感 */
.tp-seg .tp-option.on {
  border-color: var(--brand); color: var(--brand); background: var(--brand-50);
  font-weight: 600; box-shadow: var(--sh-1);
}
@media (hover:hover) and (pointer:fine) {
  .tp-seg .tp-option:hover:not(.on) { border-color: var(--ink-4); color: var(--ink); background: var(--sunk); }
}
.tp-seg .tp-option:focus-visible { outline: 2px solid var(--ink-3); outline-offset: 2px; }
.tp-seg .tp-ratio {
  display: block; height: 22px; max-width: 36px;
  border: 1.5px solid currentColor; border-radius: 3px; opacity: .8;
}
.tp-seg .tp-ratio.free { aspect-ratio: 1; border-style: dashed; }

/* "更多参数"折叠: 参数超过 3 个时, 其余收进展开区 */
.ti-more { display: flex; flex-direction: column; gap: 14px; }
.ti-more-btn {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px;
  min-height: 0; padding: 2px 0; border: 0; border-radius: 0;
  background: none; color: var(--ink-3);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.ti-more-btn .chev {
  width: 7px; height: 7px; flex: none;
  border-inline-end: 1.5px solid currentColor; border-block-end: 1.5px solid currentColor;
  transform: rotate(-45deg); transition: transform var(--ease);
}
.ti-more-btn.open .chev { transform: rotate(135deg); }
.ti-more-btn:focus-visible { outline: 2px solid var(--ink-3); outline-offset: 2px; }
.ti-more-body { display: flex; flex-direction: column; gap: 14px; }
.ti-more-body[hidden] { display: none; }

.c-bar { display: flex; align-items: center; gap: 6px; padding: 10px 12px 12px; flex-wrap: wrap; position: relative; }
/* 底栏尾部 (有效期+进度+运行) 桌面透明展开; 移动端成组整体换行 */
.bar-tail { display: contents; }
.c-bar .sp { flex: 1; }
.ib {
  width: 36px; height: 36px; border-radius: var(--r-full); border: 0;
  display: grid; place-items: center; color: var(--ink-2); background: none; cursor: pointer;
}
.ib svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
@media (hover:hover) and (pointer:fine) { .ib:hover { background: var(--gray-100); } }
@media (max-width: 767px) { .ib { position: relative; } .ib::after { content: ""; position: absolute; inset: -5px; } }
.opt {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px;
  border-radius: var(--r-full); background: var(--sunk); border: 0;
  font: inherit; font-size: 13px; color: var(--ink-2); font-weight: 500; cursor: pointer;
}
.opt b { color: var(--ink); font-weight: 600; }
.opt svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
/* 运行钮: 纯正品牌主色材质 (Logo 原色 #ff4d4d 基底, 质感渐变) */
.send {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(180deg, var(--brand), var(--brand-600));
  color: var(--brand-ink); border: 0; display: grid; place-items: center;
  cursor: pointer; box-shadow: 0 2px 8px color-mix(in srgb, var(--brand) 28%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: all var(--ease);
}
@media (hover:hover) and (pointer:fine) {
  .send:hover {
    background: linear-gradient(180deg, var(--brand-strong), var(--brand-600));
    box-shadow: 0 4px 14px color-mix(in srgb, var(--brand) 40%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
  }
}
.send svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.send.wide { width: auto; padding: 0 18px; border-radius: var(--r-sm); gap: 6px; display: inline-flex; align-items: center; font: inherit; font-weight: 650; font-size: var(--fs-base); }
/* 禁用读作明确的"非激活"而非半透明红 (红底降不透明度仍像可点的浅红) */
.send:disabled {
  cursor: default; pointer-events: none;
  background: var(--sunk); color: var(--ink-3);
  box-shadow: none; opacity: 1;
}
/* 运行中 (busy 由 tool-input.js 在操作生命周期挂/摘):
   圆钮 = 图标原地旋转; 文字钮无图标 = 文字前置旋转环 */
.send.busy svg { animation: ti-run-spin 0.9s linear infinite; }
.send.wide.busy::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  animation: ti-run-spin 0.9s linear infinite; flex: none;
}
@keyframes ti-run-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .send.busy svg, .send.wide.busy::before { animation: none; }
}
.ti-progress { font-size: var(--fs-sm); color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* delivery pill popover (existing values, existing entitlement logic) */
/* ── 锚定浮层家族 (共享视觉语言): 卡面 + line-2 描边 + 大圆角 +
   sh-3 投影; @starting-style 入场 (无首帧竞态); 锚定各自的触发者 ── */

/* 有效期/次数浮层: 锚定"1 天 · 50 次"胶囊正上方 */
.ti-del-wrap { position: relative; display: inline-flex; }
.c-del-pop {
  position: absolute; inset-block-end: calc(100% + 8px); inset-inline-start: 0;
  z-index: var(--z-dropdown); background: var(--card);
  border: var(--border-w) solid var(--line-2); border-radius: var(--r-lg);
  box-shadow: var(--sh-3); padding: var(--s4);
  display: flex; flex-direction: column; gap: var(--s3);
  width: min(280px, calc(100vw - 48px));
  transition: opacity .16s var(--ease), transform .16s var(--ease);
}
@starting-style { .c-del-pop { opacity: 0; transform: translateY(4px) scale(.98); } }
.c-del-pop .field { min-width: 0; }

/* ── 说明提示 (全站单点, base-engine.js): 需要说明的地方放一个 info
   图标钮, 悬停/点按弹出轻量浮层 (卡面描边, 不遮罩, 不锁滚动) ── */
.tip {
  display: inline-grid; place-items: center; flex: none; vertical-align: middle;
  width: 28px; height: 28px; padding: 0; border: 0; border-radius: var(--r-full);
  background: none; color: var(--ink-3); cursor: help;
}
.tip svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.tip[aria-expanded="true"] { color: var(--ink); background: var(--sunk); }
.tip:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
@media (hover:hover) and (pointer:fine) { .tip:hover { color: var(--ink); } }
.tip-pop {
  position: fixed; z-index: calc(var(--z-modal) + 1);
  max-width: min(300px, calc(100vw - 16px)); padding: 10px 12px;
  background: var(--card); color: var(--ink-2);
  border: var(--border-w) solid var(--line-2); border-radius: var(--r);
  box-shadow: var(--sh-3);
  font-size: var(--fs-sm); font-weight: 400; line-height: 1.55; text-align: start;
  transition: opacity .14s var(--ease);
}
.tip-pop[hidden] { display: none; }
@starting-style { .tip-pop { opacity: 0; } }

/* 浮层内滚动区: 细滚动条、透明轨道、浅色滑块 (替代系统深灰粗条);
   滚到边界不把滚动链给底层页面 (contain) */
.tsel-list, .lang-menu, .user-dropdown, .history-panel, .modal-panel {
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
  overscroll-behavior: contain;
}

/* 视口级浮层打开期间锁住页面滚动 (全站单点): 居中/全屏浮层可见时,
   滚轮与触摸只作用于浮层自身, 底层页面不跟着滚。锚定式小菜单
   (lang-menu / user-dropdown / 桌面 c-del-pop) 不锁, 只靠 contain。 */
html:has(.modal:not(.hidden)),
html:has(.img-zoom:not(.hidden)),
html:has(.video-view:not(.hidden)),
html:has(.tsel-pop:not(.hidden)) { overflow: hidden; }
/* 平板抽屉 (768–1023) 开启时同样锁住底层滚动 (与窄屏同一抽屉) */
@media (max-width: 1023px) {
  html:has(.mobile-nav-sheet:not(.hidden)) { overflow: hidden; }
}
@media (max-width: 767px) {
  html:has(.c-del-pop:not(.hidden)) { overflow: hidden; }
}
.tsel-list::-webkit-scrollbar, .lang-menu::-webkit-scrollbar, .user-dropdown::-webkit-scrollbar,
.history-panel::-webkit-scrollbar, .modal-panel::-webkit-scrollbar { width: 6px; height: 6px; }
.tsel-list::-webkit-scrollbar-track, .lang-menu::-webkit-scrollbar-track, .user-dropdown::-webkit-scrollbar-track,
.history-panel::-webkit-scrollbar-track, .modal-panel::-webkit-scrollbar-track { background: transparent; }
.tsel-list::-webkit-scrollbar-thumb, .lang-menu::-webkit-scrollbar-thumb, .user-dropdown::-webkit-scrollbar-thumb,
.history-panel::-webkit-scrollbar-thumb, .modal-panel::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: var(--r-full); }
.tsel-list::-webkit-scrollbar-thumb:hover, .lang-menu::-webkit-scrollbar-thumb:hover, .user-dropdown::-webkit-scrollbar-thumb:hover,
.history-panel::-webkit-scrollbar-thumb:hover, .modal-panel::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }

/* 手机端: 锚定空间不足, 有效期浮层与工具选择浮层同形 — 居中卡片
   (常态 transform 负责居中; starting-style 含同一偏移, 入场无跳位) */
@media (max-width: 767px) {
  .c-del-pop {
    position: fixed; inset-block-end: auto; top: 50%; inset-inline-start: 50%;
    transform: translate(-50%, -50%);
    width: min(320px, calc(100vw - 48px));
  }
  @starting-style { .c-del-pop { opacity: 0; transform: translate(-50%, -48%) scale(.97); } }
}

@media (max-width: 767px) {
  .composer { border-radius: 22px; }
  .c-bar { gap: 4px; }
  /* 手机底栏: 有效期与运行同一行, 进度文本可收缩。 */
  .c-bar .bar-tail { display: flex; align-items: center; gap: 4px; flex-basis: 100%; }
  .c-bar .sp { display: none; }
  .c-bar .ti-run { margin-inline-start: auto; }
  .ti-progress { flex-shrink: 1; min-width: 0; overflow: hidden; white-space: nowrap; }
  .send.wide { padding: 0 14px; min-height: 44px; }
  /* 添加文件: 移动端图标按钮; .ib 统一伪元素扩点击区到 ≥44 (视觉不变) */
  .tp-seg .tp-option { min-height: 44px; }
}
/* 输入区挂载预留高度 (CLS) — 只作用于挂载前 (:empty; 挂载节点在模板里
   不得有空白字符, 否则 :empty 不成立)。224 = 首页/纯文件工具的挂载
   高度; 工具页多出参数卡行 (实测 compress 381 / ico 433 @390), 按页
   加高预留把挂载增长压到 ≈0, 挂载后回落只影响卡下方内容 — 且挂载后
   预留完全退场, 卡后间距回到常规值。 */
.ti-mount:empty { min-height: 224px; }
@media (max-width: 767px) { .toolpage .ti-mount:empty { min-height: 384px; } }
@media (min-width: 768px) { .toolpage .ti-mount:empty { min-height: 328px; } }

/* Phone: result actions collapse to icon buttons (labels via
   aria-label + title on every button) */

/* ── Tier badge (.tier) — 会员等级徽标单源 ────────────────────
   标记唯一出口 = web_ctx.tier_badge() 生产者 (模板禁止手拼, source
   invariants 守卫)。徽标文案 = 套餐行 name 原文 (品牌名, 语言无关);
   变体类 = 槽位词表 TIER_SLOTS (tier_free/tier_plus/tier_pro/
   tier_max, CSS 全预置; 新档 = 生产者词表 + 此处各加一条),
   badge_key 未知/缺省 → 基础态 (深色徽牌)。Free = 非会员,
   生产者显式给 tier_free。表面只包几何 (行布局/截断), 禁改徽标本体。 */
.tier {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: var(--r-full);
  border: 1px solid transparent;
  font-size: var(--fs-xs); font-weight: 750; letter-spacing: .04em;
  background: var(--ink); color: var(--brand-ink); text-decoration: none;
}
/* 辨识点: 随文字色的状态圆点, 语言无关的档位视觉锚 */
.tier::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
a.tier:hover { opacity: .85; }
.tier_free { background: transparent; border-color: var(--line-2); color: var(--ink-2); font-weight: 650; }
.tier_plus { background: var(--brand-soft); color: var(--brand-deep); }
.tier_pro { background: var(--brand-deep); color: var(--brand-ink); }
.tier_max { background: linear-gradient(135deg, var(--brand-deep), var(--brand-600)); color: var(--brand-ink); }

/* ── Avatar fallback (.avatar-fallback) — 头像兜底单源 ────────
   无头像时的首字母兜底: 品牌红固定底 + 白字 + 圆形 (token 随主题
   自适应, 不再各处散落配色与形状)。表面只定义尺寸 (宽高/字号),
   禁另造配色或圆角。 */
.avatar-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand);
  color: var(--brand-ink); font-weight: 700; letter-spacing: 0;
  border-radius: 50%;
  user-select: none; overflow: hidden;
}

/* ── Auth card — single source (auth/_card.html) ───────────────
   One look for BOTH mounts: the standalone /auth pages (.auth-card
   inside .auth-page) and the site-wide login/register overlay
   (.auth-modal riding the .modal/.modal-panel primitives). Container
   differences stay with the containers (the modal carries the close
   button and overlay chrome); fields reuse .field/.input/.btn/.seg
   and the form layout comes from .auth-form (518.css). */
.auth-card, .auth-modal { width: min(400px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--sh-3); padding: var(--s5) var(--s4) var(--s4); display: flex; flex-direction: column; gap: var(--s4); }
/* 浮层克隆挂载点与卡同构: 同一套 flex 列 + 同 gap — 克隆内容不再丢
   卡片间距 (此前 .am-body 是普通块, 卡 gap 全部失效) */
.am-body { display: flex; flex-direction: column; gap: var(--s4); min-width: 0; }
.auth-title { font-size: var(--fs-lg); font-weight: 750; text-align: center; margin: 0; }
.auth-sub { text-align: center; font-size: var(--fs-sm); color: var(--ink-3); margin: -6px 0 0; }
.auth-seg { width: 100%; }
.auth-seg button, .auth-seg a { flex: 1; }
.auth-card .auth-x-wrap .x-login, .auth-modal .auth-x-wrap .x-login { width: 100%; }
.auth-terms { text-align: center; font-size: var(--fs-xs); color: var(--ink-3); margin: var(--s3) 0 0; }
.auth-terms a { color: var(--ink-2); text-decoration: underline; }
/* 密码可见切换: 字段右缘内嵌 36px 命中钮, 两个图标按 aria-pressed
   切换 (eye = 当前可显示, eye_off = 当前可隐藏) */
.pw-field { position: relative; }
.pw-field .input { padding-inline-end: 46px; }
.pw-toggle {
  position: absolute; inset-inline-end: 4px; bottom: 4px;
  width: 36px; height: 36px; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--ink-3); cursor: pointer;
  display: grid; place-items: center;
}
.pw-toggle:hover { color: var(--ink); background: var(--sunk); }
.pw-toggle svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.pw-toggle svg:nth-child(2) { display: none; }
.pw-toggle[aria-pressed="true"] svg:nth-child(1) { display: none; }
.pw-toggle[aria-pressed="true"] svg:nth-child(2) { display: block; }
@media (max-width: 767px) { .auth-card, .auth-modal { padding: var(--s4) var(--s3); } }

/* ── Mobile input floor (site-wide, phone widths) ──────────────
   iOS/Android auto-zoom any focused control rendered below 16px.
   On ≤767px every input-like control is forced to 16px; the compact
   desktop sizes live in min-width:768px blocks next to their page
   rules (518.css/samelabs.css), never in !important fights. This
   file loads last, so the class selectors here outrank the base
   .input/.select/.sl-input sizes above. */
@media (max-width: 767px) {
  input, select, textarea,
  .input, .textarea, .select, .sl-input { font-size: 16px; }
}

/* 分享条 (partials/share_bar.html): 复制链接 / 系统分享 / X / 二维码 —
   等宽图标卡片一行排开, 图标在上、短标签在下; /f /r 工具页 作者页同一组件 */
.share-bar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
.share-bar .sb-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 56px; min-width: 0; padding: 8px 4px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--card);
  font: inherit; font-size: 12px; font-weight: 550; color: var(--ink-2);
  text-decoration: none; cursor: pointer; transition: border-color .15s, color .15s;
}
.share-bar .sb-btn > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-bar .sb-btn svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.share-bar .sb-btn .x-glyph { font-size: 17px; height: 18px; display: inline-flex; align-items: center; }
@media (hover:hover) and (pointer:fine) { .share-bar .sb-btn:hover { border-color: var(--ink-4); color: var(--ink); } }
/* 四件套统一按压反馈 */
.share-bar .sb-btn:active { transform: scale(0.96); }
.share-bar .sb-btn:focus-visible { outline: 2px solid var(--ink-3); outline-offset: 2px; }
.share-bar.sb-compact { display: inline-flex; gap: 6px; vertical-align: middle; }
.share-bar.sb-compact .sb-btn { flex-direction: row; min-height: 30px; width: 30px; height: 30px; padding: 0; border-radius: 8px; box-shadow: var(--sh-1); }
.share-bar.sb-compact .sb-btn svg { width: 15px; height: 15px; }
.share-bar.sb-compact .sb-btn .x-glyph { font-size: 14px; height: 15px; }
.share-bar.sb-compact .sb-btn > span:last-child:not(.x-glyph) { display: none; }

/* ── 骨架屏占位 (Skeleton loader): 异步加载时的微光占位 ── */
.skeleton {
  background: linear-gradient(90deg, var(--sunk) 25%, color-mix(in srgb, var(--sunk) 55%, var(--card)) 50%, var(--sunk) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite ease-in-out;
  border-radius: var(--r-sm);
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; background: var(--sunk); }
}
.skeleton-row {
  height: 48px; width: 100%; margin-bottom: var(--s2);
}

/* ── 主题切换开关 (Theme toggle) ────────────────────────── */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
  transition: color var(--ease);
}
@media (hover:hover) and (pointer:fine) {
  .theme-toggle:hover { color: var(--ink); }
}
.theme-toggle .theme-icon-dark { display: none; }
.theme-toggle .theme-icon-light { display: flex; align-items: center; justify-content: center; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .theme-icon-dark { display: flex; align-items: center; justify-content: center; }
  :root:not([data-theme="light"]) .theme-toggle .theme-icon-light { display: none; }
}

:root[data-theme="dark"] .theme-toggle .theme-icon-dark { display: flex !important; align-items: center; justify-content: center; }
:root[data-theme="dark"] .theme-toggle .theme-icon-light { display: none !important; }

:root[data-theme="light"] .theme-toggle .theme-icon-dark { display: none !important; }
:root[data-theme="light"] .theme-toggle .theme-icon-light { display: flex !important; align-items: center; justify-content: center; }

/* ── 发布联调控制台 (Publish Live Debug Console) ──────────── */
.pub-debug-panel {
  margin-top: var(--s4);
  background: var(--sunk);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  padding: var(--s3);
  font-size: var(--fs-sm);
}
.pub-debug-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s2);
  padding-bottom: var(--s2);
  border-bottom: 1px solid var(--line);
}
.pub-debug-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-size: var(--fs-xs);
  padding: 2px 8px;
  border-radius: var(--r-full);
}
.pub-debug-badge.ok {
  background: var(--ok-50);
  color: var(--ok-700);
}
.pub-debug-badge.err {
  background: var(--danger-50);
  color: var(--danger-strong);
}
.pub-debug-time {
  font-family: var(--font-mono);
  color: var(--ink-3);
  font-size: var(--fs-xs);
}
.pub-debug-section {
  margin-top: var(--s2);
}
.pub-debug-section h4 {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 4px 0;
}
.pub-debug-code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  max-height: 140px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--ink);
}

/* ── JSON Output Syntax Highlighting ────────────────────────── */
.rs-json .json-key { color: var(--brand-deep); font-weight: 600; }
.rs-json .json-str { color: var(--ok-700); }
.rs-json .json-num { color: var(--warn); }
.rs-json .json-bool { color: var(--brand-600); font-weight: 600; }
.rs-json .json-null { color: var(--ink-3); font-style: italic; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .rs-json .json-str { color: var(--ok); }
}
:root[data-theme="dark"] .rs-json .json-str { color: var(--ok) !important; }

/* ── iOS 27 Glass Capsule Mobile Dock (<768px) ─────────────── */
.mobile-dock {
  display: none;
}

@media (max-width: 767px) {
  /* 品牌红胶囊: 双主题同一视觉 (浅色页面上白玻璃底与背景相融看不清,
     红底白字在浅/暗两种页面背景上都成立); 不再需要主题覆盖矩阵 */
  .mobile-dock {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-dropdown);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px 6px;
    border-radius: var(--r-full);
    background: var(--brand);
    /* 实色胶囊不加描边: 分离感由 sh-2 投影承载 (玻璃版需要的发丝线
       是半透明底的边界; 红底上再叠 brand-deep 描边是多余的一层) */
    box-shadow: var(--sh-2);
    width: auto;
    max-width: calc(100vw - 24px);
    box-sizing: border-box;
    transition: transform var(--ease), opacity var(--ease);
  }

  .mobile-dock .dock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 58px;
    height: 46px;
    padding: 3px 2px;
    border-radius: var(--r-full);
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: all 0.18s ease;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    box-sizing: border-box;
  }

  .mobile-dock .dock-item .mi {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    stroke-width: 1.8;
    transition: color 0.18s ease;
  }

  .mobile-dock .dock-item .dock-label {
    font-size: 10px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 54px;
    text-align: center;
    display: block;
  }

  .mobile-dock .dock-item:active {
    transform: scale(0.94);
  }

  .mobile-dock .dock-item.on {
    color: rgba(255, 255, 255, 1);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: none;
  }

  .mobile-dock .dock-item.on .dock-label {
    font-weight: 600;
  }

  .mobile-dock .dock-item.on .mi {
    transform: none;
  }

  /* Ultra-compact screen fine-tuning (<= 340px) */
  @media (max-width: 340px) {
    .mobile-dock {
      gap: 2px;
      padding: 3px 4px;
    }
    .mobile-dock .dock-item {
      width: 50px;
      height: 44px;
    }
    .mobile-dock .dock-item .dock-label {
      max-width: 46px;
      font-size: 9px;
    }
  }

  /* Reserve the dock's height on body — main-site surfaces only: the
     operator backoffice (body.sl-body, no dock) shares this sheet and
     must not be padded for a bar it never renders. */
  body:not(.sl-body) {
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 80px);
  }
}

/* 打印时隐藏悬浮底栏 (窄打印视口同样命中 max-width 查询的兜底) */
@media print {
  .mobile-dock { display: none !important; }
}

/* ── Touch target relief (phone widths): keep the 36px icon buttons and
   the 30px compact share chips VISUALLY unchanged, extend only the hit
   area through a negative-inset overlay (.ib → 44px, .sb-btn → 36px;
   the compact row's 6px gap absorbs ±3px without stealing neighbours) ── */
@media (max-width: 767px) {
  .ib, .share-bar.sb-compact .sb-btn { position: relative; }
  .ib::after, .share-bar.sb-compact .sb-btn::after {
    content: ""; position: absolute; inset: -4px;
  }
  .share-bar.sb-compact .sb-btn::after { inset: -3px; }
}

/* ── beautify backdrop swatches: each preset option carries a small
   gradient chip mirroring the preset's actual backdrop family (approximate
   preview — the renderer stays the authority). Scoped to the preset
   segment of the beautify surfaces (tool page + composer both carry
   data-tool="beautify"); the aspect segment never matches. ── */
[data-tool="beautify"] .tp-seg[data-param="preset"] .tp-option::before {
  content: ""; display: block; width: 100%; height: 12px;
  border-radius: 6px; border: 1px solid rgba(0, 0, 0, 0.08);
  margin-bottom: 2px; flex: none;
}
[data-tool="beautify"] .tp-seg[data-param="preset"] .tp-option[data-value="pure"]::before { background: rgb(252, 252, 254); }
[data-tool="beautify"] .tp-seg[data-param="preset"] .tp-option[data-value="carbon"]::before { background: rgb(18, 18, 24); }
[data-tool="beautify"] .tp-seg[data-param="preset"] .tp-option[data-value="dawn"]::before { background: linear-gradient(180deg, rgb(255, 248, 235), rgb(255, 218, 185), rgb(255, 183, 148)); }
[data-tool="beautify"] .tp-seg[data-param="preset"] .tp-option[data-value="ocean"]::before { background: linear-gradient(180deg, rgb(8, 18, 48), rgb(0, 80, 156), rgb(0, 163, 178)); }
[data-tool="beautify"] .tp-seg[data-param="preset"] .tp-option[data-value="sunset"]::before { background: linear-gradient(180deg, rgb(255, 94, 98), rgb(255, 154, 0), rgb(255, 206, 84)); }
[data-tool="beautify"] .tp-seg[data-param="preset"] .tp-option[data-value="mint"]::before { background: linear-gradient(135deg, rgb(210, 250, 230), rgb(120, 200, 180), rgb(80, 160, 140)); }
[data-tool="beautify"] .tp-seg[data-param="preset"] .tp-option[data-value="aurora"]::before { background: linear-gradient(135deg, rgb(26, 18, 72), rgb(66, 42, 152), rgb(0, 206, 255)); }
[data-tool="beautify"] .tp-seg[data-param="preset"] .tp-option[data-value="spotlight"]::before { background: radial-gradient(circle at 50% 35%, rgb(200, 225, 255), rgb(8, 8, 14)); }
[data-tool="beautify"] .tp-seg[data-param="preset"] .tp-option[data-value="grid"]::before { background: repeating-linear-gradient(0deg, transparent 0 5px, rgba(28,24,19,0.14) 5px 6px), repeating-linear-gradient(90deg, transparent 0 5px, rgba(28,24,19,0.14) 5px 6px), rgb(247, 244, 238); background-size: auto, auto, auto; }
[data-tool="beautify"] .tp-seg[data-param="preset"] .tp-option[data-value="dots"]::before { background: radial-gradient(circle at 6px 6px, rgba(190,164,132,0.85) 1.6px, transparent 2px) 0 0 / 12px 12px, rgb(252, 248, 242); }
[data-tool="beautify"] .tp-seg[data-param="preset"] .tp-option[data-value="blur"]::before { background: linear-gradient(120deg, rgb(236, 232, 226) 20%, rgb(216, 210, 200) 40%, rgb(197, 189, 177) 55%, rgb(230, 225, 217) 75%, rgb(211, 206, 198)); }
[data-tool="beautify"] .tp-seg[data-param="preset"] .tp-option[data-value="frost"]::before { background: linear-gradient(180deg, rgb(244, 246, 249), rgb(223, 227, 233) 70%, rgb(205, 211, 219)); }
