/* ============================================================================
   BoxKit — 视觉系统 v5 “现代产品站 / Product”
   零依赖、零外部请求（不引任何 webfont；图标一律内联 SVG）。

   设计语言（对标 iloveimg 这类成熟工具站，而不是杂志/海报）：
   · 底：浅灰紫 #f4f5fa，卡片纯白浮起来（靠阴影分层，不靠描边）
   · 字：无衬线。标题大而稳（42px/700），正文用柔和深灰 #5b6070，不用纯黑
   · 色：主色蓝 #2f6bff；每张卡片配一块**彩色圆角图标砖**，这是“像产品”的关键
   · 形：圆角 12–16px，阴影柔和，悬停微微抬起
   · 暗色：同一套排版，底换深蓝黑，色砖自动降饱和
   ========================================================================= */

/* ---------- 令牌：亮色（默认） ---------- */
:root {
  --bg: #f4f5fa;
  --bg-2: #eef0f8;
  --card: #ffffff;
  --card-2: #f8f9fd;
  --ink: #1f2233;          /* 标题：近黑但不死黑 */
  --ink-2: #5b6070;        /* 正文：柔和深灰 */
  --ink-3: #9298a8;        /* 辅助 */
  --line: #e8eaf3;
  --line-2: #d7dbe8;

  --brand: #2f6bff;
  --brand-2: #7c4dff;
  --brand-soft: #eef2ff;
  --ok: #17864a;
  --warn: #d97706;
  --danger: #e0433a;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;

  --shadow-xs: 0 1px 2px rgba(20, 30, 60, .05);
  --shadow: 0 2px 8px rgba(20, 30, 60, .06), 0 1px 2px rgba(20, 30, 60, .04);
  --shadow-md: 0 10px 24px -8px rgba(20, 30, 60, .16);
  --shadow-lg: 0 18px 40px -14px rgba(20, 30, 60, .22);
  --ring: 0 0 0 3px rgba(47, 107, 255, .18);

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --serif: var(--sans);            /* v4 遗留引用，统一成无衬线 */
  --grad: linear-gradient(135deg, #2f6bff, #7c4dff);
  --ease: cubic-bezier(.2, .7, .3, 1);

  color-scheme: light;
}

/* ---------- 令牌：暗色 ---------- */
html[data-theme="dark"] {
  --bg: #0e1118;
  --bg-2: #141822;
  --card: #171b25;
  --card-2: #1d2230;
  --ink: #eef1f7;
  --ink-2: #a9b1c4;
  --ink-3: #7a8298;
  --line: #262c3a;
  --line-2: #333b4d;

  --brand: #5b8cff;
  --brand-2: #a78bfa;
  --brand-soft: rgba(91, 140, 255, .14);
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 2px 10px rgba(0, 0, 0, .45);
  --shadow-md: 0 12px 28px -10px rgba(0, 0, 0, .7);
  --shadow-lg: 0 20px 46px -16px rgba(0, 0, 0, .8);
  --ring: 0 0 0 3px rgba(91, 140, 255, .3);
  --grad: linear-gradient(135deg, #5b8cff, #a78bfa);

  color-scheme: dark;
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* 底色在 html 上：body::before 的像素底纹用了负 z-index，
     若 body 自己还有背景色，底纹会被盖住（v3 踩过同样的坑）。 */
  background: transparent;
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(47, 107, 255, .18); }

a { color: var(--brand); text-decoration: none; transition: color .16s; }
a:hover { color: var(--brand-2); }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }

.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 26px; }

/* 像素底纹：棋盘格＝像素／透明，是“像素盒”的母题；只在页面上半部淡出，避免噪声 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .55;
  background-image:
    linear-gradient(45deg, var(--line) 25%, transparent 25%, transparent 75%, var(--line) 75%),
    linear-gradient(45deg, var(--line) 25%, transparent 25%, transparent 75%, var(--line) 75%);
  background-size: 18px 18px, 18px 18px;
  background-position: 0 0, 9px 9px;
  -webkit-mask-image: radial-gradient(110% 62% at 50% 0%, #000 0%, transparent 72%);
  mask-image: radial-gradient(110% 62% at 50% 0%, #000 0%, transparent 72%);
}

/* ---------- 顶栏 ---------- */
.site-head {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--card) 86%, transparent);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.site-head .wrap { display: flex; align-items: center; gap: 14px; height: 64px; }

.logo {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 800; font-size: 18.5px; letter-spacing: -.02em;
  color: var(--ink);
}
.logo:hover { color: var(--ink); }
.logo-mark { width: 32px; height: 32px; flex: none; display: block; }
.logo-mark svg {
  width: 100%; height: 100%; display: block; border-radius: 9px;
  box-shadow: 0 4px 12px -3px rgba(47, 107, 255, .55);
}
.logo-name { line-height: 1; }
.logo-sub {
  margin-left: 3px; padding-left: 10px;
  border-left: 1px solid var(--line-2);
  font-size: 12px; font-weight: 500; letter-spacing: 0;
  color: var(--ink-3); line-height: 1;
}
@media (max-width: 720px) { .logo-sub { display: none; } }
.head-spacer { flex: 1; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-2);
  display: grid; place-items: center;
  cursor: pointer; font-size: 15px;
  box-shadow: var(--shadow-xs);
  transition: color .16s, border-color .16s, transform .16s var(--ease), box-shadow .16s;
}
.icon-btn:hover { color: var(--brand); border-color: var(--brand); transform: translateY(-1px); box-shadow: var(--shadow); }

/* ---------- 版面 ---------- */
main { flex: 1; padding: 52px 0 72px; }

.site-foot {
  border-top: 1px solid var(--line);
  background: var(--card);
  padding: 22px 0 26px;
  color: var(--ink-3);
  font-size: 12.5px;
}
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
#net-badge { color: var(--ok); font-weight: 700; }

h1 {
  font-size: clamp(30px, 4.6vw, 46px);
  font-weight: 750;
  letter-spacing: -.025em;
  line-height: 1.18;
  color: var(--ink);
  margin: 0 0 14px;
}
h2 { font-size: 18px; font-weight: 750; letter-spacing: -.015em; color: var(--ink); margin: 0 0 12px; }

.lede {
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.8;
  margin: 0 0 30px;
  max-width: 62ch;
}
.lede strong, .lede b { color: var(--ink); font-weight: 700; }

.crumb { font-size: 13px; color: var(--ink-3); margin: 0 0 18px; }
.crumb a { color: var(--ink-3); }
.crumb a:hover { color: var(--brand); }

.kicker {
  display: inline-flex; align-items: center; gap: 7px;
  margin: 0 0 16px;
  padding: 5px 13px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: .01em;
}
.kicker::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 1px;
  background: var(--brand);
  box-shadow: 6px 0 0 var(--brand), 0 6px 0 var(--brand);   /* 像素簇 */
}

/* ---------- 首页 hero 居中 ---------- */
.home .wrap { text-align: center; }            /* 行内级元素（含 kicker）才会跟着居中 */
.home .lede { max-width: 660px; margin-left: auto; margin-right: auto; }
.home .sec, .home .grid { text-align: left; }  /* 栏目标题与卡片仍左对齐 */

/* 工具页收窄：workspace 有焦点，不是铺满全屏 */
main:not(.home) .wrap { max-width: 960px; }

/* ---------- 首页信任条 ---------- */
/* 卖点行：一排小药丸，只放结论，不放解释（广告词，不是说明书） */
.facts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 2px 0 34px;
}
.facts span, .facts div {
  padding: 5px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  box-shadow: var(--shadow-xs);
}
.facts b { font-weight: 700; color: var(--ink); }

/* ---------- 搜索 ---------- */
.search {
  display: block;
  width: 100%;
  max-width: 520px;
  margin: 0 auto 8px;
  padding: 15px 20px 15px 48px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background-color: var(--card);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%239298a8' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4.3-4.3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 18px 50%;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  box-shadow: var(--shadow);
  transition: border-color .16s, box-shadow .16s;
}
.search::placeholder { color: var(--ink-3); }
.search:hover { border-color: var(--line-2); }
.search:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring), var(--shadow-md); }

/* ---------- 分区标题 ---------- */
.sec {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 46px 0 16px;
  font-size: 19px;
  font-weight: 750;
  letter-spacing: -.015em;
  color: var(--ink);
}
.sec .n {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
}
.sec.more { margin-top: 50px; }

/* ---------- 卡片 ---------- */
.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  color: inherit;
  transition: transform .18s var(--ease), box-shadow .18s, border-color .18s;
}
.card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
  box-shadow: var(--shadow-md);
}

/* 彩色图标砖：实色砖 + 白色图标（.c1…c11 只负责给 --tile 上色） */
.ic {
  position: relative;
  width: 42px; height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background-color: var(--tile, var(--brand));
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0) 60%),
    linear-gradient(45deg, rgba(255, 255, 255, .13) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, .13) 75%),
    linear-gradient(45deg, rgba(255, 255, 255, .13) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, .13) 75%);
  background-size: auto, 12px 12px, 12px 12px;
  background-position: 0 0, 0 0, 6px 6px;
  color: #fff;
  box-shadow: 0 4px 10px -4px color-mix(in srgb, var(--tile, var(--brand)) 70%, transparent);
  margin-bottom: 14px;
  transition: transform .18s var(--ease);
}
/* 右下角逃出一块像素：整套卡片统一的“像素盒”记号 */
.ic::after {
  content: "";
  position: absolute;
  right: -3px; bottom: -3px;
  width: 8px; height: 8px;
  border-radius: 2px;
  background: var(--tile, var(--brand));
  box-shadow: 0 0 0 2px var(--card);
}
.card:hover .ic { transform: scale(1.06); }
.ic svg { width: 22px; height: 22px; display: block; }

.c1  { --tile: #5b6ae0; }
.c2  { --tile: #d94fa8; }
.c3  { --tile: #2f6bff; }
.c4  { --tile: #12a89a; }
.c5  { --tile: #7c4dff; }
.c6  { --tile: #e08a1e; }
.c7  { --tile: #1298dc; }
.c8  { --tile: #e8503f; }
.c9  { --tile: #1a9553; }
.c10 { --tile: #6b7280; }
.c11 { --tile: #ea6a24; }
html[data-theme="dark"] .c1  { --tile: #4a56c4; }
html[data-theme="dark"] .c2  { --tile: #b83f8c; }
html[data-theme="dark"] .c3  { --tile: #2a5cd8; }
html[data-theme="dark"] .c4  { --tile: #0f8c81; }
html[data-theme="dark"] .c5  { --tile: #6a41d8; }
html[data-theme="dark"] .c6  { --tile: #bd7419; }
html[data-theme="dark"] .c7  { --tile: #0f80bb; }
html[data-theme="dark"] .c8  { --tile: #c44536; }
html[data-theme="dark"] .c9  { --tile: #157e46; }
html[data-theme="dark"] .c10 { --tile: #565d6b; }
html[data-theme="dark"] .c11 { --tile: #c75a1f; }

.card .t {
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -.015em;
  color: var(--ink);
  margin-bottom: 6px;
  line-height: 1.4;
}
.card .d {
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.65;
}

.badge {
  display: inline-block;
  margin-left: 7px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 11px;
  font-weight: 650;
  vertical-align: 2px;
}
.badge.paid { background: #fff3e0; color: var(--warn); }
html[data-theme="dark"] .badge.paid { background: rgba(217, 119, 6, .18); }

.empty { color: var(--ink-3); padding: 26px 0; font-size: 14px; text-align: center; }

/* ---------- 面板 ---------- */
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 26px;
  margin-bottom: 20px;
}

.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row + .row { margin-top: 10px; }

label.f {
  display: block;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-2);
  margin-bottom: 7px;
}

textarea, input[type="text"], input[type="number"], input[type="search"], input[type="email"], input[type="password"], select {
  width: 100%;
  padding: 11px 14px;
  font-family: var(--mono);
  font-size: 13.5px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  resize: vertical;
  transition: border-color .16s, box-shadow .16s;
}
textarea { min-height: 170px; line-height: 1.7; }
textarea:hover, input:hover, select:hover { border-color: var(--ink-3); }
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
select { cursor: pointer; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 0;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--brand);
  border: 3px solid var(--card);
  box-shadow: 0 1px 4px rgba(20, 30, 60, .3);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--brand); border: 3px solid var(--card); cursor: pointer;
}

.btn {
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--line-2);
  background: var(--card);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 650;
  box-shadow: var(--shadow-xs);
  transition: transform .16s var(--ease), box-shadow .16s, border-color .16s, background .16s, color .16s;
}
.btn:hover { transform: translateY(-1px); border-color: var(--brand); color: var(--brand); box-shadow: var(--shadow); }
.btn:active { transform: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.primary {
  border-color: transparent;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 6px 16px -6px rgba(47, 107, 255, .7);
}
.btn.primary:hover { background: #2258e6; color: #fff; box-shadow: 0 10px 22px -8px rgba(47, 107, 255, .8); }
.btn.primary:disabled { background: var(--ink-3); }

.stats, .hint { color: var(--ink-3); font-size: 12.5px; }
.hint { margin-top: 10px; }
.err { color: var(--danger); font-size: 13.5px; min-height: 20px; white-space: pre-line; }
.ok { color: var(--ok); font-size: 13.5px; }
.guard { font-size: 12.5px; color: var(--ink-3); margin-top: 14px; line-height: 1.75; }
.guard b { color: var(--brand); }

.fileline { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: baseline; font-size: 13.5px; color: var(--ink-2); }
.fileline .nm { font-weight: 700; color: var(--ink); word-break: break-all; }

.mono-out {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-all;
  padding: 15px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card-2);
  color: var(--ink);
}

.kv { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 12.5px; color: var(--ink-2); }
.kv b { font-weight: 700; color: var(--ink); }
.kv .good { color: var(--ok); }

.cloud-note, .notice {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 13px 15px;
  border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent);
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink-2);
}
.cloud-note b, .notice b { color: var(--ink); }
.cloud-note .ic { width: auto; height: auto; background: none; margin: 0; font-size: 15px; }
.notice { margin-bottom: 16px; }

.warnbox {
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
  background: color-mix(in srgb, var(--warn) 10%, transparent);
  color: var(--ink-2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  margin-top: 12px;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ---------- 进度条 ---------- */
.barwrap { margin-top: 14px; }
.bar { height: 8px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.bar i {
  display: block; height: 100%; width: 0;
  border-radius: 999px;
  background: var(--grad);
  transition: width .3s var(--ease);
}
.bar.indet i { width: 35% !important; animation: slide 1.3s ease-in-out infinite; }
@keyframes slide { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }

/* ---------- 拖拽区 ---------- */
.drop {
  position: relative;
  border: 2px dashed var(--line-2);
  border-radius: var(--radius);
  padding: 40px 22px;
  text-align: center;
  color: var(--ink-3);
  cursor: pointer;
  background-color: var(--card-2);
  background-image:
    linear-gradient(45deg, var(--line) 25%, transparent 25%, transparent 75%, var(--line) 75%),
    linear-gradient(45deg, var(--line) 25%, transparent 25%, transparent 75%, var(--line) 75%);
  background-size: 14px 14px, 14px 14px;
  background-position: 0 0, 7px 7px;
  font-size: 14.5px;
  transition: border-color .18s, background-color .18s, color .18s;
}
.drop::before {
  content: "";
  display: block;
  width: 40px; height: 40px;
  margin: 0 auto 12px;
  border-radius: 9px;
  background: var(--brand-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%232f6bff' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E") center / 20px 20px no-repeat;
}
.drop b, .drop strong { color: var(--ink); font-weight: 700; }
.drop:hover, .drop.hot, .drop.over {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 5%, var(--card));
  color: var(--ink-2);
}
.drop.on { padding: 20px; }

/* ---------- 网格与缩略图 ---------- */
.grid2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid3 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

.thumbs { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); margin-top: 16px; }
.thumb, .pg, .preview, .canvas-wrap, .cropbox {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.thumb { transition: transform .18s var(--ease), box-shadow .18s; }
.thumb:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.thumb img, .pg img {
  width: 100%; height: 126px;
  object-fit: contain;
  display: block;
  background: var(--card-2);
  border-bottom: 1px solid var(--line);
}
.pg img { height: 152px; }
.thumb .meta, .pg .meta {
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-2);
  word-break: break-all;
}
.thumb .meta a { font-weight: 650; font-size: 12.5px; }
.thumb .save { color: var(--ok); font-weight: 700; }
.thumb .big { color: var(--warn); font-weight: 700; }

.pages { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); margin-top: 16px; }
.pages span {
  display: inline-block;
  font-family: var(--mono); font-size: 12px; padding: 4px 9px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card-2); color: var(--ink-2);
}

/* 棋盘透明底 */
.checker, .canvas-wrap, .preview img {
  background: repeating-conic-gradient(var(--card) 0% 25%, var(--bg-2) 0% 50%) 0 0 / 18px 18px !important;
}
.canvas-wrap { padding: 12px; display: grid; place-items: center; min-height: 240px; overflow: auto; }
.preview { display: none; padding: 12px; text-align: center; }
.preview img { max-width: 100%; max-height: 260px; border: 0; border-radius: 8px; }
.cropbox { display: none; position: relative; touch-action: none; }
.cropbox canvas { display: block; width: 100%; }

/* ---------- 选项卡（药丸，像筛选器） ---------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button {
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  cursor: pointer;
  color: var(--ink-2);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  transition: background .16s, color .16s, border-color .16s, box-shadow .16s;
}
.tabs button:hover { color: var(--brand); border-color: var(--brand); }
.tabs button.on { background: #232a3d; border-color: #232a3d; color: #fff; box-shadow: var(--shadow); }
html[data-theme="dark"] .tabs button.on { background: var(--brand); border-color: var(--brand); }

.posgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; width: 132px; }
.posgrid button {
  height: 32px;
  border: 1px solid var(--line-2);
  background: var(--card);
  border-radius: 8px;
  cursor: pointer;
  color: var(--ink-3);
  font-size: 11px;
  transition: color .16s, border-color .16s, background .16s;
}
.posgrid button:hover { color: var(--brand); border-color: var(--brand); }
.posgrid button.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.list { display: none; margin-top: 16px; }
.item, .list .item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  box-shadow: var(--shadow-xs);
  font-size: 13.5px;
  color: var(--ink);
}
.item + .item { margin-top: 8px; }
.item:hover { border-color: var(--line-2); }
.item .nm, .item .ms { font-size: 12.5px; color: var(--ink-3); }
.item .del, .item button.del {
  border: 1px solid var(--line-2);
  background: var(--card);
  color: var(--ink-3);
  border-radius: 8px;
  cursor: pointer;
  padding: 3px 10px;
  font-family: inherit;
  font-size: 12px;
  transition: color .16s, border-color .16s, background .16s;
}
.item .del:hover, .item button.del:hover { color: #fff; background: var(--danger); border-color: var(--danger); }

/* ---------- 选项 / 滑块行 ---------- */
.sl { display: flex; flex-wrap: wrap; gap: 12px 26px; align-items: center; font-size: 13.5px; color: var(--ink-2); margin-top: 10px; }
.sl label { display: flex; align-items: center; gap: 10px; }
.sl output { font-family: var(--mono); font-size: 12.5px; min-width: 30px; font-weight: 700; color: var(--brand); }
.opt { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; font-size: 13.5px; color: var(--ink-2); }
.opt select, .opt input[type="color"] {
  width: auto;
  padding: 8px 11px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
  font-family: inherit;
  font-size: 13.5px;
}
.opt input[type="color"] { width: 42px; height: 36px; padding: 3px; cursor: pointer; }

/* ---------- 双栏 ---------- */
.cols { display: grid; gap: 18px; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); }
@media (max-width: 780px) { .cols { grid-template-columns: 1fr; } }

/* ---------- 吐司 ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 16px);
  padding: 12px 20px;
  border-radius: 999px;
  background: #232a3d;
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s var(--ease);
  z-index: 99;
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 滚动条 ---------- */
@media (pointer: fine) {
  * { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
  *::-webkit-scrollbar { width: 10px; height: 10px; }
  *::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; }
  *::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }
}

/* ---------- 动效降级 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  main { padding: 32px 0 52px; }
  .wrap { padding: 0 18px; }
  .panel { padding: 18px; border-radius: var(--radius); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .card { padding: 16px; }
  .ic { width: 38px; height: 38px; border-radius: 10px; margin-bottom: 12px; }
  .card .t { font-size: 15.5px; }
  .site-head .wrap { height: 58px; }
  .drop { padding: 30px 16px; }
}

/* ---------- 账号 UI（可选功能，不登录完全看不到差异） ---------- */
.auth-slot { display: inline-flex; align-items: center; gap: 8px; }
.auth-open {
  padding: 8px 14px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  font: inherit; font-size: 13.5px; font-weight: 650;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: border-color .16s, color .16s, box-shadow .16s, transform .16s var(--ease);
}
.auth-open:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-1px); box-shadow: var(--shadow); }
.auth-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 3px 10px 3px 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: 13px; font-weight: 650; color: var(--ink);
  box-shadow: var(--shadow-xs);
}
.auth-chip i, .auth-chip img {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center;
  font-style: normal; font-size: 12px; font-weight: 800;
}
.auth-out { border: 0; background: none; color: var(--ink-3); font: inherit; font-size: 12.5px; cursor: pointer; padding: 4px 2px; }
.auth-out:hover { color: var(--danger); }

.auth-veil {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(14, 18, 32, .48);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.auth-veil[hidden] { display: none; }
.auth-box {
  position: relative;
  width: 100%; max-width: 402px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--shadow-lg);
}
.auth-x {
  position: absolute; top: 14px; right: 14px;
  width: 30px; height: 30px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--ink-3);
  font-size: 14px; cursor: pointer;
}
.auth-x:hover { background: var(--bg-2); color: var(--ink); }
.auth-kicker { font-size: 11.5px; font-weight: 750; letter-spacing: .08em; color: var(--brand); }
.auth-box h2 { margin: 6px 0 16px; font-size: 22px; }
.auth-tabs { display: flex; gap: 6px; padding: 4px; margin-bottom: 16px; border-radius: 11px; background: var(--bg-2); }
.auth-tabs button {
  flex: 1; padding: 8px 0;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--ink-2);
  font: inherit; font-size: 13.5px; font-weight: 650; cursor: pointer;
  transition: background .16s, color .16s;
}
.auth-tabs button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow-xs); }
.auth-form .f { display: block; margin: 0 0 6px; font-size: 12.5px; font-weight: 650; color: var(--ink-2); }
.auth-form input { margin-bottom: 14px; font-family: var(--sans); font-size: 14px; }
.auth-submit { width: 100%; margin-top: 2px; }
.auth-err {
  margin: 0 0 12px; padding: 9px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  color: var(--danger);
  font-size: 12.5px;
}
.auth-err[hidden] { display: none; }
.auth-hint { margin: 0 0 14px; font-size: 11.5px; line-height: 1.65; color: var(--ink-3); }
.auth-or { display: flex; align-items: center; gap: 10px; margin: 16px 0 12px; color: var(--ink-3); font-size: 12px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-google[hidden] { display: none; }
#gsi-slot { display: flex; justify-content: center; }
.auth-note { margin: 16px 0 0; font-size: 11.5px; line-height: 1.65; color: var(--ink-3); text-align: center; }
.auth-note a { color: var(--brand); }
@media (max-width: 480px) { .auth-open { padding: 7px 11px; font-size: 13px; } .auth-box { padding: 20px; } }
/* 账号弹窗：分区（登录/注册 vs 账号设置） */
.auth-pane[hidden] { display: none; }
.auth-passkey {
  width: 100%;
  margin-top: 10px;
  padding: 11px 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 650;
  cursor: pointer;
  transition: border-color .16s, color .16s, box-shadow .16s, transform .16s var(--ease);
}
.auth-passkey:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-1px); box-shadow: var(--shadow); }
.auth-passkey[hidden] { display: none; }

.acct-line { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; font-size: 13px; color: var(--ink-3); }
.acct-line b { font-size: 14.5px; color: var(--ink); word-break: break-all; }
.acct-pk { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card-2); margin-bottom: 16px; }
.acct-pk-head { display: flex; align-items: baseline; justify-content: space-between; font-size: 13.5px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.acct-pk-head b { font-family: var(--mono); color: var(--brand); }
.acct-pk-list:not(:empty) { margin: 4px 0 10px; }
.acct-pk-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 10px; margin-bottom: 6px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--card);
  font-size: 12.5px; color: var(--ink-2);
}
.acct-pk-item button {
  border: 1px solid var(--line-2); border-radius: 7px;
  background: transparent; color: var(--ink-3);
  font: inherit; font-size: 12px; padding: 2px 9px; cursor: pointer;
}
.acct-pk-item button:hover { color: #fff; background: var(--danger); border-color: var(--danger); }
.auth-pk-add { width: 100%; }
.auth-account-out { width: 100%; }

/* ---------- 登录闸门提示条（未登录时出现在工具页） ---------- */
.gate-note {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent);
  border-radius: var(--radius);
  background: var(--brand-soft);
  font-size: 13.5px;
  color: var(--ink-2);
}
.gate-note b { color: var(--ink); font-size: 14.5px; font-weight: 750; }
.gate-note .gate-login { margin-left: auto; }
@media (max-width: 560px) { .gate-note .gate-login { margin-left: 0; width: 100%; } }

/* ---------- 免费额度提示行（工具页） ---------- */
.quota-line {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--ink-3);
}
.quota-line b { color: var(--ink); font-family: var(--mono); }
.quota-line a { font-weight: 650; }
.quota-vip {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand);
  font-weight: 700; font-size: 12.5px;
}
