/* ============================================================
   免费工具箱 · Design system
   Aesthetic: "workbench" — warm neutral paper, ink text,
   strong amber accent, monospace numerals, blueprint grid.
   ============================================================ */

:root {
  --bg: #f4f2ee;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --surface-3: #f0eee8;
  --ink: #16150f;
  --muted: #6d6a61;
  --faint: #9b978c;
  --line: #e4e0d6;
  --line-2: #d3cec0;
  --accent: #ff4d00;
  --accent-2: #ff7a33;
  --accent-soft: #ffece2;
  --accent-ink: #ffffff;
  --ok: #0e7a5f;
  --ok-soft: #e2f4ee;
  --danger: #c0392b;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --shadow-sm: 0 1px 2px rgba(22, 21, 15, .05);
  --shadow: 0 2px 4px rgba(22, 21, 15, .04), 0 18px 40px -28px rgba(22, 21, 15, .35);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --grid: rgba(22, 21, 15, .045);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e10;
    --surface: #17171a;
    --surface-2: #1c1c20;
    --surface-3: #222227;
    --ink: #f3f2ee;
    --muted: #a3a099;
    --faint: #76736c;
    --line: #2a2a2f;
    --line-2: #3a3a41;
    --accent: #ff5c14;
    --accent-2: #ff8040;
    --accent-soft: #2a1a12;
    --accent-ink: #12100d;
    --ok: #35c79b;
    --ok-soft: #12261f;
    --grid: rgba(255, 255, 255, .04);
    --shadow: 0 2px 4px rgba(0, 0, 0, .3), 0 18px 40px -28px rgba(0, 0, 0, .8);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* blueprint grid backdrop */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 26px 26px;
  pointer-events: none;
  z-index: 0;
  mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 100%);
}

.wrap { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 0 18px 72px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 12px 18px;
  display: flex; align-items: center; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: -.02em; font-size: 16px; }
.brand .mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid; place-items: center;
  font-size: 15px; font-weight: 900;
  box-shadow: 0 4px 12px -4px var(--accent);
}
.brand .tag { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
.spacer { flex: 1; }
.topnav { display: flex; gap: 4px; min-width: 0; }
.topnav a {
  color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600;
  padding: 7px 12px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap;
}
.topnav a:hover { color: var(--ink); background: var(--surface-3); }
.topnav a.active { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 26%, transparent); }

/* ---------- hero ---------- */
.hero { padding: 52px 0 30px; }
.kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
  padding: 6px 12px; border-radius: 999px;
}
h1.title {
  font-size: clamp(30px, 6vw, 52px);
  line-height: 1.04;
  letter-spacing: -.035em;
  font-weight: 850;
  margin: 18px 0 12px;
}
h1.title em { font-style: normal; color: var(--accent); }
.lede { color: var(--muted); font-size: clamp(15px, 2.4vw, 17.5px); max-width: 60ch; margin: 0; }

/* ---------- tool cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-top: 30px; }
.card {
  display: block; text-decoration: none; color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
  position: relative; overflow: hidden;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-2); }
.card .ico {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  font-size: 22px; background: var(--surface-3); border: 1px solid var(--line);
  margin-bottom: 14px;
}
.card h3 { margin: 0 0 6px; font-size: 18px; letter-spacing: -.02em; }
.card p { margin: 0; color: var(--muted); font-size: 13.5px; }
.card .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.chip {
  font-size: 11.5px; font-weight: 650; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
}
.card .go { position: absolute; top: 20px; right: 20px; color: var(--faint); font-size: 18px; transition: transform .16s ease, color .16s ease; }
.card:hover .go { transform: translateX(3px); color: var(--accent); }

/* ---------- generic panel ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; font-size: 15px; letter-spacing: -.01em; }
.panel-head .num {
  font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 6px; padding: 2px 6px;
}

/* ---------- layout ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 16px; align-items: start; }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; } }

/* ---------- dropzone ---------- */
.drop {
  display: block; border: 1.5px dashed var(--line-2); border-radius: var(--radius);
  padding: 34px 18px; text-align: center; cursor: pointer;
  background: var(--surface-2); transition: .15s ease;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop .big { font-size: 30px; }
.drop .t { font-weight: 700; margin-top: 8px; }
.drop .s { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; margin-top: 14px; }
.thumb {
  position: relative; aspect-ratio: 1; border-radius: var(--radius-xs); overflow: hidden;
  border: 1px solid var(--line); background: var(--surface-3);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .x {
  position: absolute; top: 3px; right: 3px; width: 19px; height: 19px; border-radius: 50%;
  background: rgba(0,0,0,.62); color: #fff; border: 0; cursor: pointer; font-size: 12px; line-height: 1;
  display: grid; place-items: center; opacity: 0; transition: opacity .12s;
}
.thumb:hover .x { opacity: 1; }

/* ---------- tabs ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 650; padding: 8px 13px; border-radius: 999px; cursor: pointer;
  transition: .14s ease;
}
.tab:hover { color: var(--ink); border-color: var(--line-2); }
.tab.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- form ---------- */
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > .field { flex: 1 1 130px; margin-bottom: 13px; }
input[type=text], input[type=number], input[type=date], select, textarea {
  width: 100%; font: inherit; font-size: 14px; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-xs);
  padding: 10px 12px; outline: none; transition: border-color .14s, box-shadow .14s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=color] { width: 46px; height: 38px; padding: 3px; border-radius: var(--radius-xs); border: 1px solid var(--line); background: var(--surface-2); }
.hint { font-size: 12px; color: var(--faint); margin-top: 5px; }
.inline { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--muted); }
.inline input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); }

/* segmented */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-xs); overflow: hidden; background: var(--surface-2); }
.seg button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 650;
  padding: 9px 14px; cursor: pointer; border-right: 1px solid var(--line); transition: .14s;
}
.seg button:last-child { border-right: 0; }
.seg button.active { background: var(--accent); color: var(--accent-ink); }

/* ---------- buttons ---------- */
.btn {
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
  border-radius: var(--radius-xs); padding: 11px 18px; border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--ink); transition: .14s ease;
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 20px -10px var(--accent); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 6px; }

/* ---------- results ---------- */
.result {
  display: flex; gap: 12px; align-items: center; padding: 11px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2);
}
.result + .result { margin-top: 9px; }
.result img { width: 54px; height: 54px; object-fit: cover; border-radius: var(--radius-xs); border: 1px solid var(--line); background: var(--surface-3); }
.result .meta { flex: 1; min-width: 0; }
.result .nm { font-size: 13px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result .sz { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.delta-down { color: var(--ok); font-weight: 700; }
.delta-up { color: var(--danger); font-weight: 700; }

/* ---------- stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px; }
.stat .k { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stat .v { font-family: var(--mono); font-size: 21px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; }
.stat .v small { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat.hero-stat { background: var(--ink); border-color: var(--ink); }
.stat.hero-stat .k { color: color-mix(in srgb, var(--bg) 65%, transparent); }
.stat.hero-stat .v { color: var(--accent-2); }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-top: 12px; }
table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
th, td { padding: 8px 11px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { background: var(--surface-3); font-weight: 700; font-size: 11.5px; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: 0; }
td { font-family: var(--mono); }
td:first-child { font-family: var(--sans); }

/* ---------- misc ---------- */
.empty { text-align: center; color: var(--faint); font-size: 13px; padding: 26px 10px; }
.err { color: var(--danger); font-size: 13px; margin-top: 8px; }
.note {
  font-size: 12px; color: var(--muted); background: var(--surface-2);
  border: 1px dashed var(--line-2); border-radius: var(--radius-xs); padding: 9px 12px; margin-top: 12px;
}
.note b { color: var(--ink); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
footer.site { text-align: center; color: var(--faint); font-size: 12px; padding: 30px 0 0; }
footer.site a { color: var(--muted); }
.hidden { display: none !important; }
@media (max-width: 900px) {
  .brand .tag { display: none; }
  .topbar-inner { gap: 8px; padding: 10px 14px; }
  .topnav { overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a { padding: 7px 9px; font-size: 12.5px; flex: 0 0 auto; }
  .wrap { padding: 0 14px 60px; }
}
.stack > * + * { margin-top: 14px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { font-family: var(--mono); font-weight: 650; }

/* ================= Markdown 编辑器 ================= */
.md-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 880px) { .md-split { grid-template-columns: 1fr; } }
.md-toolbar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.md-toolbar button {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  font: inherit; font-size: 12.5px; font-weight: 650; padding: 5px 9px; border-radius: 8px; cursor: pointer;
}
.md-toolbar button:hover { color: var(--ink); border-color: var(--line-2); }
#mdInput {
  width: 100%; min-height: 430px; font-family: var(--mono); font-size: 13px; line-height: 1.7; resize: vertical;
}
.md-body {
  padding: 16px 18px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); min-height: 430px; max-height: 660px; overflow: auto;
}
.md-body h1, .md-body h2, .md-body h3, .md-body h4 { letter-spacing: -.02em; line-height: 1.25; margin: 1.1em 0 .5em; }
.md-body h1 { font-size: 1.7em; border-bottom: 1px solid var(--line); padding-bottom: .25em; }
.md-body h2 { font-size: 1.35em; border-bottom: 1px solid var(--line); padding-bottom: .2em; }
.md-body h3 { font-size: 1.15em; }
.md-body p { margin: .7em 0; }
.md-body a { color: var(--accent); }
.md-body code { font-family: var(--mono); font-size: .88em; background: var(--surface-3); padding: .15em .4em; border-radius: 5px; }
.md-body pre { background: var(--surface-3); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; overflow: auto; }
.md-body pre code { background: none; padding: 0; }
.md-body blockquote { margin: .8em 0; padding: .2em 1em; border-left: 3px solid var(--accent); color: var(--muted); background: var(--surface-2); }
.md-body ul, .md-body ol { padding-left: 1.4em; margin: .6em 0; }
.md-body table { border-collapse: collapse; width: 100%; margin: .8em 0; font-size: .92em; }
.md-body th, .md-body td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; font-family: var(--sans); white-space: normal; }
.md-body th { background: var(--surface-3); }
.md-body img { max-width: 100%; border-radius: 8px; }
.md-body hr { border: 0; border-top: 1px solid var(--line); margin: 1.2em 0; }
.md-body input[type=checkbox] { margin-right: .4em; accent-color: var(--accent); }
body.dropping::after {
  content: "松手即可导入文件";
  position: fixed; inset: 0; z-index: 999;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border: 3px dashed var(--accent);
  color: var(--accent); font-size: 20px; font-weight: 800;
  pointer-events: none;
}

/* ================= 形状裁剪 ================= */
.checker {
  background-image:
    linear-gradient(45deg, var(--surface-3) 25%, transparent 25%),
    linear-gradient(-45deg, var(--surface-3) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--surface-3) 75%),
    linear-gradient(-45deg, transparent 75%, var(--surface-3) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.shape-layers { display: flex; flex-direction: column; gap: 6px; }
.shape-layers .sl {
  padding: 7px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-xs); background: var(--surface-2);
}
.shape-layers .sl.active { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent); }
.shape-layers .sl-main { display: flex; align-items: center; gap: 8px; }
.shape-layers .sl .nm { font-size: 13px; font-weight: 650; min-width: 68px; }
.shape-layers .sl .sl-main input[type=range] { flex: 1; min-width: 60px; }
.shape-layers .sl-params { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.shape-layers .sl-params label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.shape-layers .sl-params input[type=range] { width: 96px; }
.shape-layers .sl .mini { border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 6px; cursor: pointer; }
.shape-layers .sl .mini.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
#shapePalette { display: flex; flex-wrap: wrap; gap: 4px; }
#shapePalette button { font-size: 12.5px; padding: 6px 10px; }

/* ================= 通用输出框 ================= */
.out-box {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius-xs); padding: 12px 14px;
  white-space: pre; overflow: auto; max-height: 320px; margin: 0;
}

/* ================= 颜色工具 ================= */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.swatch { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--surface-2); transition: transform .12s; }
.swatch:hover { transform: translateY(-2px); }
.swatch .c { height: 62px; }
.swatch .l { font-family: var(--mono); font-size: 11px; padding: 5px 7px; color: var(--muted); text-align: center; }
.color-chip { width: 56px; height: 56px; border-radius: 12px; border: 1px solid var(--line); }
.grad-preview { height: 110px; border-radius: 12px; border: 1px solid var(--line); }
.checks {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px;
  max-height: 230px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-xs);
  padding: 10px; background: var(--surface-2);
}
.checks label { font-size: 13px; display: flex; gap: 6px; align-items: center; color: var(--muted); }
.checks input { accent-color: var(--accent); }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.no { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

/* ================= 区域选择（录屏/截图） ================= */
.reg-sel {
  position: absolute; border: 2px dashed var(--accent);
  background: rgba(255, 77, 0, .16);
  box-shadow: 0 0 0 9999px rgba(12, 12, 14, .45);
  cursor: move; z-index: 2; pointer-events: auto;
}
.reg-sel::after {
  content: ""; position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px;
  border-radius: 3px; background: var(--accent); box-shadow: 0 0 0 2px #fff;
}
.selecting, .selecting * { user-select: none !important; cursor: crosshair !important; }

/* ================= 时间轴标尺（音视频） ================= */
.tl-track {
  position: relative; height: 58px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-3) center / 100% 100% no-repeat;
  cursor: pointer; touch-action: none; user-select: none; overflow: hidden;
}
.tl-track.disabled { cursor: default; opacity: .85; }
.tl-ticks { position: absolute; inset: 0; pointer-events: none; }
.tl-tick { position: absolute; bottom: 0; width: 1px; height: 7px; background: color-mix(in srgb, var(--ink) 30%, transparent); }
.tl-tick.major { height: 12px; background: color-mix(in srgb, var(--ink) 55%, transparent); }
.tl-tick-label {
  position: absolute; bottom: 13px; transform: translateX(-50%); font-family: var(--mono);
  font-size: 10px; color: var(--muted); text-shadow: 0 1px 2px color-mix(in srgb, var(--surface) 90%, transparent);
}
.tl-sel {
  position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--accent) 30%, transparent);
  border-left: 2px solid var(--accent); border-right: 2px solid var(--accent); cursor: grab;
  box-shadow: 0 0 0 9999px rgba(12, 12, 14, .52);
}
.tl-sel:active { cursor: grabbing; }
.tl-h { position: absolute; top: 0; bottom: 0; width: 18px; margin-left: -9px; cursor: ew-resize; display: grid; place-items: center; z-index: 3; }
.tl-h::after {
  content: ""; width: 6px; height: 34px; border-radius: 3px; background: var(--accent);
  box-shadow: 0 0 0 2px #fff, 0 1px 5px rgba(0, 0, 0, .45);
}
.tl-play { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.5); pointer-events: none; z-index: 2; }
.tl-legend { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 6px; }
.tl-legend b { color: var(--accent); font-weight: 700; }

/* ================= 密码 / 随机工具 ================= */
.pw-out {
  font-family: var(--mono); font-size: 19px; letter-spacing: .02em; word-break: break-all;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-xs);
  padding: 14px 16px; min-height: 56px; user-select: text;
}
.strength-bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 10px; }
.strength-bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s, background .2s; }
.dice { font-size: 46px; text-align: center; letter-spacing: .08em; min-height: 60px; }
.range-pair { display: flex; align-items: center; gap: 10px; }

/* 打印：只打印 Markdown 预览 */
@media print {
  .topbar, .md-toolbar, .no-print, footer.site { display: none !important; }
  body::before { display: none; }
  .wrap { max-width: none; padding: 0; }
  .md-split { display: block; grid-template-columns: 1fr; }
  .md-body { border: 0; max-height: none; overflow: visible; padding: 0; }
}

/* ============================================================
   手动主题切换（覆盖 prefers-color-scheme）
   ============================================================ */
html[data-theme="light"] {
  --bg: #f4f2ee; --surface: #ffffff; --surface-2: #faf9f6; --surface-3: #f0eee8;
  --ink: #16150f; --muted: #6d6a61; --faint: #9b978c; --line: #e4e0d6; --line-2: #d3cec0;
  --accent: #ff4d00; --accent-2: #ff7a33; --accent-soft: #ffece2; --accent-ink: #ffffff;
  --ok: #0e7a5f; --ok-soft: #e2f4ee; --danger: #c0392b; --grid: rgba(22,21,15,.045);
  --shadow: 0 2px 4px rgba(22,21,15,.04), 0 18px 40px -28px rgba(22,21,15,.35);
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #0e0e10; --surface: #17171a; --surface-2: #1c1c20; --surface-3: #222227;
  --ink: #f3f2ee; --muted: #a3a099; --faint: #76736c; --line: #2a2a2f; --line-2: #3a3a41;
  --accent: #ff5c14; --accent-2: #ff8040; --accent-soft: #2a1a12; --accent-ink: #12100d;
  --ok: #35c79b; --ok-soft: #12261f; --danger: #ff6b5e; --grid: rgba(255,255,255,.04);
  --shadow: 0 2px 4px rgba(0,0,0,.3), 0 18px 40px -28px rgba(0,0,0,.8);
  color-scheme: dark;
}

/* 顶栏小按钮 */
.tb-actions { display: flex; align-items: center; gap: 6px; }
.tb-icon-btn {
  appearance: none; border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); width: 34px; height: 34px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: 15px;
  line-height: 1; transition: .16s; padding: 0;
}
.tb-icon-btn:hover { color: var(--ink); border-color: var(--line-2); transform: translateY(-1px); }
.tb-icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 帮助面板 */
.tb-modal { position: fixed; inset: 0; background: rgba(10,10,12,.55); display: none; z-index: 999; padding: 24px; overflow: auto; }
.tb-modal.open { display: flex; align-items: center; justify-content: center; }
.tb-modal-card {
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); max-width: 620px; width: 100%;
  max-height: 86vh; overflow: auto; padding: 22px 24px;
}
.tb-modal-card h3 { margin: 0 0 4px; font-size: 19px; }
.tb-modal-card p.sub { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.tb-kbd {
  display: inline-block; font-family: var(--mono); font-size: 12px; padding: 2px 7px;
  border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px;
  background: var(--surface-2); color: var(--ink); min-width: 20px; text-align: center;
}
.tb-help-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.tb-help-row:last-of-type { border-bottom: 0; }
.tb-help-row span:last-child { color: var(--muted); text-align: right; }

/* 页脚版本 */
.tb-version { font-family: var(--mono); font-size: 11.5px; color: var(--faint); }

/* ============================================================
   顶栏布局修正：导航变多后不能被右侧按钮遮挡
   ============================================================ */
.topbar-inner { max-width: 1200px; gap: 10px; }
.topbar-inner > .spacer { flex: 0 0 auto; }
.topbar-inner > .topnav {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
  padding-bottom: 2px;
}
.topbar-inner > .topnav::-webkit-scrollbar { display: none; height: 0; }
.topbar-inner > .topnav a { flex: 0 0 auto; white-space: nowrap; }
.topbar-inner > .tb-actions { flex: 0 0 auto; margin-left: 2px; }
.topbar-inner > .brand { flex: 0 0 auto; }

/* 导航左右渐隐，提示可以横向滚动 */
.topbar-inner > .topnav {
  mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 10px), transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 10px, #000 calc(100% - 10px), transparent 100%);
}

@media (max-width: 768px) {
  .topbar-inner > .topnav { display: none; }
}
@media (max-width: 640px) {
  .topbar-inner { padding: 8px 10px; gap: 6px; }
  .topbar-inner > .topnav { mask-image: none; -webkit-mask-image: none; }
}

/* ============================================================
   顶栏改造：品牌 + 操作区一行，导航独占第二行并自动换行
   ============================================================ */
.topbar-inner { flex-wrap: wrap; row-gap: 6px; }
.topbar-inner > .brand { order: 1; }
.topbar-inner > .spacer { order: 2; flex: 1 1 auto; }
.topbar-inner > .tb-actions { order: 3; flex: 0 0 auto; }
.topbar-inner > .topnav {
  order: 4;
  flex: 1 0 100%;
  width: 100%;
  flex-wrap: wrap;
  overflow: visible;
  row-gap: 4px;
  column-gap: 4px;
  padding-bottom: 0;
  mask-image: none;
  -webkit-mask-image: none;
}
.topbar-inner > .topnav a { flex: 0 0 auto; }

/* ============================================================
   界面美化（全局）
   ============================================================ */
:root {
  --ring: color-mix(in srgb, var(--accent) 55%, transparent);
  --lift: 0 10px 30px -18px rgba(22, 21, 15, .45);
}

/* 滚动条 */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--line-2) 85%, transparent);
  border-radius: 99px; border: 3px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--muted) 60%, transparent); background-clip: content-box; }

/* 焦点可见性统一 */
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 6px; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--ring) !important;
}

/* 顶栏 */
.topbar { box-shadow: 0 1px 0 var(--line), 0 8px 24px -22px rgba(0,0,0,.5); }
.topnav a { transition: transform .14s, background .14s, color .14s, border-color .14s; }
.topnav a:hover { transform: translateY(-1px); }
.topnav a.active { font-weight: 700; box-shadow: inset 0 -2px 0 var(--accent); }

/* 面板与卡片 */
.panel { transition: box-shadow .2s, border-color .2s; }
.panel:hover { box-shadow: var(--lift); }
.panel-head h2 { letter-spacing: -.01em; }
.panel-head .num {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.cards .card {
  transition: transform .18s cubic-bezier(.2,.7,.3,1), box-shadow .18s, border-color .18s;
  will-change: transform;
}
.cards .card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  box-shadow: 0 22px 44px -26px color-mix(in srgb, var(--accent) 55%, rgba(0,0,0,.4));
}
.cards .card:hover .go { transform: translateX(3px); opacity: 1; }
.cards .card .go { transition: transform .18s, opacity .18s; opacity: .55; }
.cards .card .ico { transition: transform .22s; }
.cards .card:hover .ico { transform: scale(1.12) rotate(-4deg); }
.chip { transition: background .15s, color .15s, border-color .15s; }
.cards .card:hover .chip { border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }

/* 按钮 */
.btn { transition: transform .12s, background .15s, border-color .15s, box-shadow .15s; }
.btn:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 6px 16px -10px rgba(0,0,0,.45); }
.btn:not(:disabled):active { transform: translateY(0) scale(.985); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent-2) 70%, var(--accent)));
  border-color: transparent;
}
.btn.primary:not(:disabled):hover { filter: brightness(1.05); }

/* 标签页 */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab { transition: background .15s, color .15s, border-color .15s, transform .12s; }
.tab:hover { transform: translateY(-1px); }
.tab.active { box-shadow: 0 6px 16px -12px var(--accent); }

/* 空状态 */
.empty { color: var(--muted); }
.empty::before { content: ""; display: block; height: 1px; }

/* 结果/列表项的悬停 */
.result { transition: background .15s, border-color .15s; }
.result:hover { background: var(--surface-2); }

/* 表格预览等小卡 */
.ft-stat, .stat { transition: border-color .15s, transform .15s; }
.ft-stat:hover, .stat:hover { border-color: var(--line-2); transform: translateY(-1px); }

/* 降低动效偏好 */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .cards .card:hover { transform: none; }
}

/* ============================================================
   最近打开 / 播放列表
   ============================================================ */
.tbx-recent-list { border: 1px solid var(--line); border-radius: 10px; margin-top: 8px; max-height: 260px; overflow: auto; }
.tbx-recent-row { display: flex; align-items: center; gap: 8px; padding: 7px 11px; border-bottom: 1px dashed var(--line); font-size: 12.5px; cursor: pointer; transition: background .14s; }
.tbx-recent-row:last-child { border-bottom: 0; }
.tbx-recent-row:hover { background: var(--surface-2); }
.tbx-recent-row.playing { background: var(--accent-soft); }
.tbx-recent-row .ico { flex: 0 0 auto; }
.tbx-recent-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbx-recent-row .sz { font-family: var(--mono); font-size: 11.5px; color: var(--faint); flex: 0 0 auto; }
.tbx-recent-row .tm { font-size: 11px; color: var(--faint); flex: 0 0 auto; }
.tbx-recent-row.no-handle .nm { color: var(--muted); }
.tbx-recent-row .idx { width: 20px; text-align: right; font-family: var(--mono); font-size: 11.5px; color: var(--faint); flex: 0 0 auto; }
.tbx-recent-x { appearance: none; border: 0; background: transparent; color: var(--faint); cursor: pointer; font-size: 12px; padding: 2px 5px; border-radius: 6px; flex: 0 0 auto; }
.tbx-recent-x:hover { color: var(--danger); background: var(--surface-3); }
.tbx-badge { font-size: 11px; color: var(--muted); border: 1px dashed var(--line-2); border-radius: 99px; padding: 1px 8px; }

/* ============================================================
   授权按钮（顶栏最右）+ 授权弹窗
   ============================================================ */
.tb-auth-btn {
  appearance: none; cursor: pointer; height: 34px; padding: 0 13px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; line-height: 1; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  transition: .16s; display: inline-flex; align-items: center; gap: 5px;
}
.tb-auth-btn:hover { transform: translateY(-1px); }
.tb-auth-btn.need { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: var(--accent-ink); box-shadow: 0 6px 16px -10px var(--accent); }
.tb-auth-btn.trial { color: var(--ink); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); background: var(--accent-soft); }
.tb-auth-btn.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.tb-auth-btn.lock { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); background: color-mix(in srgb, var(--danger) 10%, transparent); animation: tbxPulse 2.4s ease-in-out infinite; }
@keyframes tbxPulse { 0%,100% { opacity: 1 } 50% { opacity: .68 } }
@media (prefers-reduced-motion: reduce) { .tb-auth-btn.lock { animation: none } }

.tbx-auth-card { max-width: 480px; }
.tbx-auth-card h3 { margin: 0 0 6px; font-size: 17px; }
.tbx-label { display: block; font-size: 12.5px; color: var(--muted); margin: 12px 0 0; }
.tbx-label input {
  display: block; width: 100%; height: 38px; margin-top: 5px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2);
  color: var(--ink); font-size: 13.5px; font-family: inherit;
}
.tbx-label input#tbxCode { font-family: var(--mono); font-size: 12px; }
.tbx-msg { font-size: 12.5px; margin-top: 9px; min-height: 17px; }
.tbx-msg.err { color: var(--danger); }
.tbx-msg.ok { color: var(--ok); }
.tbx-mac {
  font-family: var(--mono); font-size: 16px; font-weight: 700; letter-spacing: .05em;
  text-align: center; padding: 11px; border-radius: 9px; user-select: all; word-break: break-all;
  background: var(--surface-3); border: 1px dashed var(--line-2); margin-top: 10px;
}
.tbx-row { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.tbx-row b { font-family: var(--mono); }
.tbx-steps { font-size: 12px; color: var(--muted); line-height: 1.75; margin: 12px 0 0; padding-left: 18px; }
.tbx-hint { font-size: 12px; color: var(--muted); margin-top: 10px; }

/* 授权弹窗内的“复制机器码”按钮 */
.tbx-copybtn {
  display: block; width: 100%; height: 36px; margin-top: 9px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface);
  color: var(--ink); font-size: 13px; font-weight: 600; cursor: pointer; transition: .15s;
}
.tbx-copybtn:hover { border-color: var(--accent); color: var(--accent); }

/* ============================================================
   文字转语音 · 说话人网格
   ============================================================ */
.tts-spk { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 5px; max-height: 232px; overflow-y: auto; padding: 2px 4px 2px 2px; align-content: start; }
.tts-spk .spk {
  appearance: none; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  border-radius: 7px; padding: 5px 0; font-size: 12px; font-family: var(--mono); cursor: pointer; transition: .12s;
}
.tts-spk .spk:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.tts-spk .spk.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }

/* 音色性别标记与详情 */
.spk-gender { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.tts-spk .spk .g { font-style: normal; font-size: 9px; opacity: .75; margin-left: 2px; }
.tts-spk .spk.female:not(.on) { border-color: color-mix(in srgb, #e0699b 40%, var(--line)); }
.tts-spk .spk.male:not(.on) { border-color: color-mix(in srgb, #4a90d9 45%, var(--line)); }
.tts-spk .spk.female:not(.on) .g { color: #e0699b; opacity: 1; }
.tts-spk .spk.male:not(.on) .g { color: #4a90d9; opacity: 1; }
.tts-spk .spk.on .g { color: var(--accent-ink); opacity: .9; }
.spk-detail {
  margin-top: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--surface-2); font-size: 12.5px; line-height: 1.6; min-height: 42px;
}
.spk-detail code { font-family: var(--mono); font-size: 11.5px; color: var(--accent); }
.spk-detail .dim { color: var(--muted); font-size: 12px; }

/* ============================================================
   在线版新增：站点导航条 + 在线版说明条
   ============================================================ */
.tb-sitebar { background: var(--bg); border-bottom: 1px solid var(--line); }
.tb-sitebar-in {
  max-width: 1200px; margin: 0 auto; padding: 7px 14px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 12.5px; line-height: 1.5;
}
.tb-sitebar-t {
  font-weight: 800; letter-spacing: .08em; color: var(--faint);
  margin-right: 2px; text-transform: uppercase; font-size: 11.5px;
}
.tb-sitebar a {
  color: var(--muted); text-decoration: none; padding: 3px 10px;
  border: 1px solid var(--line); border-radius: 20px;
  background: var(--surface); transition: color .15s, border-color .15s, background .15s;
}
.tb-sitebar a:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.tb-notice {
  display: flex; gap: 11px; align-items: flex-start;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, transparent);
  border-radius: var(--radius-sm);
  padding: 12px 15px; margin: 0 0 20px; color: var(--ink);
}
.tb-notice-ico { font-size: 16px; line-height: 1.45; flex: 0 0 auto; }
.tb-notice-body { font-size: 13.5px; line-height: 1.7; }
.tb-notice-body b { display: block; margin-bottom: 2px; font-size: 13.5px; }
@media print { .tb-sitebar, .tb-notice { display: none !important; } }
