/* 补齐面板依赖的 Obsidian 主题变量与按钮样式（深色变量由 .savi-circuit-dark 局部覆盖） */
:root {
    --background-primary: #ffffff;
    --background-primary-alt: #fafafa;
    --background-secondary: #f6f6f7;
    --background-secondary-alt: #eeeef0;
    --background-modifier-border: #dcdce0;
    --text-normal: #222222;
    --text-muted: #6b6f76;
    --text-faint: #9aa0a6;
    --text-warning: #c87a00;
    --interactive-normal: #f2f2f4;
    --interactive-hover: #e6e6ea;
    --interactive-accent: #3d6fe0;
    --interactive-accent-hgl: #5583ea;
    --text-on-accent: #ffffff;
}
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--background-primary); }
body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
    font-size: 14px; color: var(--text-normal);
    -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
#app { position: fixed; inset: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
#app * { box-sizing: border-box; }
#app canvas { touch-action: none; }
button {
    font: inherit; color: var(--text-normal); background: var(--interactive-normal);
    border: none; border-radius: 8px; cursor: pointer;
}
button:hover { background: var(--interactive-hover); }
button.mod-cta { background: var(--interactive-accent); color: var(--text-on-accent); border-color: var(--interactive-accent); }
/* 深色由顶栏 ☀️/🌙 统一切换（main.ts applyDark）：body.is-dark 管顶栏/抽屉/详情，面板根上的类管面板自己 */
body.is-dark, .savi-circuit-sim-root.savi-circuit-dark {
    --background-primary: #1b1b1f; --background-primary-alt: #202024;
    --background-secondary: #202024; --background-secondary-alt: #26262c;
    --background-modifier-border: #3a3a40; --text-normal: #e8eaed; --text-muted: #9aa0a6;
    --text-faint: #6b6f76; --interactive-normal: #2a2a30; --interactive-hover: #35353c;
    --interactive-accent: #5b8dfa; --interactive-accent-hgl: #6f9bfb; --text-on-accent: #ffffff;
    color: var(--text-normal);
}
#topbar {
    position: fixed; top: calc(env(safe-area-inset-top) + 8px); right: calc(env(safe-area-inset-right) + 8px);
    z-index: 10; display: flex; gap: 6px;
}
#topbar > button { padding: 6px 12px; font-size: 14px; }
#topbar .lbl, #mode-badge .mode-kind span { vertical-align: middle; }
/* 顶栏左头：电路名字（过长省略）；它右边三个标签 = 这份电路的三项 */
#mode-badge { display: flex; align-items: center; gap: 6px; max-width: 26vw; font-weight: 600; }
/* 三个标签：有内容的亮、还没有的灰；当前这一项上底色（电路图蓝、仿真绿、面包板棕），只有它带文字 */
#kind-tabs { display: flex; gap: 2px; padding: 2px; border-radius: 10px; background: var(--interactive-normal); }
#kind-tabs button { position: relative; display: flex; align-items: center; padding: 4px 10px; font-size: 14px; white-space: nowrap;
    background: transparent; color: var(--text-faint); opacity: .55; }
#kind-tabs button.has { color: var(--text-normal); opacity: 1; }
#kind-tabs button:not(.is-cur) .lbl { display: none; }
/* 当前项：白底（分段控件样式），不再分三种颜色（10-20 极简化） */
#kind-tabs button.is-cur { font-weight: 600; background: var(--background-primary); color: var(--text-normal); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
body.is-dark #kind-tabs button.is-cur { background: #4a4a4a; color: var(--text-normal); }
#kind-tabs .kind-dot { display: none; position: absolute; top: 2px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: #f08c00; }
#kind-tabs button.is-stale .kind-dot { display: block; }
/* 「xx改过了 更新 ✕」：贴在顶栏下面 */
#sync-bar, #ex-bar { position: fixed; top: calc(env(safe-area-inset-top) + 50px); right: calc(env(safe-area-inset-right) + 8px); z-index: 10;
    align-items: center; gap: 8px; padding: 5px 6px 5px 12px; border-radius: 10px; font-size: 13px; color: var(--text-muted);
    background: var(--background-primary); border: 1px solid var(--background-modifier-border); }
#sync-bar button, #ex-bar button { padding: 4px 12px; font-size: 13px; white-space: nowrap; }
#ex-bar { padding-right: 5px; max-width: calc(100vw - 16px); box-sizing: border-box; }
#sync-bar .sync-no { padding: 4px 5px; background: none; color: inherit; line-height: 1; }
body:has(.savi-circuit-symbol-editor) #sync-bar, body:has(.savi-circuit-symbol-editor) #ex-bar { display: none !important; }
/* 单独占一行、和名字左对齐：三个小按钮位置固定，够大好点 */
.drawer-kinds { display: flex; gap: 6px; margin-top: 5px; }
.drawer-kinds span { display: flex; align-items: center; justify-content: center; width: 38px; height: 28px; border-radius: 7px; cursor: pointer; color: var(--text-faint); background: rgba(128,128,128,.09); }
.drawer-kinds span > svg { opacity: .55; }
.drawer-kinds span:hover { background: rgba(128,128,128,.2); }
.drawer-kinds span.is-on { color: var(--text-muted); }
.drawer-kinds span.is-on > svg { opacity: .9; }
.drawer-kinds svg { display: block; }
#mode-badge .mode-kind { white-space: nowrap; }
#mode-badge .mode-name { font-weight: 400; color: var(--text-normal); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
/* 符号编辑器盖满面板时收起右上角按钮（#app 是 fixed 层，编辑器 z-index 压不过 #topbar），免得挡住名称/保存 */
body:has(.savi-circuit-symbol-editor) #topbar, body:has(.savi-circuit-symbol-editor) #gif-menu { display: none !important; }
#gif-menu {
    position: fixed; top: calc(env(safe-area-inset-top) + 46px); right: calc(env(safe-area-inset-right) + 8px);
    z-index: 20; display: none; flex-direction: column; gap: 4px; padding: 8px; min-width: 110px;
    background: var(--background-primary); border: 1px solid var(--background-modifier-border);
    border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.15);
}
#gif-menu.is-open { display: flex; }
/* 顶栏 📝：写了简介的亮起 */
/* 10-20：详情按钮不再因写了简介变蓝 */
/* 电路详情窗口：盖在抽屉上面（抽屉 50），手机上铺满全屏 */
#detail { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.35); display: none; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; }
#detail.is-open { display: flex; }
#linkimp { position: fixed; inset: 0; z-index: 61; background: rgba(0,0,0,.35); display: none; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; }
#linkimp.is-open { display: flex; }
#linkimp-box { width: min(480px, 100%); background: var(--background-primary); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.25); overflow: hidden; }
.linkimp-head { display: flex; align-items: center; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--background-modifier-border); }
.linkimp-head b { flex: 1; font-size: 16px; }
.linkimp-head button { padding: 6px 12px; }
.linkimp-body { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px 16px; }
#linkimp-text { width: 100%; box-sizing: border-box; font-size: 14px; resize: vertical; word-break: break-all; }
#linkimp-ok { align-self: flex-end; padding: 6px 18px; }
/* 反馈问题（10-24）：跟「从链接导入」同一种窗口 */
#fb { position: fixed; inset: 0; z-index: 62; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; }
#fb-box { width: min(480px, 100%); max-height: 100%; overflow-y: auto; background: var(--background-primary); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
#fb-text { width: 100%; box-sizing: border-box; font-size: 15px; resize: vertical; }
#fb-contact { width: 100%; box-sizing: border-box; font-size: 14px; }
.fb-check { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.fb-note { font-size: 12px; color: var(--text-muted); }
.fb-note a { color: inherit; }
.fb-foot { display: flex; align-items: center; gap: 10px; }
.fb-foot .fb-note { flex: 1; }
#fb-send { padding: 6px 18px; }
/* 装到桌面（11-03）：跟反馈同一种窗口 */
#inst { position: fixed; inset: 0; z-index: 62; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; }
#inst-box { width: min(440px, 100%); max-height: 100%; overflow-y: auto; background: var(--background-primary); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.inst-steps { margin: 0; padding-left: 22px; font-size: 15px; line-height: 1.6; }
.inst-steps li + li { margin-top: 6px; }
/* 微信/QQ 里打开的提示：顶栏下面整条，盖过范例提示条，✕ 关掉 */
#inapp-bar { position: fixed; top: calc(env(safe-area-inset-top) + 52px); left: calc(env(safe-area-inset-left) + 8px); right: calc(env(safe-area-inset-right) + 8px);
    z-index: 11; display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 10px; font-size: 13px; line-height: 1.5;
    color: var(--text-normal); background: var(--background-primary); border: 1px solid var(--background-modifier-border); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
#inapp-bar span { flex: 1; }
#inapp-bar button { flex: 0 0 auto; padding: 4px 6px; background: none; box-shadow: none; line-height: 0; }
#detail-box { width: min(560px, 100%); max-height: 100%; display: flex; flex-direction: column; overflow: hidden;
    background: var(--background-primary); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
/* 不要标题行（10-20 用户：详情再简洁点），× 浮在预览图右上角 */
#detail-box { position: relative; }
#detail-head { position: absolute; z-index: 2; top: calc(env(safe-area-inset-top) + 18px); right: calc(env(safe-area-inset-right) + 22px); }
#detail-head button { width: 30px; height: 30px; padding: 0; display: flex; align-items: center; justify-content: center; border-radius: 50%;
    background: rgba(128,128,128,.18); color: var(--text-muted); }
#detail-head button:hover { background: rgba(128,128,128,.3); }
#detail-body { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.detail-pic { flex: 0 0 auto; height: min(220px, 26vh); display: flex; align-items: center; justify-content: center; overflow: hidden;
    background: #fff; border: 1px solid var(--background-modifier-border); border-radius: 8px; color: var(--text-faint); }
.detail-pic img { max-width: 100%; max-height: 100%; }
.detail-pic.is-empty { height: 56px; font-size: 13px; }
/* 深色模式：预览图别一块大白（10-20 用户）。底换深色，白底黑线的图反相成深底浅线，彩色大致保持色相 */
body.is-dark .detail-pic, body.is-dark .drawer-thumb { background: #1e1e1e; }
body.is-dark .detail-pic img.is-light, body.is-dark .drawer-thumb img.is-light { filter: invert(.88) hue-rotate(180deg); }
.detail-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--text-muted); }
/* 详情里的电路图/仿真/面包板只是灰字说明，不上底色不上彩色（10-20 用户：详情的焦点是简介，别的别抢眼） */
.detail-kind { display: inline-flex; align-items: center; gap: 2px; color: var(--text-muted); }
.detail-star { margin-left: auto; padding: 4px 10px; }
.detail-star.is-on { color: #f5a623; border-color: #f5a623; }
.detail-label { display: flex; font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.detail-count { align-self: flex-end; font-size: 12px; color: var(--text-faint); margin-top: -4px; }
.detail-hint { font-size: 12px; color: var(--text-faint); margin-top: 4px; }
.drawer-desc strong { color: var(--text-normal); font-weight: 600; }
.detail-name, .detail-desc {
    width: 100%; box-sizing: border-box; font: inherit; font-size: 16px; line-height: 1.5; padding: 7px 10px;
    border: 1px solid var(--background-modifier-border); border-radius: 6px;
    background: var(--background-primary); color: var(--text-normal); -webkit-user-select: text; user-select: text;
}
.detail-name:focus, .detail-desc:focus { outline: none; border-color: var(--interactive-accent); }
.detail-desc { flex: 0 0 auto; resize: vertical; }
/* 标签（10-31）：没选的只是灰字小块，选中的淡蓝底，跟顶栏选中的分区一个样；列表里只是一行灰字，点了拿它搜 */
.detail-tags { display: flex; flex-direction: column; gap: 4px; }
.detail-tags:has(> .detail-tag) { flex-direction: row; flex-wrap: wrap; gap: 6px; }
.detail-tags-title { font-size: 12px; color: var(--text-faint); margin-top: 4px; }
.detail-tags-row { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-tag { padding: 3px 9px; font-size: 13px; border-radius: 12px; border: none; box-shadow: none; background: var(--background-modifier-hover, rgba(0,0,0,.05)); color: var(--text-muted); }
.detail-tag.is-on { background: rgba(61,111,224,.14); color: var(--interactive-accent); }
span.detail-tag { display: inline-block; }
.detail-tag:disabled { opacity: .4; }
/* 抽屉搜索框下面的标签筛选：一行，左右滑 */
#drawer-tagbar { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; flex-shrink: 0; }
#drawer-tagbar::-webkit-scrollbar { display: none; }
#drawer-tagbar .detail-tag { flex-shrink: 0; white-space: nowrap; cursor: pointer; }
.drawer-tagbar-n { margin-left: 4px; font-size: 11px; color: var(--text-faint); }
.drawer-tags { font-size: 12px; color: var(--text-faint); margin-top: 2px; display: flex; flex-wrap: wrap; gap: 0 8px; }
.drawer-tags span { cursor: pointer; }
.drawer-tags span:hover { color: var(--interactive-accent); }
.detail-extitle { font-size: 18px; font-weight: 600; margin-top: 2px; }
.detail-extext { font-size: 15px; line-height: 1.65; white-space: pre-line; -webkit-user-select: text; user-select: text; }
.detail-extext strong { font-weight: 600; }
.detail-extext.is-empty { color: var(--text-faint); }
.detail-revert { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--text-muted); padding: 7px 10px; border-radius: 6px; background: rgba(240,160,0,.12); }
.detail-revert span { flex: 1 1 auto; }
.detail-revert button { flex: 0 0 auto; padding: 5px 10px; font-size: 14px; white-space: nowrap; }
/* 操作按钮钉在窗口底部：屏幕矮（iPad 横屏）时内容滚动，按钮始终看得见 */
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; position: sticky; bottom: 0; z-index: 1; padding: 10px 0 16px; background: var(--background-primary); }
.detail-actions button { flex: 1 1 auto; padding: 8px 10px; font-size: 15px; white-space: nowrap; }
.detail-actions button.mod-cta { flex: 2 1 auto; background: var(--interactive-normal); color: var(--text-normal); border-color: transparent; }   /* 继续编辑/打开也灰色，详情里只突出简介（10-20 用户定） */
.detail-actions button.mod-cta:hover { background: var(--interactive-hover); }
.detail-actions button.detail-del { color: var(--text-muted); }   /* 平时灰的，点一下要确认时才变红 */
.detail-actions button.is-confirm { background: #d93025; color: #fff; border-color: #d93025; }
body:has(.savi-circuit-symbol-editor) #detail { display: none !important; }
#gif-menu .gif-menu-title { font-size: 12px; color: var(--text-muted); padding: 0 4px 2px; }
#gif-menu button { padding: 6px 12px; font-size: 14px; }
/* 从顶栏下面开始，开着抽屉也看得到、点得到顶栏的三个标签 */
#drawer { position: fixed; inset: calc(env(safe-area-inset-top) + 48px) 0 0 0; z-index: 50; background: rgba(0,0,0,.25); display: none; }
#drawer.is-open { display: block; }
#drawer-panel {
    position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 92vw); background: var(--background-primary);
    box-shadow: -2px 0 12px rgba(0,0,0,.15); display: flex; flex-direction: column;
    padding: 10px calc(env(safe-area-inset-right) + 10px) calc(env(safe-area-inset-bottom) + 10px) 12px;
}
/* 抽屉不设标题行：顶栏「范例｜精选馆｜我的电路」亮着的就是当前这处，再点一下关上（10-19 用户定） */
#topbar > button.sect-btn.is-on { background: rgba(61,111,224,.14); color: var(--interactive-accent); }
/* 范例的编号 */
.drawer-no { margin-right: 6px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.drawer-kinds span.is-none { cursor: default; background: none; }
.drawer-kinds span.is-none:hover { background: none; }
.drawer-kinds span.is-none > svg { opacity: .28; }
/* 分组行：一行横滑，选中的分组再点一下弹改名/删除 */
#drawer-tabs { display: flex; gap: 6px; padding: 8px 0 4px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
#drawer-tabs::-webkit-scrollbar { display: none; }
/* 列表里的分组行（像 Notability）：▸ 原地展开/折叠，组里的电路缩进；▸+图标合起来和缩略图一样宽，名字对齐 */
.drawer-row.drawer-folder { padding: 6px 2px; gap: 4px; cursor: pointer; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.drawer-row button.drawer-folder-tw { flex: 0 0 20px; padding: 4px 0; border: none; box-shadow: none; background: none; color: var(--text-faint); line-height: 1; }
.drawer-folder-tw svg { transition: transform .15s; }
.drawer-folder.is-open .drawer-folder-tw svg { transform: rotate(90deg); }
.drawer-folder-ic { flex: 0 0 30px; height: 36px; display: flex; align-items: center; justify-content: center; color: var(--interactive-accent); margin-right: 4px; }
.drawer-folder.is-trash .drawer-folder-ic { color: var(--text-muted); }
.drawer-row.drawer-folder .drawer-main { padding: 0; }
.drawer-row.drawer-folder.is-edit .drawer-chip-input { flex: 1; margin-left: 58px; }
.drawer-row.drawer-folder .drawer-chip-input { flex: 1; }
/* 文件夹里的行不缩进（10-19 用户：缩进后缩略图/文字跟外面错开不整齐），左边一条细线表示属于上面的文件夹 */
.drawer-row.is-child, .drawer-trash-head.is-child { box-shadow: inset 3px 0 0 var(--background-modifier-border); }
.drawer-empty.is-child { padding: 6px 2px 6px 58px; text-align: left; font-size: 13px; }
.drawer-folder.is-dragging { position: relative; z-index: 5; background: var(--background-primary); box-shadow: 0 4px 14px rgba(0,0,0,.18); border-radius: 8px; opacity: .95; }
.drawer-folder.drop-before { box-shadow: inset 0 2px 0 var(--interactive-accent); }
.drawer-folder.drop-after { box-shadow: inset 0 -2px 0 var(--interactive-accent); }
#drawer-tools #drawer-newfolder { position: relative; }
.drawer-newfolder-plus { position: absolute; right: 3px; bottom: 1px; font-size: 12px; font-weight: 700; line-height: 1; }
.drawer-chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; padding: 5px 11px; font-size: 14px; white-space: nowrap; border-radius: 16px; border: none; box-shadow: none; background: var(--interactive-normal); color: var(--text-normal); }
.drawer-chip.is-on { background: var(--interactive-accent); color: #fff; }
.drawer-chip-n { font-size: 12px; opacity: .6; font-variant-numeric: tabular-nums; }
.drawer-chip-add { color: var(--text-muted); padding: 5px 9px; }
.drawer-chip-input { flex: 0 0 120px; padding: 4px 10px; font: inherit; font-size: 14px; border-radius: 16px; border: 1.5px solid var(--interactive-accent); background: var(--background-primary); color: var(--text-normal); outline: none; }
#drawer-tools { display: flex; gap: 6px; align-items: center; margin: 4px 0; }
#drawer-tools #drawer-search { flex: 1; min-width: 0; margin: 0; }
#drawer-tools button { flex: 0 0 auto; padding: 6px 8px; border: none; box-shadow: none; background: var(--interactive-normal); color: var(--text-muted); line-height: 1; }
#drawer-tools #drawer-new { color: var(--text-on-accent, #fff); background: var(--interactive-accent); white-space: nowrap; padding: 6px 10px; }
#drawer-tools button.is-on { color: var(--interactive-accent); background: rgba(61,111,224,.14); }
#drawer-select { font-size: 14px; }
#drawer-selhead { display: flex; align-items: center; gap: 8px; margin: 4px 0; padding: 3px 0; font-size: 14px; }
#drawer-selhead span { flex: 1; color: var(--text-muted); }
#drawer-selhead button { padding: 5px 12px; }
#drawer-selbar { display: flex; gap: 8px; padding-top: 8px; }
#drawer-selbar button { flex: 1; padding: 7px 4px; font-size: 14px; white-space: nowrap; }
#drawer-selbar button:disabled { opacity: .4; }
/* 最底下一行：说明/备份提醒（灰字）+ 右边不起眼的「最近删除」小链接（10-19 用户：回收站和备份提醒都别抢注意力） */
#drawer-foot-line { display: flex; align-items: center; gap: 8px; min-height: 22px; }
#drawer-foot-line .drawer-note { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#drawer-trash-link { flex: 0 0 auto; margin-left: auto; display: inline-flex; align-items: center; gap: 3px; padding: 2px 0; border: none; box-shadow: none; background: none; color: var(--text-faint); font-size: 12px; }
#drawer-trash-link svg { opacity: .8; }
/* 紧凑行（默认）：小缩略图 + 名字 / 时间·有哪几项 */
.drawer-row.is-compact { padding: 6px 2px; gap: 8px; }
.drawer-row.is-compact .drawer-thumb { flex-basis: 50px; height: 36px; }
.drawer-row.is-compact .drawer-thumb .drawer-kind { display: none; }
.drawer-row.is-compact .drawer-thumb:not(.has-img) .drawer-kind { display: block; font-size: 16px; }
.drawer-row.is-compact .drawer-main { padding: 0; }
.drawer-name-star { color: #f5a623; margin-right: 3px; }
.drawer-name-star svg { vertical-align: -1px; }
.drawer-sub { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; }
.drawer-sub-folder { padding: 0 6px; border-radius: 8px; background: var(--interactive-normal); overflow: hidden; text-overflow: ellipsis; }
.drawer-sub-kind { display: inline-flex; color: var(--text-muted); }
.drawer-row button.drawer-info { padding: 6px; border: none; box-shadow: none; background: none; color: var(--text-muted); line-height: 1; }
.drawer-row button.drawer-check { padding: 4px 2px; border: none; box-shadow: none; background: none; color: var(--text-faint); line-height: 1; }
.drawer-row.is-sel { background: rgba(61,111,224,.09); }
.drawer-row.is-sel button.drawer-check { color: var(--interactive-accent); }
.drawer-main.is-static { cursor: default; }
.drawer-trash-head { display: flex; align-items: center; gap: 8px; padding: 6px 2px 8px; font-size: 13px; color: var(--text-muted); border-bottom: 1px solid var(--background-modifier-border); }
.drawer-trash-head span { flex: 1; }
/* 小弹出菜单 */
#drawer-pop { position: fixed; z-index: 120; display: none; min-width: 160px; max-width: 260px; padding: 5px; border-radius: 12px; background: var(--background-primary); border: 1px solid var(--background-modifier-border); box-shadow: 0 8px 28px rgba(0,0,0,.18); }
#drawer-pop.is-open { display: block; }
#drawer-pop .pop-title { padding: 6px 10px 2px; font-size: 12px; color: var(--text-faint); }
#drawer-pop .pop-item { display: flex; align-items: center; gap: 6px; width: 100%; padding: 7px 10px; border: none; box-shadow: none; background: none; color: var(--text-normal); font-size: 14px; text-align: left; border-radius: 8px; }
#drawer-pop .pop-item:hover { background: var(--interactive-normal); }
#drawer-pop .pop-item.is-on { color: var(--interactive-accent); }
#drawer-pop .pop-item:disabled { opacity: .38; background: none; }
#drawer-pop .pop-tick { display: inline-flex; width: 16px; }
#drawer-pop .pop-sep { height: 1px; margin: 4px 6px; background: var(--background-modifier-border); }
#drawer-pop .pop-danger { color: #d93025; }
#drawer-pop .drawer-chip-input { width: 100%; box-sizing: border-box; margin: 4px 0 2px; }
.detail-folder { width: 100%; padding: 6px 8px; font: inherit; font-size: 15px; border-radius: 6px; border: 1px solid var(--background-modifier-border); background: var(--background-primary); color: var(--text-normal); }
.drawer-merge { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; padding: 8px 10px; border-radius: 10px; background: rgba(194, 106, 0, .1); color: #c26a00; font-size: 13px; line-height: 1.4; }
.drawer-merge span { flex: 1; }
.drawer-merge button { flex: none; }
.drawer-filterbar { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; padding: 6px 10px; border-radius: 10px; background: rgba(61,111,224,.1); color: var(--interactive-accent); font-size: 13px; }
.drawer-filterbar span { flex: 1; }
.drawer-filterbar button { flex: none; }
.drawer-empty { padding: 24px 8px; text-align: center; color: var(--text-muted); font-size: 14px; }
#drawer-list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.drawer-row { display: flex; align-items: center; gap: 6px; padding: 8px 4px; border-bottom: 1px solid var(--background-modifier-border); }
.drawer-row.is-active { background: var(--background-secondary); }
.drawer-row button { padding: 6px 9px; flex: 0 0 auto; }
.drawer-row button.drawer-star { padding: 6px 4px; border: none; background: none; box-shadow: none; font-size: 20px; line-height: 1; color: var(--text-faint); }
.drawer-row button.drawer-star.is-on { color: #f5a623; }
.drawer-main { flex: 1; min-width: 0; cursor: pointer; padding: 2px 4px; }
.drawer-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.drawer-row.is-active .drawer-name { color: var(--interactive-accent); font-weight: 600; }
.drawer-time { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.drawer-desc { font-size: 13px; line-height: 1.35; color: var(--text-muted); margin-top: 2px; white-space: pre-line;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
/* 会员页（苹果 App 里才弹，features.ts） */
.paywall { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.35); display: none; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; }
.paywall.is-open { display: flex; }
.paywall-box { width: min(440px, 100%); max-height: 100%; display: flex; flex-direction: column; overflow: hidden;
    background: var(--background-primary); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.paywall-head { display: flex; align-items: center; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--background-modifier-border); }
.paywall-head b { flex: 1; font-size: 16px; }
.paywall-head button { padding: 6px 12px; }
.paywall-body { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.paywall-lead { font-size: 17px; font-weight: 600; }
.paywall-list { margin: 0; padding-left: 20px; line-height: 1.7; font-size: 14px; }
.paywall-note { font-size: 13px; color: var(--text-muted); }
.paywall-err { font-size: 13px; color: var(--text-error, #d33); }
.paywall-btns { display: flex; gap: 10px; margin-top: 4px; }
.paywall-plan { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px; height: auto; border-radius: 10px; }
.paywall-plan-name { font-size: 15px; font-weight: 600; }
.paywall-plan-price { font-size: 13px; opacity: .85; }
.paywall-plan:disabled { opacity: .55; }
.paywall-fine { font-size: 11px; line-height: 1.5; color: var(--text-faint); }
.paywall-links { display: flex; gap: 16px; align-items: center; justify-content: center; font-size: 13px; }
.paywall-links a { color: var(--text-muted); }
.paywall-link-btn { background: none; box-shadow: none; padding: 4px 0; color: var(--interactive-accent); font-size: 13px; }
#drawer-foot { font-size: 12px; color: var(--text-faint); padding-top: 8px; }
#drawer-backup { display: flex; gap: 8px; margin-bottom: 6px; }
#drawer-backup button { flex: 1; padding: 6px 8px; font-size: 14px; }
#notice-box {
    position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 70px); transform: translateX(-50%);
    z-index: 100; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none;
}
.notice { background: rgba(30,30,34,.92); color: #fff; padding: 8px 14px; border-radius: 8px; max-width: 90vw; }
/* 手机竖屏：底部工具条按钮缩小 + 横向滑动，不再右侧溢出（面板按钮是内联样式，需 !important） */
/* 画图面板的编辑浮框让到顶栏按钮下面（顶栏 fixed 在最上层会盖住它） */
.savi-circuit-float { top: 58px !important; }

/* 手机竖屏(窄) 和 手机横屏(矮) 都走紧凑布局 */
@media (max-width: 700px), (max-height: 500px) {
    .savi-circuit-bottombar {
        gap: 6px !important; padding: 6px 8px !important;
        overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none;
    }
    .savi-circuit-bottombar::-webkit-scrollbar { display: none; }
    .savi-circuit-bottombar > button { flex: 0 0 auto; padding: 6px 10px !important; font-size: 16px !important; }
    .savi-circuit-bottombar > span { min-width: 0 !important; }
    /* 元件栏（40个）竖屏会折成7行占半屏：改成3行网格、横向滑动，分隔线在网格里会占格，隐藏 */
    .savi-circuit-palette {
        display: grid !important; grid-auto-flow: column; grid-template-rows: repeat(3, auto);
        overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none;
        gap: 5px !important; padding: 5px 8px !important; justify-content: start;
    }
    .savi-circuit-palette::-webkit-scrollbar { display: none; }
    .savi-circuit-palette > div { display: none; }
    .savi-circuit-palette button { padding: 5px 8px !important; white-space: nowrap; }
    .savi-circuit-palette-sep { display: none; }
    /* 11-10 第一屏太密：元件栏默认收起，底栏「＋元件」展开（看范例用不到元件）；拿到元件自动收回 */
    body:not(.savi-pal-open) .savi-circuit-palette { display: none !important; }
    .savi-pal-toggle:not(.savi-pal-hidden) { display: inline-flex !important; align-items: center; gap: 3px; white-space: nowrap; }
    body.savi-pal-open .savi-pal-toggle { background-color: color-mix(in srgb, var(--text-normal) 16%, transparent); }
    /* 仿真底栏一行放下：框选/适合窗口/还原/执行日志收进「⋯」 */
    .savi-circuit-bottombar:not(.savi-more-open) .savi-mob-fold { display: none !important; }
    .savi-circuit-bottombar .savi-mob-fold { order: 1; }   /* 展开时排到「⋯」后面，「⋯」留在原位好再点收起 */
    /* 警告挪到画布左上角浮动显示（顶栏按钮下方，顶栏现有5个按钮，并排放会被盖住），否则会被挤到滑动条最末端看不见 */
    .savi-circuit-bottombar > div {
        position: fixed; top: calc(env(safe-area-inset-top) + 58px); left: calc(env(safe-area-inset-left) + 8px);
        right: calc(env(safe-area-inset-right) + 8px); z-index: 10; margin: 0 !important; max-width: none !important;
        white-space: normal !important; font-size: 12px !important; padding: 5px 8px; border-radius: 6px;
        background: var(--background-primary); box-shadow: 0 1px 4px rgba(0,0,0,.12); pointer-events: none;
    }
    .savi-circuit-bottombar > div:empty { display: none; }
    /* 开着范例：顶栏下面多一条提示，警告浮框再往下让 */
    body.has-ex .savi-circuit-bottombar > div { top: calc(env(safe-area-inset-top) + 100px); }
    body.has-ex .savi-circuit-env { top: 146px !important; }
    /* 环境量滑块让到警告条下面（警告条固定浮在左上） */
    .savi-circuit-env { top: 104px !important; left: 8px !important; font-size: 12px !important; }
    /* 顶部按钮只留图标，少压示波器 */
    #topbar .lbl { display: none; }
    #mode-badge { display: none !important; }
    #topbar > button { padding: 6px 10px; font-size: 16px; }
    /* 顶栏靠右对齐，按钮多时会从左边溢出、点不到：限定在屏内，放不下就横滑（靠右用首项 auto 边距，溢出不会跑到左边看不见的地方） */
    #topbar { left: calc(env(safe-area-inset-left) + 8px); overflow-x: auto; scrollbar-width: none; }
    #topbar::-webkit-scrollbar { display: none; }
    #topbar > #kind-tabs { margin-left: auto; }   /* 前面的 sb-btn、mode-badge 窄屏都隐藏，第一个可见的是它 */
    #topbar > * { flex: 0 0 auto; }
    /* 详情窗口铺满全屏 */
    #detail { padding: 0; }
    #detail-box { width: 100%; height: 100%; border-radius: 0; box-sizing: border-box;
        padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
    .detail-pic { height: min(150px, 26vh); }
}
/* 手机横屏：高度只有~390，元件栏压成2行、按钮再紧一点，给画布留空间 */
@media (max-height: 500px) {
    .savi-circuit-palette { grid-template-rows: repeat(2, auto); padding: 3px 8px !important; gap: 4px !important; }
    .savi-circuit-palette button { padding: 3px 7px !important; }
    .savi-circuit-bottombar { padding: 4px 8px !important; }
    .savi-circuit-bottombar > button { padding: 4px 10px !important; }
    .savi-circuit-bottombar > div { top: calc(env(safe-area-inset-top) + 8px); right: auto; max-width: 45vw !important; }
    body.has-ex .savi-circuit-bottombar > div { top: calc(env(safe-area-inset-top) + 8px); }   /* 横屏警告在左上角，碰不到右边的范例提示条 */
    /* 抽屉：列表只剩一行半，压缩头部/行高，隐藏底部说明文字 */
    #drawer-tabs { padding: 4px 0 2px; }
    #drawer-search { margin: 2px 0; padding: 4px 10px; }
    #drawer .drawer-row { padding: 4px; }
    #drawer .drawer-thumb { flex-basis: 66px; height: 44px; }
    #drawer-foot { padding-top: 4px; }
    #drawer-backup { margin-bottom: 0; }
    #drawer-backup button { padding: 4px 8px; }
    .drawer-note { display: none; }
    /* 横屏顶栏只占右上角，居中的编辑浮框不会被盖住，放回最上面少挡电路 */
    .savi-circuit-float { top: 54px !important; }
}

/* 电路图文档：没有电流动画（GIF） */
body.is-draw #gif-btn, body.is-board #gif-btn { display: none; }
#gif-btn { white-space: nowrap; }
#gif-btn .lbl { vertical-align: middle; }
.drawer-kind { flex: 0 0 auto; font-size: 16px; }
.drawer-thumb { position: relative; flex: 0 0 88px; height: 60px; display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: pointer;
    background: #fff; border: 1px solid var(--background-modifier-border); border-radius: 6px; }
.drawer-thumb img { max-width: 100%; max-height: 100%; }
.drawer-thumb .drawer-kind { font-size: 20px; }
.drawer-thumb.has-img .drawer-kind { position: absolute; left: 2px; bottom: 1px; font-size: 11px; line-height: 1; }
#drawer-search { width: 100%; box-sizing: border-box; margin: 4px 0; padding: 6px 10px; font: inherit; font-size: 16px; border: 1px solid var(--background-modifier-border); border-radius: 6px; background: var(--background-primary); color: var(--text-normal); }
.undo-bar { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: flex; align-items: center; gap: 12px; background: rgba(30,30,34,.94); color: #fff; padding: 8px 8px 8px 14px; border-radius: 8px; max-width: calc(100vw - 32px); box-sizing: border-box; }
.undo-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.undo-bar button { flex: 0 0 auto; padding: 5px 14px; background: #fff; color: #1a73e8; border: none; border-radius: 6px; font-weight: 600; }
/* 示波器停靠在顶部时整体下移一行，给右上角浮动顶栏（名称/生成电路图/分享…）让位，不压波形右上角刻度 */
.savi-circuit-scope { margin-top: 46px; }

/* 类型角标用图标：大小跟着字号走 */
.drawer-kind { line-height: 1; color: var(--text-muted); }
.drawer-kind svg { width: 1.15em; height: 1.15em; display: block !important; }
#detail-close { line-height: 1; }

/* 面板里的按钮（10-10 改苹果风格）：不要边框和阴影，靠一层很淡的底色区分 */
.savi-circuit-sim-root button:not(.clickable-icon),
.savi-circuit-sim-root button:not(.clickable-icon):hover,
.savi-circuit-sim-root button:not(.clickable-icon):focus,
.savi-circuit-sim-root button:not(.clickable-icon):active { border: none; box-shadow: none; }
.savi-circuit-sim-root button:not(.clickable-icon):not(.mod-cta):not(.mod-warning) { background-color: color-mix(in srgb, var(--text-normal) 7%, transparent); }
.savi-circuit-sim-root button:not(.clickable-icon):not(.mod-cta):not(.mod-warning):hover { background-color: color-mix(in srgb, var(--text-normal) 13%, transparent); }

/* 快捷盘（App 里捏 Apple Pencil 弹出，pencil-dial.ts）：毛玻璃圆钮在笔尖上方排成扇形 */
.pencil-dial { position: fixed; inset: 0; z-index: 200; touch-action: none; }
.pencil-dial-btn { position: absolute; transform: translate(-50%, -50%); border: none; border-radius: 50%; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; cursor: pointer;
  background: rgba(255,255,255,.82); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  color: #1d1d1f; box-shadow: 0 4px 18px rgba(0,0,0,.18); }
.pencil-dial-btn { width: 58px; height: 58px; animation: pencil-dial-in .16s ease-out both; }
.pencil-dial-icon { line-height: 0; }
.pencil-dial-icon svg { height: 22px; width: auto; max-width: 44px; display: block; }
.pencil-dial-label { font-size: 10px; line-height: 1.1; white-space: nowrap; max-width: 52px; overflow: hidden; text-overflow: ellipsis; }
.pencil-dial-btn.is-on { background: #34c759; color: #fff; }
.pencil-dial-btn.is-off { opacity: .35; cursor: default; }
body.is-dark .pencil-dial-btn { background: rgba(44,44,46,.85); color: #f5f5f7; }
body.is-dark .pencil-dial-btn.is-on { background: #30d158; color: #fff; }
@keyframes pencil-dial-in { from { opacity: 0; transform: translate(-50%, -50%) scale(.6); } }
.drawer-row .detail-del, #drawer-selbar .detail-del, .drawer-trash-head .detail-del { color: #d93025; }

/* 按住电路拖进分组（10-16）：拿起时组全部临时收起，被拖的那行原位留空 */
.drawer-row:not(.drawer-folder) { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.drawer-row img { -webkit-touch-callout: none; -webkit-user-drag: none; }
#drawer-list.is-drag-collapse .is-child:not(.is-drag-src), #drawer-list.is-drag-collapse .drawer-trash-head, #drawer-list.is-drag-collapse .drawer-folder.is-trash { display: none; }
#drawer-list.is-drag-collapse .drawer-folder-tw svg { transform: none; }
.drawer-row.is-drag-src { opacity: .3; }
.drawer-row.is-drag-src.is-child { position: absolute; visibility: hidden; }
.drawer-drag-ghost { position: fixed; z-index: 1000; pointer-events: none; background: var(--background-primary); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.22); opacity: .95; margin: 0 !important; }
.drawer-drop-out .drawer-folder-ic, .drawer-drop-out .drawer-name { color: var(--text-muted); }
.drawer-drop-out { border: 1.5px dashed var(--background-modifier-border); border-radius: 10px; margin-bottom: 4px; }
.drawer-folder[data-drop].is-drop { background: color-mix(in srgb, var(--interactive-accent) 16%, transparent); border-radius: 10px; }
/* 发现：一段一个小标题（范例；以后精选/社区） */
/* 顶栏电路名后的下拉箭头（点开我的电路） */
#mode-badge .mode-chev { display: inline-flex; color: var(--text-muted); flex: none; margin-left: -2px; }

/* ─── 侧边栏（10-25：苹果 App 在 Mac 和 iPad 宽屏上，「我的电路」常驻左边，main.ts applySidebar） ─── */
#sb-btn, #sb-sects, #sb-resize { display: none; }
/* 10-27：Mac/iPad 改用顶栏三个按钮开关侧边栏（浮在画布上），不要侧边栏按钮、侧边栏里的分段，电路名不再是按钮 */
body.sb-mode #mode-badge { cursor: default; }
body.sb-mode #mode-badge .mode-chev { display: none; }
body.sb-on #drawer { display: block; inset: 0 auto 0 0; width: calc(var(--sb-w, 300px) + env(safe-area-inset-left)); z-index: 15; background: none; }
body.sb-on #drawer-panel {
    inset: 0; width: auto; box-shadow: none; border-right: 1px solid var(--background-modifier-border); background: var(--background-secondary);
    padding: calc(env(safe-area-inset-top) + 10px) 10px calc(env(safe-area-inset-bottom) + 10px) calc(env(safe-area-inset-left) + 10px);
}
body.sb-on #app { left: calc(var(--sb-w, 300px) + env(safe-area-inset-left)); }
/* Mac/iPad 窄窗口：侧边栏浮在画布上，不挤画布 */
body.sb-float.sb-on #app { left: env(safe-area-inset-left); }
body.sb-float.sb-on #drawer { z-index: 40; }
body.sb-float.sb-on #drawer-panel { box-shadow: 0 8px 28px rgba(0,0,0,.28); }
body.sb-on:not(.sb-mode) #sb-sects { display: flex; gap: 2px; padding: 2px; margin-bottom: 4px; border-radius: 9px; background: var(--interactive-normal); }
#sb-sects button { flex: 1; padding: 4px 6px; font-size: 13px; white-space: nowrap; background: transparent; color: var(--text-muted); }
#sb-sects button.is-on { font-weight: 600; background: var(--background-primary); color: var(--text-normal); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
body.is-dark #sb-sects button.is-on { background: #4a4a4a; }
body.sb-on #sb-resize { display: block; position: absolute; top: 0; bottom: 0; right: -4px; width: 8px; cursor: col-resize; touch-action: none; z-index: 2; }
/* 侧边栏窄：工具行里搜索框单独占一行 */
body.sb-on #drawer-tools { flex-wrap: wrap; }
body.sb-on #drawer-tools #drawer-search { order: 10; flex: 1 0 100%; }
body.sb-on #drawer-tools #drawer-sort { margin-left: auto; }   /* 排序/筛选靠右，像访达 */
body.sb-on #drawer-tools #drawer-fold.is-shown { margin-left: auto; }   /* 展开/折叠跟 ⇅ 一起靠右 */
body.sb-on #drawer-tools #drawer-fold.is-shown + #drawer-sort { margin-left: 0; }
/* 符号编辑器盖满画面时侧边栏也让开 */
body:has(.savi-circuit-symbol-editor) #drawer { display: none !important; }
body.sb-on:has(.savi-circuit-symbol-editor) #app { left: env(safe-area-inset-left); }
/* Mac 版：设置在菜单栏（⌘,），顶栏不放 ⚙ */
body.is-mac #set-btn { display: none; }
body.sb-on #drawer-backup { flex-wrap: wrap; }
body.sb-on #drawer-backup button { flex: 1 1 auto; white-space: nowrap; padding: 6px 8px; font-size: 13px; }

/* Mac 版：菜单栏/快捷键里有的按钮，界面上藏掉（10-25 用户定）。iPad、网页版不受影响 */
body.is-mac .savi-mac-hide,
body.is-mac #drawer-backup,
body.is-mac #desc-btn { display: none !important; }

/* 拖文件进窗口时的提示 */
.drop-hint { position: fixed; inset: 10px; z-index: 9999; pointer-events: none; display: flex; align-items: center; justify-content: center;
  border: 2px dashed rgba(52,199,89,.8); border-radius: 14px; background: rgba(52,199,89,.08); font-size: 18px; color: rgba(30,30,34,.85); }
.drop-hint span { background: #fff; padding: 10px 20px; border-radius: 10px; box-shadow: 0 2px 12px rgba(0,0,0,.15); }
body.is-dark .drop-hint { color: rgba(255,255,255,.85); }
body.is-dark .drop-hint span { background: #2c2c2e; }

/* 手写批注（ink.ts）：盖在画布上的透明层；手写时接住点按（画布锁住），平时只显示笔迹不挡操作 */
.ink-layer { position: fixed; z-index: 5; display: none; pointer-events: none; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.ink-layer canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
body.ink-on .ink-layer { pointer-events: auto; cursor: crosshair; }
.ink-bar { position: fixed; left: 50%; top: 70px; z-index: 30; touch-action: none; user-select: none; -webkit-user-select: none; width: max-content; white-space: nowrap;
    display: none; align-items: center; gap: 2px; padding: 5px; border-radius: 14px; max-width: calc(100vw - 32px); box-sizing: border-box;
    background: var(--background-primary); box-shadow: 0 6px 24px rgba(0,0,0,.2); border: 1px solid var(--background-modifier-border); }
.ink-bar.is-shown { display: flex; }
.ink-bar button { background: none; padding: 7px; border-radius: 9px; line-height: 1; color: var(--text-normal); }
.ink-bar button.is-on { background: rgba(61,111,224,.14); color: var(--interactive-accent); }
.ink-bar button.is-off { opacity: .35; cursor: default; }
.ink-bar .ink-swatch { padding: 6px; }
.ink-bar .ink-dot { width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.ink-bar .ink-swatch.is-on .ink-dot { box-shadow: 0 0 0 2px var(--background-primary), 0 0 0 4px var(--interactive-accent); }
.ink-bar .ink-swatch.is-on { background: none; }
.ink-bar .ink-sep { width: 1px; height: 22px; background: var(--background-modifier-border); margin: 0 4px; }
.ink-bar .ink-grip { width: 14px; height: 26px; margin: 0 2px 0 1px; cursor: grab; border-radius: 4px; opacity: .45;
    background: radial-gradient(circle, var(--text-muted) 1.3px, transparent 1.6px) 0 0 / 7px 7px; background-position: 0 2px; }
.ink-bar.is-dragging { cursor: grabbing; box-shadow: 0 10px 32px rgba(0,0,0,.28); }
.ink-bar.is-dragging .ink-grip { cursor: grabbing; opacity: .8; }
.ink-bar .ink-done { color: var(--interactive-accent); }
#topbar > #ink-btn.is-on { background: rgba(61,111,224,.14); color: var(--interactive-accent); }
#topbar > #ink-btn.is-dim { opacity: .5; }
/* 安卓/iPhone 竖屏（360~414 宽）：顶栏 9 个图标原宽 386，收紧到屏内 */
@media (max-width: 420px) {
    #topbar { gap: 3px; }
    #topbar > button, #kind-tabs > button { padding: 6px 7px !important; }
    #kind-tabs { gap: 0; }
}
@media (max-width: 420px) { .ink-bar button { padding: 6px 5px; } .ink-bar .ink-sep { margin: 0 2px; } }
/* 手机窄屏：工具条按钮收紧，把手不被挤掉（10-26） */
.ink-bar .ink-grip { flex-shrink: 0; }
@media (max-width: 480px) { .ink-bar { gap: 0; } .ink-bar button { padding: 5px 4px; } .ink-bar .ink-swatch { padding: 4px 3px; } .ink-bar .ink-sep { margin: 0 2px; } }

/* 我的电路：手指左划露出删除（10-26） */
.drawer-row.can-swipe { touch-action: pan-y; }
.drawer-row.is-swiping { position: relative; overflow: hidden; }
.drawer-row.is-swiping > *:not(.drawer-swipe-del) { transform: translateX(var(--swipe, 0px)); }
.drawer-row.is-swiping > .drawer-swipe-del { position: absolute; top: 0; bottom: 0; right: 0; width: 84px; margin: 0; border: none; border-radius: 0; box-shadow: none; background: #e5484d; color: #fff; font-weight: 600; transform: translateX(calc(84px + var(--swipe, 0px))); }
.drawer-row.is-swipe-anim > * { transition: transform .2s ease; }
/* 网页版会员页：SAVI 账户登录（11-04） */
.paywall-form { display: flex; flex-direction: column; gap: 8px; }
.paywall-form input { width: 100%; box-sizing: border-box; padding: 8px 10px; font-size: 15px; border-radius: 8px; }
.paywall-form button { padding: 9px 12px; border-radius: 8px; }
