:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #1f2328;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --accent-contrast: #ffffff;
  --star: #f59e0b;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 6px 16px rgba(0,0,0,.09), 0 2px 5px rgba(0,0,0,.05);
  --radius: 10px;
  --ease: cubic-bezier(.2,.7,.3,1);
}
html.dark {
  --bg: #0d1117;
  --panel: #161b22;
  --border: #30363d;
  --border-strong: #484f58;
  --text: #e6edf3;
  --text-muted: #9198a1;
  --text-faint: #6e7681;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --accent-soft: #1a2332;
  --accent-contrast: #0d1117;
  --star: #fbbf24;
  --shadow: 0 1px 3px rgba(0,0,0,.4);
  --shadow-md: 0 6px 16px rgba(0,0,0,.5), 0 2px 5px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px; line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}
input, select, button { font: inherit; color: inherit; }

/* ---------- 可访问性基础设施 ---------- */
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#search:focus-visible, .card-editor-fields input:focus-visible, .card-editor-fields select:focus-visible { outline: none; }
.skip-link {
  position: absolute; top: -48px; left: 16px; z-index: 300;
  background: var(--accent); color: var(--accent-contrast);
  padding: 8px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 600; text-decoration: none;
  transition: top .15s var(--ease);
}
.skip-link:focus-visible { top: 10px; }

/* ---------- Header ---------- */
header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; background: var(--panel);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.logo { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 650; color: var(--text); text-decoration: none; }
.logo .mark {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff; font-size: 16px; font-weight: 700; line-height: 1;
}
.logo .sub { font-size: 12px; color: var(--text-muted); font-weight: 400; }
.spacer { flex: 1; }
.local-mode-actions { display: none; align-items: center; gap: 6px; }
.local-edit-active .local-mode-actions { display: flex; }
.local-mode-actions .editor-btn { height: 30px; padding: 0 9px; font-size: 12px; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel);
  color: var(--text-muted); cursor: pointer;
  display: grid; place-items: center; transition: all .15s; flex-shrink: 0;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--bg); }
.icon-btn svg { width: 18px; height: 18px; }
header .icon-btn { border: none; background: transparent; }
header .icon-btn:hover { background: var(--bg); }

/* ---------- 语言切换器 ---------- */
.lang-wrap { position: relative; flex-shrink: 0; }
.lang-btn { width: 36px; height: 36px; border-radius: 8px; border: 0; background: transparent; color: var(--text-muted); cursor: pointer; display: grid; place-items: center; transition: all .15s; font-size: 16px; }
.lang-btn:hover { color: var(--text); background: var(--bg); }
.lang-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 100;
  min-width: 160px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow); padding: 6px;
  display: none;
}
.lang-menu.show { display: block; }
.lang-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border: 0; background: transparent; color: var(--text-muted);
  font-size: 13px; cursor: pointer; border-radius: 6px; transition: all .12s; text-align: left;
}
.lang-item:hover { background: var(--bg); color: var(--text); }
.lang-item.active { color: var(--accent); background: var(--accent-soft); }
.lang-item .check { margin-left: auto; color: var(--accent); }
.lang-item:not(.active) .check { visibility: hidden; }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; background: var(--panel);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.search-wrap { flex: 1; position: relative; min-width: 0; max-width: 560px; }
.search-wrap svg.search-icon {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-faint); pointer-events: none;
}
#search {
  width: 100%; height: 38px; padding: 0 34px 0 34px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); font-size: 14px;
  outline: none; transition: border .15s, box-shadow .15s;
}
#search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#search::placeholder { color: var(--text-faint); }
.search-wrap .clear-btn {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border-radius: 50%; border: 0;
  background: var(--border); color: var(--text-muted); cursor: pointer;
  display: none; align-items: center; justify-content: center; padding: 0;
}
.search-wrap .clear-btn:hover { background: var(--border-strong); color: var(--text); }
.search-wrap .clear-btn.show { display: flex; }
.search-wrap .clear-btn svg { width: 12px; height: 12px; }
/* 「/ 聚焦搜索」快捷键提示徽标：聚焦或已有文字时隐藏 */
.search-wrap .search-hint {
  position: absolute; right: 36px; top: 50%; transform: translateY(-50%);
  font-size: 12px; line-height: 1.4; color: var(--text-faint);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 6px; background: var(--panel); pointer-events: none;
}
#search:focus ~ .search-hint,
.search-wrap .clear-btn.show ~ .search-hint { display: none; }
/* 触屏无快捷键，不显示 */
@media (hover: none) { .search-wrap .search-hint { display: none; } }

.stat { margin-left: auto; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.stat b { color: var(--text); font-weight: 600; }

/* ---------- Category tabs ---------- */
.tabs {
  display: flex; gap: 6px; overflow-x: auto;
  padding: 10px 20px; background: var(--panel);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  flex-shrink: 0; height: 32px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 16px;
  background: var(--panel); color: var(--text-muted); font-size: 13px;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.tab-btn:hover { background: var(--bg); color: var(--text); border-color: var(--border-strong); }
.tab-btn.active { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); font-weight: 600; }
.tab-btn.active:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-contrast); }
/* 横向溢出渐隐提示：JS 按滚动位置加 fade-left / fade-right */
.tabs.fade-left, .subtabs.fade-left { -webkit-mask-image: linear-gradient(to right, transparent, #000 24px); mask-image: linear-gradient(to right, transparent, #000 24px); }
.tabs.fade-right, .subtabs.fade-right { -webkit-mask-image: linear-gradient(to left, transparent, #000 24px); mask-image: linear-gradient(to left, transparent, #000 24px); }
.tabs.fade-left.fade-right, .subtabs.fade-left.fade-right { -webkit-mask-image: linear-gradient(to right, transparent, #000 24px, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(to right, transparent, #000 24px, #000 calc(100% - 24px), transparent); }

.subtabs {
  display: flex; gap: 6px; overflow-x: auto;
  padding: 8px 20px; background: var(--accent-soft);
  border-bottom: 1px solid var(--border); scrollbar-width: none;
}
.subtabs::-webkit-scrollbar { display: none; }
.subtabs[hidden] { display: none; }
.subtab-btn {
  flex-shrink: 0; height: 28px; padding: 0 11px; border: 1px solid transparent;
  border-radius: 14px; background: transparent; color: var(--text-muted); font-size: 12px;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.subtab-btn:hover { background: var(--panel); color: var(--text); border-color: var(--border); }
.subtab-btn.active { background: var(--panel); color: var(--accent); border-color: var(--accent); font-weight: 600; }

/* ---------- Sections & grid ---------- */
main { flex: 1; overflow-y: auto; padding: 0 20px 60px; }
.cat-section { max-width: 1200px; margin: 0 auto 28px; }
/* 首屏顶部间距走 margin（随滚动滚走），不能放 main 的 padding */
.cat-section:first-child { margin-top: 18px; }
.cat-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 600; color: var(--text);
  /* 间距全走 padding（在背景内）：margin 透明带会让滚动内容穿透 pin 住的标题 */
  margin: 0; position: sticky; top: 0;
  /* 必须用不透明背景：半透明 + backdrop-filter 会形成独立合成层，
     把 hover 上浮卡片(translateY(-2px))顶部的边框再盖回去，即便 z-index 更高也救不回来（Safari 尤甚）。 */
  background: var(--bg);
  padding: 8px 0 12px; z-index: 5;
}
.cat-title .count {
  font-size: 12px; color: var(--text-muted); font-weight: 400;
  background: var(--panel); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 10px;
}
.subcat-group { margin-top: 18px; }
.cat-title + .subcat-group { margin-top: 0; }
.subcat-title { display: flex; align-items: center; gap: 8px; margin: 0 0 9px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.subcat-title .count { font-size: 11px; font-weight: 400; color: var(--text-faint); }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.tool-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  min-width: 0; overflow: hidden; position: relative;
  transition: transform .18s var(--ease), border-color .18s, box-shadow .18s;
}
.tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 6px 16px rgba(37,99,235,.14), 0 2px 5px rgba(37,99,235,.08);
  /* 上浮卡片需压在吸顶标题(z-index:5)之上，否则顶部边框会被标题背景盖住 */
  z-index: 10;
}
html.dark .tool-card:hover { box-shadow: var(--shadow-md); }
/* 入场动画：fill 用 backwards，避免结束后压制 hover 位移 */
@keyframes card-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.cards-animated .tool-card { animation: card-in .35s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 30ms); }

.tool-main { min-height: 96px; padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; }
.tool-icon {
  width: 34px; height: 34px; display: grid; place-items: center; flex: none;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg);
  color: var(--accent); font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px; font-weight: 700; overflow: hidden;
}
.tool-icon img { width: 22px; height: 22px; display: block; object-fit: contain; }
/* favicon 缺失时的字母头像兜底：色相由 JS 按名称哈希写入 --avatar-hue */
.tool-icon.avatar {
  font-family: inherit;
  background: hsl(var(--avatar-hue, 210) 65% 45% / .1);
  border-color: hsl(var(--avatar-hue, 210) 65% 45% / .22);
  color: hsl(var(--avatar-hue, 210) 70% 36%);
}
html.dark .tool-icon.avatar {
  background: hsl(var(--avatar-hue, 210) 60% 60% / .14);
  border-color: hsl(var(--avatar-hue, 210) 60% 60% / .25);
  color: hsl(var(--avatar-hue, 210) 80% 72%);
}
.tool-text { min-width: 0; flex: 1; }
.tool-text h3 { margin: 0 0 3px; font-size: 15px; line-height: 1.35; display: flex; align-items: flex-start; gap: 7px; }
.tool-text h3 .tool-name {
  min-width: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden;
}
.use-count { display: none; font-size: 11px; font-weight: 400; color: var(--text-muted); background: var(--panel); border: 1px solid var(--border); padding: 1px 7px; border-radius: 9px; white-space: nowrap; flex-shrink: 0; }
.use-count.show { display: inline-block; }
.tool-text p { margin: 0; color: var(--text-muted); font-size: 13px; line-height: 1.45; }

.fav-star {
  flex-shrink: 0; width: 24px; height: 24px; padding: 3px;
  border: 0; background: transparent; cursor: pointer;
  color: var(--text-faint); opacity: 0;
  transition: opacity .12s, color .12s, transform .12s;
}
.fav-star svg { width: 100%; height: 100%; display: block; }
.tool-card:hover .fav-star, .tool-card:focus-within .fav-star, .fav-star.on { opacity: 1; }
.fav-star:hover { color: var(--star); transform: scale(1.15); }
.fav-star.on { color: var(--star); }
.fav-star.on svg { fill: currentColor; }
/* 收藏成功的小弹跳反馈 */
@keyframes star-pop { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
.fav-star.pop { animation: star-pop .3s var(--ease); }
/* 触屏无 hover：星标常显半透明，已收藏保持实色；命中区加大 */
@media (hover: none) { .fav-star { opacity: .45; width: 28px; height: 28px; } .fav-star.on { opacity: 1; } }
.card-editor-actions { display: none; gap: 2px; flex-shrink: 0; }
.local-edit-active .card-editor-actions { display: flex; }
.card-drag-handle { display: grid; place-items: center; width: 24px; height: 24px; color: var(--text-faint); cursor: grab; font-size: 17px; line-height: 1; }
.local-edit-active .tool-card { cursor: grab; }
.local-edit-active .tool-card.dragging { opacity: .5; cursor: grabbing; }
.local-edit-active .tool-card.drag-before { box-shadow: inset 0 3px var(--accent), var(--shadow); }
.local-edit-active .tool-card.drag-after { box-shadow: inset 0 -3px var(--accent), var(--shadow); }
.card-edit, .card-delete { width: 24px; height: 24px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: var(--text-faint); cursor: pointer; font: 17px/1 sans-serif; }
.card-edit:hover { color: var(--accent); background: var(--accent-soft); }
.card-delete:hover { color: #dc2626; background: #fef2f2; }

.tool-links { border-top: 1px solid var(--border); }
.tool-links a { display: block; padding: 10px; text-align: center; color: var(--accent); font-weight: 600; text-decoration: none; font-size: 13px; transition: background .12s, color .12s; }
.tool-links a:hover { background: var(--accent-soft); }

/* ---------- Empty state ---------- */
.empty-state { max-width: 420px; margin: 12vh auto; padding: 0 20px; text-align: center; color: var(--text-muted); }
.empty-state .big { font-size: 52px; margin-bottom: 14px; }
.empty-state h3 { margin: 0 0 8px; font-size: 17px; color: var(--text); }
.empty-state p { margin: 0; font-size: 13.5px; line-height: 1.7; }
.retry-btn {
  margin-top: 16px; height: 34px; padding: 0 18px; border-radius: 8px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-contrast);
  font-weight: 600; font-size: 13px; cursor: pointer; transition: background .15s;
}
.retry-btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* ---------- 加载骨架屏（静态预置于 HTML，数据就绪后被整体替换） ---------- */
.skeleton-bar {
  display: block; border-radius: 6px;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--text) 9%, transparent) 25%,
    color-mix(in srgb, var(--text) 4%, transparent) 50%,
    color-mix(in srgb, var(--text) 9%, transparent) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skeleton-heading { width: 140px; height: 20px; margin: 8px 0 12px; }
.skeleton-card {
  display: flex; gap: 14px; min-height: 96px; padding: 16px 18px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
}
.sk-icon { width: 34px; height: 34px; border-radius: 8px; flex: none; }
.sk-lines { flex: 1; display: grid; gap: 9px; align-content: start; padding-top: 5px; }
.sk-line { height: 12px; }
.sk-line.w60 { width: 60%; } .sk-line.w65 { width: 65%; } .sk-line.w70 { width: 70%; }
.sk-line.w75 { width: 75%; } .sk-line.w80 { width: 80%; } .sk-line.w85 { width: 85%; }
.sk-line.w90 { width: 90%; }

/* ---------- 页脚 ---------- */
.site-footer {
  max-width: 1200px; margin: 44px auto 0; padding: 22px 0 4px;
  border-top: 1px solid var(--border);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 14px;
  color: var(--text-faint); font-size: 12.5px;
}
.site-footer .footer-brand { font-weight: 600; color: var(--text-muted); }
.site-footer a { color: var(--text-muted); text-decoration: none; font-weight: 500; }
.site-footer a:hover { color: var(--accent); }

/* ---------- 回到顶部 ---------- */
.back-to-top {
  position: fixed; right: 24px; bottom: 24px; z-index: 150;
  width: 40px; height: 40px; border-radius: 50%; padding: 0;
  border: 1px solid var(--border); background: var(--panel); color: var(--text-muted);
  box-shadow: var(--shadow-md); cursor: pointer;
  display: grid; place-items: center;
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .2s var(--ease), transform .2s var(--ease), visibility .2s, color .15s, border-color .15s;
}
.back-to-top[hidden] { display: none; }
.back-to-top.show { opacity: 1; visibility: visible; transform: none; }
.back-to-top:hover { color: var(--accent); border-color: var(--accent); }
.back-to-top svg { width: 18px; height: 18px; }

/* ---------- 减少动态偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  .cards-animated .tool-card, .fav-star.pop, .skeleton-bar { animation: none; }
  .back-to-top, .skip-link { transition: none; }
}

/* ---------- Toast ---------- */
#toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--panel);
  padding: 9px 16px; border-radius: 8px; font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  opacity: 0; pointer-events: none; transition: all .22s;
  z-index: 200;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Local-only editor ---------- */
.local-editor { width: min(900px, calc(100vw - 32px)); height: min(760px, calc(100vh - 32px)); padding: 0; border: 1px solid var(--border); border-radius: 12px; color: var(--text); background: var(--panel); box-shadow: 0 24px 80px rgba(0,0,0,.28); }
.local-editor::backdrop { background: rgba(13,17,23,.55); }
.local-editor-head { display: flex; justify-content: space-between; gap: 16px; padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.local-editor-head h2 { margin: 0; font-size: 17px; }
.local-editor-head p { margin: 4px 0 0; color: var(--text-muted); font-size: 12px; }
.local-editor-head-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.local-editor-head-actions .editor-btn { height: 30px; padding: 0 9px; font-size: 12px; }
.local-editor-head .icon-btn { width: 30px; height: 30px; padding: 0; line-height: 1; font-size: 20px; }
#localEditorData { display: block; width: calc(100% - 40px); height: calc(100% - 170px); margin: 16px 20px 0; padding: 14px; resize: none; border: 1px solid var(--border); border-radius: 8px; outline: none; background: var(--bg); color: var(--text); font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }
#localEditorData:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.local-editor-error { height: 18px; margin: 6px 20px; color: #dc2626; font-size: 12px; }
.local-editor-actions { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; align-items: center; padding: 0 20px 18px; }
.editor-btn { height: 34px; padding: 0 12px; border: 1px solid var(--border); border-radius: 7px; cursor: pointer; font-size: 13px; }
.editor-btn.subtle { background: var(--panel); color: var(--text-muted); }
.editor-btn.subtle.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.editor-btn.primary { border-color: var(--accent); background: var(--accent); color: #fff; font-weight: 600; }
.editor-btn.danger { border-color: #fecaca; background: #fef2f2; color: #dc2626; }
.card-editor { width: min(560px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border); border-radius: 12px; color: var(--text); background: var(--panel); box-shadow: 0 24px 80px rgba(0,0,0,.28); }
.card-editor::backdrop { background: rgba(13,17,23,.55); }
.card-editor-fields { display: grid; gap: 12px; padding: 18px 20px 4px; }
.card-editor-fields label { display: grid; gap: 5px; color: var(--text-muted); font-size: 12px; }
.card-editor-fields input, .card-editor-fields select { width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 7px; outline: none; background: var(--bg); color: var(--text); }
.card-editor-fields select { appearance: none; -webkit-appearance: none; padding-right: 30px; background: var(--bg) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M3 4.5l3 3 3-3'/></svg>") no-repeat right 10px center; cursor: pointer; }
.card-editor-fields select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.card-editor-fields input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
html.dark .card-editor-fields select { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%239198a1' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M3 4.5l3 3 3-3'/></svg>"); }
.category-editor { width: min(760px, calc(100vw - 32px)); max-height: min(760px, calc(100vh - 32px)); padding: 0; border: 1px solid var(--border); border-radius: 12px; color: var(--text); background: var(--panel); box-shadow: 0 24px 80px rgba(0,0,0,.28); }
.category-editor::backdrop { background: rgba(13,17,23,.55); }
.category-editor-body { overflow-y: auto; padding: 18px 20px 4px; }
.category-editor-section + .category-editor-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.category-editor-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.category-editor-section-head h3 { margin: 0; font-size: 14px; }
.category-editor-section-head span { color: var(--text-faint); font-size: 12px; }
.category-editor-labels, .category-editor-row { display: grid; grid-template-columns: 1fr 1fr 1fr 30px; gap: 8px; align-items: center; }
.category-editor-labels { padding: 0 38px 5px 0; color: var(--text-faint); font-size: 11px; }
.category-editor-row + .category-editor-row, .subcategory-editor-row + .subcategory-editor-row { margin-top: 8px; }
.category-editor-row input, .subcategory-editor-row input, .category-add-row input, .category-parent-field select { width: 100%; height: 34px; padding: 0 9px; border: 1px solid var(--border); border-radius: 7px; outline: none; background: var(--bg); color: var(--text); font-size: 13px; }
.category-editor-row input:focus, .subcategory-editor-row input:focus, .category-add-row input:focus, .category-parent-field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.category-remove { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--text-faint); cursor: pointer; font-size: 19px; line-height: 1; }
.category-remove:hover { color: #dc2626; background: #fef2f2; }
.category-add-row { display: flex; gap: 8px; margin-top: 12px; }
.category-add-row input { flex: 1; }
.category-parent-field { display: grid; gap: 5px; color: var(--text-muted); font-size: 12px; }
.category-parent-field select { appearance: none; -webkit-appearance: none; padding-right: 30px; background: var(--bg) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M3 4.5l3 3 3-3'/></svg>") no-repeat right 10px center; cursor: pointer; }
.subcategory-editor-row { display: grid; grid-template-columns: 1fr 30px; gap: 8px; align-items: center; margin-top: 12px; }
#cardEditorDelete[hidden] { display: none; }
@media (max-width: 600px) {
  .local-editor, .category-editor { width: 100vw; max-width: none; max-height: none; border-radius: 0; }
  .local-editor-head { gap: 8px; }
  .local-editor-head-actions .editor-btn { display: none; }
  .category-editor-labels, .category-editor-row { grid-template-columns: 1fr 1fr 30px; }
  .category-editor-labels span:nth-child(3), .category-editor-row input[data-language="en"] { display: none; }
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 768px) {
  header { padding: 12px 14px; flex-wrap: wrap; }
  .local-mode-actions { order: 10; flex: 1 0 100%; justify-content: flex-end; margin-top: 2px; }
  .local-mode-actions .editor-btn { white-space: nowrap; }
  .toolbar { padding: 8px 14px; }
  .tabs, .subtabs { padding-left: 14px; padding-right: 14px; }
  main { padding: 0 14px 50px; }
  .logo .sub { display: none; }
  .tool-grid { grid-template-columns: 1fr; gap: 12px; }
  .tool-main { min-height: 86px; padding: 14px; }
  .back-to-top { right: 16px; bottom: 16px; }
  .site-footer { margin-top: 34px; }
}
