/* ============================================================
   DevToolbox — 全局样式
   纯 CSS 变量驱动，支持暗色 / 亮色主题与移动端抽屉导航
   ============================================================ */

:root {
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", "Noto Sans Mono CJK SC", monospace;
  --radius: 12px;
}

html[data-theme="dark"] {
  --bg: #0b0f16;
  --bg-2: #0e131c;
  --panel: #131a26;
  --panel-2: #0d131d;
  --border: #232d3f;
  --border-soft: #1a2230;
  --text: #e6edf6;
  --text-soft: #b7c4d6;
  --muted: #8494ac;
  --accent: #6d8cff;
  --accent-2: #3ddad7;
  --on-accent: #0a0f16;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #fb7185;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  --glow: 0 0 0 1px rgba(109, 140, 255, 0.28);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f5f7fb;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --panel-2: #f2f5fa;
  --border: #dde4ef;
  --border-soft: #e8edf5;
  --text: #141a24;
  --text-soft: #3c4859;
  --muted: #6b7a8f;
  --accent: #4f6df5;
  --accent-2: #14b8a6;
  --on-accent: #ffffff;
  --ok: #059669;
  --warn: #d97706;
  --err: #e11d48;
  --shadow: 0 16px 40px rgba(24, 39, 75, 0.1);
  --glow: 0 0 0 1px rgba(79, 109, 245, 0.2);
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: color-mix(in srgb, var(--accent) 35%, transparent);
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button,
input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ---------- 滚动条 ---------- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 20px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--accent) 40%, var(--border));
  background-clip: content-box;
}

/* ============================================================
   布局
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: 262px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border-right: 1px solid var(--border-soft);
  overflow: hidden;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border-soft);
}

.brand-logo {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--on-accent);
  font: 700 13px/1 var(--mono);
  letter-spacing: -0.5px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.brand-text strong {
  font-size: 15px;
  letter-spacing: 0.2px;
}
.brand-text small {
  font-size: 11.5px;
  color: var(--muted);
}

.nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 18px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-group {
  padding: 16px 10px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 9px;
  color: var(--text-soft);
  font-size: 13.5px;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover {
  background: var(--panel);
  color: var(--text);
}
.nav-item.active {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--text);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 32%, transparent);
  font-weight: 600;
}
.nav-ico {
  width: 26px;
  flex: none;
  text-align: center;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--muted);
}
.nav-item.active .nav-ico,
.nav-item:hover .nav-ico {
  color: var(--accent);
}

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 18px;
  border-top: 1px solid var(--border-soft);
  font-size: 11.5px;
  color: var(--muted);
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent);
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 58px;
  padding: 0 22px;
  border-bottom: 1px solid var(--border-soft);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.search {
  position: relative;
  flex: 1;
  max-width: 560px;
  display: flex;
  align-items: center;
}
.search svg {
  position: absolute;
  left: 11px;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 36px;
  padding: 0 58px 0 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}
.search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}
.search input::placeholder {
  color: var(--muted);
}
.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.search kbd {
  position: absolute;
  right: 9px;
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font: 600 10.5px/1.6 var(--mono);
  pointer-events: none;
}

.icon-btn {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.icon-btn:hover {
  background: var(--panel);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}
.icon-btn:active {
  transform: scale(0.96);
}
.icon-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
html[data-theme="dark"] .ico-sun,
html[data-theme="light"] .ico-moon {
  display: none;
}

.only-mobile {
  display: none;
}

/* ---------- 内容区 ---------- */
.view {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 26px 22px 64px;
}

/* ============================================================
   首页
   ============================================================ */
.hero {
  position: relative;
  overflow: hidden;
  padding: 26px 26px 22px;
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  background:
    radial-gradient(600px 220px at 12% -30%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 70%),
    radial-gradient(500px 200px at 92% 120%, color-mix(in srgb, var(--accent-2) 22%, transparent), transparent 70%),
    var(--panel);
  margin-bottom: 26px;
}
.hero h1 {
  font-size: 25px;
  letter-spacing: -0.4px;
  line-height: 1.3;
}
.hero p {
  margin-top: 8px;
  color: var(--text-soft);
  max-width: 640px;
  font-size: 13.5px;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel-2) 70%, transparent);
  font-size: 12px;
  color: var(--text-soft);
}
.pill b {
  color: var(--text);
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 26px 2px 12px;
}
.section-title h2 {
  font-size: 14px;
  letter-spacing: 0.02em;
}
.section-title span {
  font-size: 12px;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 12px;
}

.tool-card {
  display: flex;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: var(--panel);
  transition: transform 0.18s ease, border-color 0.18s, box-shadow 0.18s;
}
.tool-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: var(--shadow);
}
.tool-ico {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 11px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text-soft);
  background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 22%, var(--panel-2)), color-mix(in srgb, var(--accent-2) 14%, var(--panel-2)));
  border: 1px solid var(--border);
}
.tool-card h3 {
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 2px;
}
.tool-card p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty {
  padding: 44px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 14px;
  font-size: 13px;
}

/* ============================================================
   工具页
   ============================================================ */
.tool-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}
.tool-head .tool-ico {
  width: 46px;
  height: 46px;
  font-size: 15px;
  border-radius: 13px;
}
.tool-head h1 {
  font-size: 20px;
  letter-spacing: -0.3px;
}
.tool-head p {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 2px;
}
.crumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}
.crumb a:hover {
  color: var(--accent);
}

.panel {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: var(--panel);
  margin-bottom: 14px;
}
.panel-head {
  margin-bottom: 12px;
}
.panel-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.panel-desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.tool-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: 0.01em;
}
.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.hint {
  font-size: 11.5px;
  color: var(--muted);
}

.inp {
  width: 100%;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.inp:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}
.inp::placeholder {
  color: color-mix(in srgb, var(--muted) 75%, transparent);
}
textarea.inp {
  resize: vertical;
  min-height: 110px;
  line-height: 1.6;
  tab-size: 2;
}
select.inp {
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 51%, calc(100% - 10px) 51%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

.mono {
  font-family: var(--mono);
  font-size: 12.5px;
}

/* ---------- 按钮 ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.toolbar .spacer,
.spacer {
  flex: 1;
}

.btn {
  height: 33px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, opacity 0.15s;
}
.btn:hover {
  background: color-mix(in srgb, var(--accent) 12%, var(--panel-2));
  border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
}
.btn:active {
  transform: scale(0.98);
}
.btn.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--accent-2)));
  color: var(--on-accent);
  font-weight: 600;
}
.btn.primary:hover {
  filter: brightness(1.06);
}
.btn.ghost {
  background: transparent;
}
.btn.sm {
  height: 27px;
  padding: 0 9px;
  font-size: 11.5px;
  border-radius: 7px;
}
.btn.danger:hover {
  color: var(--err);
  border-color: color-mix(in srgb, var(--err) 45%, var(--border));
  background: color-mix(in srgb, var(--err) 10%, transparent);
}

/* ---------- 分段控件 ---------- */
.segment {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
}
.seg-btn {
  height: 27px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.seg-btn:hover {
  color: var(--text);
}
.seg-btn.active {
  background: color-mix(in srgb, var(--accent) 22%, var(--panel));
  color: var(--text);
  font-weight: 600;
}

/* ---------- 复选 ---------- */
.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-soft);
  cursor: pointer;
  user-select: none;
}
.check input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 0;
}

/* ---------- 输出块 ---------- */
.out-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.out-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.out {
  margin: 0;
  padding: 12px;
  min-height: 44px;
  max-height: 460px;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.62;
  color: var(--text);
  tab-size: 2;
}
.out:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
}

.status {
  font-size: 12px;
  padding: 7px 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
}
.status.ok {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 35%, var(--border));
  background: color-mix(in srgb, var(--ok) 8%, transparent);
}
.status.err {
  color: var(--err);
  border-color: color-mix(in srgb, var(--err) 35%, var(--border));
  background: color-mix(in srgb, var(--err) 8%, transparent);
}
.status.warn {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 35%, var(--border));
  background: color-mix(in srgb, var(--warn) 8%, transparent);
}

/* ---------- 布局工具类 ---------- */
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.row.between {
  justify-content: space-between;
}
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.grow {
  flex: 1;
  min-width: 0;
}
.mt8 {
  margin-top: 8px;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}

/* ---------- 统计卡片 ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 9px;
}
.stat {
  padding: 11px 12px;
  border-radius: 11px;
  border: 1px solid var(--border-soft);
  background: var(--panel-2);
}
.stat b {
  display: block;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.3px;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}
.stat span {
  font-size: 11.5px;
  color: var(--muted);
}

/* ---------- 键值列表 ---------- */
.kv {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kv-row {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--border-soft);
  background: var(--panel-2);
}
.kv-key {
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.kv-val {
  font-family: var(--mono);
  font-size: 12.5px;
  word-break: break-all;
}

/* ---------- Diff ---------- */
.diff-view {
  margin: 0;
  padding: 0;
  max-height: 520px;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
}
.diff-line {
  display: flex;
  gap: 10px;
  padding: 1px 10px;
  white-space: pre-wrap;
  word-break: break-word;
}
.diff-line .sign {
  flex: none;
  width: 10px;
  color: var(--muted);
  user-select: none;
}
.diff-add {
  background: color-mix(in srgb, var(--ok) 14%, transparent);
  box-shadow: inset 2px 0 0 var(--ok);
}
.diff-del {
  background: color-mix(in srgb, var(--err) 14%, transparent);
  box-shadow: inset 2px 0 0 var(--err);
}
.diff-same {
  color: var(--muted);
}

/* ---------- Markdown ---------- */
.md {
  padding: 14px 16px;
  min-height: 260px;
  max-height: 560px;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  font-size: 13.5px;
  line-height: 1.7;
  word-break: break-word;
}
.md > *:first-child {
  margin-top: 0;
}
.md h1,
.md h2,
.md h3,
.md h4 {
  margin: 1.1em 0 0.45em;
  line-height: 1.35;
  letter-spacing: -0.2px;
}
.md h1 {
  font-size: 1.55em;
  padding-bottom: 0.25em;
  border-bottom: 1px solid var(--border);
}
.md h2 {
  font-size: 1.3em;
  padding-bottom: 0.2em;
  border-bottom: 1px solid var(--border-soft);
}
.md h3 {
  font-size: 1.12em;
}
.md p {
  margin: 0.65em 0;
}
.md ul,
.md ol {
  margin: 0.6em 0;
  padding-left: 1.5em;
}
.md li {
  margin: 0.22em 0;
}
.md blockquote {
  margin: 0.8em 0;
  padding: 0.2em 0.9em;
  border-left: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  color: var(--text-soft);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  border-radius: 0 8px 8px 0;
}
.md code {
  padding: 0.12em 0.4em;
  border-radius: 5px;
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  font-family: var(--mono);
  font-size: 0.88em;
}
.md pre.md-code {
  margin: 0.8em 0;
  padding: 11px 13px;
  overflow: auto;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-2);
}
.md pre.md-code code {
  padding: 0;
  background: none;
  font-size: 12.5px;
}
.md a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.md hr {
  margin: 1.2em 0;
  border: 0;
  border-top: 1px solid var(--border);
}
.md table {
  border-collapse: collapse;
  margin: 0.8em 0;
  font-size: 0.95em;
}
.md th,
.md td {
  border: 1px solid var(--border);
  padding: 5px 10px;
}
.md th {
  background: var(--panel);
}

/* ---------- 正则高亮 ---------- */
mark.hl {
  background: color-mix(in srgb, var(--warn) 34%, transparent);
  color: inherit;
  border-radius: 3px;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--warn) 55%, transparent);
}

.match-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 9px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--panel-2);
  font-family: var(--mono);
  font-size: 12px;
}
.match-idx {
  flex: none;
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--text);
  font-size: 10.5px;
}
.match-val {
  flex: 1;
  min-width: 0;
  word-break: break-all;
}

/* ---------- 颜色 ---------- */
.swatch {
  height: 74px;
  border-radius: 11px;
  border: 1px solid var(--border);
}
.color-input {
  width: 46px;
  height: 36px;
  padding: 2px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  cursor: pointer;
}

/* ---------- 图片来源 ---------- */
.dropzone {
  padding: 26px 18px;
  border-radius: 12px;
  border: 1.5px dashed var(--border);
  background: var(--panel-2);
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover,
.dropzone.over {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, var(--panel-2));
  color: var(--text-soft);
}
.img-preview {
  max-width: 100%;
  max-height: 240px;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: block;
  background: repeating-conic-gradient(var(--panel) 0 25%, var(--panel-2) 0 50%) 0 0/16px 16px;
}

/* ---------- 滑块 ---------- */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 20px;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 99px;
  background: var(--border);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-2);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
input[type="range"]::-moz-range-track {
  height: 5px;
  border-radius: 99px;
  background: var(--border);
}
input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-2);
}

/* ---------- 强度条 ---------- */
.strength {
  height: 6px;
  border-radius: 99px;
  background: var(--border);
  overflow: hidden;
}
.strength > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  transition: width 0.25s ease, background 0.25s;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 16px);
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  font-size: 12.5px;
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 90;
  max-width: 80vw;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 35;
}
.scrim.show {
  opacity: 1;
  pointer-events: auto;
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 960px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 268px;
    transform: translateX(-102%);
    transition: transform 0.24s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.open {
    transform: none;
  }
  .only-mobile {
    display: grid;
  }
  .topbar {
    padding: 0 14px;
    height: 54px;
  }
  .view {
    padding: 18px 14px 56px;
  }
  .split {
    grid-template-columns: minmax(0, 1fr);
  }
  .hero {
    padding: 20px 18px;
  }
  .hero h1 {
    font-size: 21px;
  }
  .search kbd {
    display: none;
  }
  .search input {
    padding-right: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
