/* ==========================================================================
   米匣 MiBox — "计量台" editorial / instrument aesthetic
   warm drafting paper · ink · vermilion · hairline rules · mono labels
   ========================================================================== */

:root {
  --bg: #f1ece1;
  --bg-elevated: #f7f2e7;
  --panel: #fbf7ee;
  --panel-soft: #f5f0e3;
  --panel-inset: #ebe5d5;
  --text: #16150f;
  --text-soft: #35322a;
  --muted: #746e5e;
  --border: #ddd5c2;
  --border-strong: #c6bca5;
  --accent: #c2402a;
  --accent-hover: #9d2f1c;
  --accent-soft: #f5e0d8;
  --accent-2: #1f4d45;
  --ok: #1d6a4e;
  --ok-soft: #e2eee4;
  --warn: #96610f;
  --warn-soft: #f6ead2;
  --err: #ae2a1d;
  --err-soft: #f8e0da;
  --mark: #f0d484;
  --mark-text: #3a2b00;
  --grid: rgba(22, 21, 15, .055);
  --shadow-sm: 0 1px 0 rgba(22, 21, 15, .04);
  --shadow: 0 1px 0 rgba(22, 21, 15, .04), 0 16px 32px -26px rgba(22, 21, 15, .55);
  --shadow-lg: 0 24px 50px -34px rgba(22, 21, 15, .6);
  --radius: 4px;
  --radius-sm: 2px;
  --mono: "Cascadia Mono", ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: "Segoe UI", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Songti SC", "STSong", "SimSun", serif;
  --header-h: 64px;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #111210;
  --bg-elevated: #161713;
  --panel: #1a1b16;
  --panel-soft: #1f201a;
  --panel-inset: #131410;
  --text: #f0eadb;
  --text-soft: #cec6b4;
  --muted: #948c7a;
  --border: #2d2e26;
  --border-strong: #43443a;
  --accent: #ff7052;
  --accent-hover: #ff8d74;
  --accent-soft: #2c1a14;
  --accent-2: #7fbcac;
  --ok: #62c69a;
  --ok-soft: #14251d;
  --warn: #dfa44f;
  --warn-soft: #2a2113;
  --err: #ff7c6c;
  --err-soft: #2c1713;
  --mark: #7c5d13;
  --mark-text: #ffe9a8;
  --grid: rgba(240, 234, 219, .045);
  --shadow-sm: 0 1px 0 rgba(0, 0, 0, .5);
  --shadow: 0 1px 0 rgba(0, 0, 0, .5), 0 18px 36px -28px rgba(0, 0, 0, .9);
  --shadow-lg: 0 26px 56px -34px rgba(0, 0, 0, .95);
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.68;
  color: var(--text);
  background-color: var(--bg);
  background-image: radial-gradient(circle at 1px 1px, var(--grid) 1px, transparent 0);
  background-size: 5px 5px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.015em; font-weight: 700; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
code, kbd, pre, textarea { font-family: var(--mono); }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { max-width: 100%; }

::selection { background: var(--text); color: var(--panel); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.skip-link {
  position: absolute; left: 12px; top: -64px; z-index: 100;
  background: var(--text); color: var(--panel); padding: 10px 16px; border-radius: 2px;
  transition: top .15s ease; font-size: 13px;
}
.skip-link:focus { top: 12px; color: var(--panel); }

.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 920px; }

/* --------------------------------------------------------- header ------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--border-strong);
}
.header-inner { height: var(--header-h); display: flex; align-items: center; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); font-weight: 700; font-size: 15.5px; letter-spacing: -.01em; }
.brand:hover { color: var(--text); }
.brand-mark {
  width: 32px; height: 32px; border-radius: 2px; display: grid; place-items: center;
  background: var(--accent); color: #fdf7ec; flex: none;
  box-shadow: 2px 2px 0 var(--text);
}
.brand-mark svg { width: 17px; height: 17px; }
.brand small {
  display: block; font-family: var(--mono); font-size: 9px; font-weight: 500;
  letter-spacing: .22em; color: var(--muted); text-transform: uppercase; line-height: 1; margin-top: 4px;
}
.header-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.header-nav a.nav-link {
  color: var(--text-soft); font-family: var(--mono); font-size: 11px;
  letter-spacing: .08em; padding: 8px 11px; border-radius: 2px;
  border-bottom: 1px solid transparent; transition: .15s ease;
}
.header-nav a.nav-link:hover { background: transparent; color: var(--accent); border-bottom-color: var(--accent); }
.theme-toggle {
  width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer;
  background: transparent; border: 1px solid var(--border-strong); border-radius: 2px;
  color: var(--text-soft); transition: .15s ease; margin-left: 6px;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* --------------------------------------------------------- buttons ------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 8px 16px; border-radius: var(--radius-sm); cursor: pointer;
  background: var(--panel); color: var(--text); border: 1px solid var(--border-strong);
  font-size: 13.5px; font-weight: 550; line-height: 1; white-space: nowrap;
  transition: transform .12s ease, box-shadow .12s ease, background .15s ease, border-color .15s ease, color .15s ease;
  box-shadow: var(--shadow-sm);
}
.btn:hover { border-color: var(--text); background: var(--panel-soft); }
.btn:active { transform: translate(1px, 1px); box-shadow: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; flex: none; }
.btn.primary {
  background: var(--accent); border-color: var(--accent); color: #fdf7ec;
  box-shadow: 2px 2px 0 var(--text);
}
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--text); }
.btn.primary:active { transform: translate(1px, 1px); box-shadow: none; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn.ghost:hover { background: transparent; color: var(--accent); border-color: transparent; text-decoration: underline; text-underline-offset: 4px; }
.btn.sm { min-height: 32px; padding: 6px 11px; font-size: 12.5px; }
.btn.icon-only { padding: 0; width: 34px; min-height: 38px; font-size: 16px; }
.btn.danger { color: var(--err); }

/* --------------------------------------------------------- home hero ---- */
.hero { position: relative; overflow: hidden; padding: 84px 0 66px; border-bottom: 1px solid var(--border-strong); }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 78% 82% at 50% 0%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 78% 82% at 50% 0%, #000 20%, transparent 78%);
}
.hero::after {
  content: ""; position: absolute; width: 560px; height: 560px; right: -200px; top: -300px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 16%, transparent), transparent 64%);
  pointer-events: none;
}
.hero-inner { position: relative; text-align: center; }
.hero-inner::before,
.hero-inner::after {
  content: "+"; position: absolute; top: -26px; font-family: var(--mono);
  font-size: 15px; color: var(--border-strong); pointer-events: none; line-height: 1;
}
.hero-inner::before { left: 0; }
.hero-inner::after { right: 0; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 9px; padding: 6px 12px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: .14em;
  color: var(--text-soft); background: transparent;
  border: 1px solid var(--border-strong); border-radius: 2px; margin-bottom: 24px;
}
.eyebrow .dot {
  width: 5px; height: 5px; border-radius: 0; background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.hero h1 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(32px, 5vw, 56px); line-height: 1.1; letter-spacing: -.035em;
  text-wrap: balance;
}
.hero h1 .grad {
  color: var(--accent);
  background: linear-gradient(transparent 62%, var(--accent-soft) 62%, var(--accent-soft) 95%, transparent 95%);
  padding: 0 .06em;
}
.hero .lead { max-width: 690px; margin: 18px auto 0; color: var(--muted); font-size: 15.5px; }
.hero .lead strong { color: var(--text-soft); font-weight: 600; }
.hero-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 28px; }
.hero-meta { display: flex; gap: 22px; justify-content: center; flex-wrap: wrap; margin-top: 28px; color: var(--muted); font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; }
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero-meta svg { width: 13px; height: 13px; color: var(--accent-2); }

.search-wrap { max-width: 570px; margin: 36px auto 0; position: relative; }
.search-wrap svg { position: absolute; left: 16px; top: 26px; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.search-input {
  width: 100%; height: 52px; padding: 0 16px 0 44px; border-radius: var(--radius-sm);
  background: var(--panel); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  font-size: 14.5px; transition: border-color .15s ease, box-shadow .15s ease;
}
.search-wrap .search-input { padding: 0 16px 0 44px; }
.search-input::placeholder { color: var(--muted); opacity: .85; }
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: 3px 3px 0 var(--accent-soft), var(--shadow); }
.search-hint { margin-top: 11px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .05em; color: var(--muted); min-height: 20px; }

/* --------------------------------------------------------- sections ----- */
.section { padding: 58px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.section-head h2 {
  font-family: var(--display); font-size: 27px; letter-spacing: -.02em; display: flex; align-items: center; gap: 12px;
}
.section-head h2::before {
  content: ""; width: 8px; height: 8px; background: var(--accent); flex: none;
  transform: rotate(45deg);
}
.section-head p { color: var(--muted); font-size: 13px; margin-top: 7px; }

.category-label {
  display: flex; align-items: center; gap: 12px; margin: 36px 0 14px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500; color: var(--muted);
  letter-spacing: .12em; text-transform: uppercase;
}
.category-label::before { content: ""; width: 14px; height: 1px; background: var(--accent); flex: none; }
.category-label::after { content: ""; height: 1px; flex: 1; background: var(--border); }

.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; counter-reset: toolcard; }
.tool-card {
  position: relative; display: flex; flex-direction: column; gap: 13px;
  padding: 20px 20px 18px; background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: var(--radius); color: var(--text); box-shadow: var(--shadow-sm);
  transition: transform .18s cubic-bezier(.2, .7, .3, 1), box-shadow .18s ease, border-color .18s ease, background .18s ease;
  overflow: hidden;
}
.tool-card::before {
  counter-increment: toolcard; content: "0" counter(toolcard);
  position: absolute; top: 17px; right: 18px; font-family: var(--mono);
  font-size: 10px; letter-spacing: .12em; color: var(--muted); opacity: .7;
}
.tool-card::after {
  content: ""; position: absolute; left: 20px; right: 20px; bottom: 0; height: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform .28s cubic-bezier(.2, .7, .3, 1);
}
.tool-card:hover {
  transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--accent);
  border-color: var(--text); color: var(--text); background: var(--panel);
}
.tool-card:hover::after { transform: scaleX(1); }
.tool-card .icon-tile {
  width: 40px; height: 40px; border-radius: var(--radius-sm); display: grid; place-items: center;
  background: var(--panel-soft); color: var(--accent); flex: none;
  border: 1px solid var(--border-strong); transition: .18s ease;
}
.tool-card:hover .icon-tile { background: var(--accent); border-color: var(--accent); color: #fdf7ec; }
.tool-card .icon-tile svg { width: 20px; height: 20px; }
.tool-card h3 { font-size: 15.5px; font-weight: 650; display: flex; align-items: center; gap: 8px; letter-spacing: -.01em; }
.tool-card h3 .go { margin-left: auto; color: var(--muted); opacity: 0; transform: translateX(-5px); transition: .2s ease; font-family: var(--mono); }
.tool-card:hover h3 .go { opacity: 1; transform: none; color: var(--accent); }
.tool-card p { color: var(--muted); font-size: 13px; line-height: 1.62; }
.tool-card .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-right: 26px; }
.tag {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em; padding: 3px 7px;
  border-radius: 1px; color: var(--muted); background: transparent; border: 1px solid var(--border);
}
.empty-state { display: none; padding: 44px; text-align: center; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: var(--radius); font-family: var(--mono); font-size: 12px; }
.empty-state.show { display: block; }

.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; counter-reset: feature; }
.feature {
  position: relative; padding: 24px 22px; background: var(--panel); border: 1px solid var(--border-strong);
  border-top: 3px solid var(--text); border-radius: var(--radius);
}
.feature::before {
  counter-increment: feature; content: "0" counter(feature);
  position: absolute; top: 20px; right: 20px; font-family: var(--mono); font-size: 10px;
  letter-spacing: .1em; color: var(--border-strong);
}
.feature .icon-tile {
  width: 36px; height: 36px; border-radius: var(--radius-sm); display: grid; place-items: center;
  background: transparent; color: var(--accent-2); border: 1px solid var(--border-strong); margin-bottom: 16px;
}
.feature .icon-tile svg { width: 18px; height: 18px; }
.feature h3 { font-size: 14.5px; margin-bottom: 7px; font-weight: 650; }
.feature p { color: var(--muted); font-size: 13px; }

/* --------------------------------------------------------- tool page ---- */
.breadcrumb {
  display: flex; align-items: center; gap: 8px; font-family: var(--mono);
  font-size: 10px; letter-spacing: .07em; color: var(--muted); padding: 22px 0 0; flex-wrap: wrap;
}
.breadcrumb a { color: var(--muted); border-bottom: 1px solid transparent; }
.breadcrumb a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.breadcrumb .sep { opacity: .5; }
.breadcrumb .current { color: var(--text-soft); font-weight: 500; }

.tool-hero { padding: 30px 0 26px; }
.tool-hero-inner { display: flex; align-items: flex-start; gap: 20px; }
.tool-hero .icon-tile {
  width: 56px; height: 56px; border-radius: var(--radius); display: grid; place-items: center; flex: none;
  background: var(--panel); color: var(--accent);
  border: 1px solid var(--text); box-shadow: 3px 3px 0 var(--accent-soft);
}
.tool-hero .icon-tile svg { width: 26px; height: 26px; }
.tool-hero h1 {
  font-family: var(--display); font-size: clamp(27px, 3.4vw, 38px);
  letter-spacing: -.025em; word-break: keep-all; overflow-wrap: anywhere;
}
.tool-hero .lead { color: var(--muted); margin-top: 10px; max-width: 770px; font-size: 14.5px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.badge {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .07em;
  padding: 4px 8px; border-radius: 1px; background: transparent; color: var(--muted);
  font-weight: 500; border: 1px solid var(--border-strong);
}
.badge:first-child { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }
.badge.neutral { background: transparent; color: var(--muted); border: 1px solid var(--border); }

.tool-panel {
  background: var(--panel); border: 1px solid var(--border-strong); border-top: 3px solid var(--text);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.tool-body { padding: 20px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar.end { justify-content: flex-end; margin-top: 12px; }
.toolbar .spacer { flex: 1; }
.toolbar + .toolbar { margin-top: 10px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field-label {
  font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}
.field-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }

input[type="text"], input[type="number"], input[type="search"], select, textarea {
  width: 100%; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--panel-inset); color: var(--text); padding: 9px 12px;
  font-size: 14px; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input[type="text"]:focus, input[type="number"]:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); background: var(--panel);
  box-shadow: 2px 2px 0 var(--accent-soft);
}
textarea {
  min-height: 215px; resize: vertical; line-height: 1.65; font-size: 12.8px;
  font-family: var(--mono); tab-size: 2; white-space: pre; overflow-wrap: normal; overflow-x: auto;
}
textarea.short { min-height: 120px; }
textarea[readonly] { background: var(--panel-inset); color: var(--text-soft); }
textarea::placeholder { color: var(--muted); opacity: .7; }
select {
  width: auto; min-width: 122px; cursor: pointer; padding-right: 30px; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
input[type="number"] { -moz-appearance: textfield; }
input[type="range"] { accent-color: var(--accent); width: 100%; }
input[type="color"] {
  width: 54px; height: 42px; padding: 3px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--panel); cursor: pointer; flex: none;
}
input[type="datetime-local"] { max-width: 266px; }

.checks { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 14px 0; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-soft); cursor: pointer; user-select: none; }
.check input { width: 14px; height: 14px; accent-color: var(--accent); cursor: pointer; border-radius: 1px; }

.status {
  display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono);
  font-size: 10.5px; letter-spacing: .02em; color: var(--muted); min-height: 20px;
}
.status::before { content: ""; width: 5px; height: 5px; background: var(--border-strong); flex: none; }
.status.ok { color: var(--ok); } .status.ok::before { background: var(--ok); }
.status.err { color: var(--err); } .status.err::before { background: var(--err); }
.status.warn { color: var(--warn); } .status.warn::before { background: var(--warn); }

.subcard {
  background: transparent; border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm); padding: 16px;
}
.subcard h3 {
  font-family: var(--mono); font-size: 10px; color: var(--muted); font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase; margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.subcard h3::before { content: "▚"; color: var(--accent); font-size: 10px; }
.subcard + .subcard { margin-top: 12px; }

.res-list { display: flex; flex-direction: column; gap: 4px; }
.res-row {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px;
  border-radius: var(--radius-sm); background: var(--panel-soft);
  border: 1px solid var(--border); min-height: 40px;
}
.res-row + .res-row { margin-top: 4px; }
.res-row .label {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em; color: var(--muted);
  min-width: 96px; flex: none; font-weight: 500; text-transform: uppercase;
}
.res-row code {
  font-size: 12.5px; word-break: break-all; color: var(--text); flex: 1; min-width: 0;
  background: none; padding: 0; font-family: var(--mono);
}
.res-row .copy { flex: none; }
.res-row.vertical { flex-direction: column; align-items: stretch; gap: 5px; }
.res-row.vertical .label { min-width: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 8px; }
.stat { background: var(--panel-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.stat b { display: block; font-family: var(--display); font-size: 24px; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; }
.stat span { font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; }

.pw-display {
  display: flex; align-items: center; gap: 12px; padding: 17px 18px; margin: 14px 0 10px;
  border-radius: var(--radius-sm); background: var(--panel-inset);
  border: 1px dashed var(--border-strong);
}
.pw-display code {
  font-size: clamp(17px, 2.4vw, 23px); letter-spacing: .03em; word-break: break-all;
  flex: 1; color: var(--text); font-weight: 600;
}
.strength-bar { height: 4px; border-radius: 0; background: var(--border); overflow: hidden; }
.strength-bar i { display: block; height: 100%; width: 0; transition: width .2s ease, background .2s ease; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  cursor: pointer; font-family: var(--mono); font-size: 10.5px; letter-spacing: .03em;
  padding: 4px 9px; border-radius: 1px; background: transparent;
  border: 1px solid var(--border); color: var(--text-soft); transition: .15s ease;
}
.chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
code.inline { background: var(--panel-inset); border: 1px solid var(--border); border-radius: 1px; padding: 1px 5px; font-size: 12.5px; }

mark { background: var(--mark); color: var(--mark-text); border-radius: 1px; padding: 0 1px; }

.regex-line {
  display: flex; align-items: center; gap: 0; background: var(--panel-inset);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding-left: 12px; overflow: hidden;
}
.regex-line:focus-within { border-color: var(--accent); box-shadow: 2px 2px 0 var(--accent-soft); }
.regex-line .slash { color: var(--muted); font-family: var(--mono); }
.regex-line input { border: none; background: transparent; box-shadow: none !important; font-family: var(--mono); }
.regex-line .flags-echo { font-family: var(--mono); font-size: 12px; color: var(--accent); padding-right: 12px; }

.palette { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; margin-top: 12px; }
.swatch { height: 42px; border-radius: 1px; cursor: pointer; border: 1px solid rgba(0, 0, 0, .1); position: relative; }
.swatch:hover::after {
  content: attr(data-hex); position: absolute; inset: auto 0 -22px 0; font-size: 9px;
  text-align: center; color: var(--muted); font-family: var(--mono);
}
.palette-wrap { padding-bottom: 22px; }

.color-preview { height: 86px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); margin-bottom: 12px; transition: background .15s ease; }

.match-list { max-height: 280px; overflow: auto; }
.match-item {
  padding: 9px 12px; border-radius: var(--radius-sm); background: var(--panel-soft);
  border: 1px solid var(--border); font-size: 13px;
}
.match-item + .match-item { margin-top: 6px; }
.match-item .idx { color: var(--muted); font-size: 10px; font-family: var(--mono); letter-spacing: .03em; }
.match-item code { display: block; word-break: break-all; margin-top: 3px; }
.match-item .groups { margin-top: 5px; font-size: 11px; color: var(--muted); font-family: var(--mono); }

.highlight-box {
  white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere;
  background: var(--panel-inset); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; font-family: var(--mono); font-size: 12.5px; line-height: 1.8;
  color: var(--text-soft); min-height: 150px; max-height: 260px; overflow: auto;
}
button.swatch { padding: 0; box-shadow: none; }

/* --------------------------------------------------------- editorial ---- */
.content-blocks { padding: 48px 0 8px; counter-reset: section; }
.content-card {
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: 30px 32px; box-shadow: var(--shadow-sm);
}
.content-card + .content-card { margin-top: 14px; }
.content-card h2 {
  font-family: var(--display); font-size: 21px; margin-bottom: 14px; letter-spacing: -.015em;
  display: flex; align-items: baseline; gap: 12px;
}
.content-card h2::before {
  counter-increment: section; content: "0" counter(section);
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em; color: var(--accent);
  font-weight: 500;
}
.content-card h3 { font-size: 15px; margin: 20px 0 8px; font-weight: 650; }
.content-card p { color: var(--text-soft); font-size: 14.5px; }
.content-card p + p { margin-top: 10px; }
.content-card ul, .content-card ol { margin: 12px 0 0; padding-left: 0; list-style: none; display: grid; gap: 8px; counter-reset: step; }
.content-card ul li, .content-card ol li { position: relative; padding-left: 24px; color: var(--text-soft); font-size: 14.2px; }
.content-card ul li::before {
  content: ""; position: absolute; left: 4px; top: .66em; width: 5px; height: 5px;
  background: var(--accent); transform: rotate(45deg);
}
.content-card ol li { counter-increment: step; }
.content-card ol li::before {
  content: counter(step); position: absolute; left: 0; top: .12em; width: 17px; height: 17px;
  display: grid; place-items: center; border-radius: 1px; background: transparent;
  color: var(--accent); border: 1px solid var(--border-strong);
  font-size: 9.5px; font-weight: 600; font-family: var(--mono); line-height: 1;
}
.content-card code { background: var(--panel-inset); border: 1px solid var(--border); border-radius: 1px; padding: 1px 5px; font-size: 12.5px; }
.note {
  border-left: 2px solid var(--accent); background: var(--accent-soft);
  padding: 12px 16px; border-radius: 0; font-size: 13.2px; color: var(--text-soft); margin-top: 16px;
}
.note b { color: var(--text); font-weight: 650; }

.faq { padding: 38px 0 8px; }
.faq h2 { font-family: var(--display); font-size: 24px; letter-spacing: -.02em; margin-bottom: 6px; }
.faq .sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.faq-list { display: grid; gap: 6px; }
details.qa { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
details.qa[open] { border-color: var(--border-strong); border-left: 2px solid var(--accent); }
details.qa summary {
  cursor: pointer; list-style: none; padding: 15px 46px 15px 18px; font-weight: 600;
  font-size: 14.2px; position: relative; color: var(--text);
}
details.qa summary::-webkit-details-marker { display: none; }
details.qa summary::after {
  content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  color: var(--accent); font-family: var(--mono); font-size: 15px; font-weight: 400; line-height: 1;
}
details.qa[open] summary::after { content: "−"; }
details.qa .answer { padding: 0 18px 16px; color: var(--muted); font-size: 13.8px; }

.related { padding: 38px 0 66px; }
.related h2 { font-family: var(--display); font-size: 19px; margin-bottom: 16px; letter-spacing: -.015em; }
.related-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.related-link {
  display: flex; align-items: center; gap: 11px; padding: 13px 15px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); transition: .16s ease; font-size: 13.5px;
}
.related-link:hover { border-color: var(--accent); color: var(--accent); transform: translate(-1px, -1px); box-shadow: 2px 2px 0 var(--accent-soft); }
.related-link .icon-tile {
  width: 30px; height: 30px; border-radius: 1px; display: grid; place-items: center;
  background: transparent; color: var(--accent); flex: none; border: 1px solid var(--border);
}
.related-link .icon-tile svg { width: 15px; height: 15px; }
.related-link .arrow { margin-left: auto; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.related-link:hover .arrow { color: var(--accent); transform: translateX(2px); }

/* --------------------------------------------------------- footer ------- */
.site-footer { background: #17150f; color: #e8e2d2; border-top: 1px solid #2b271e; padding: 46px 0 26px; margin-top: 10px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 30px; }
.site-footer .brand { color: #f3ecdc; }
.site-footer .brand:hover { color: #f3ecdc; }
.site-footer .brand small { color: #8f8674; }
.site-footer .brand-mark { background: var(--accent); color: #17150f; box-shadow: 2px 2px 0 #4a4437; }
.footer-brand p { color: #a49b88; font-size: 12.8px; margin-top: 14px; max-width: 300px; }
.footer-col h4 {
  font-family: var(--mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: .16em;
  color: #8f8674; margin-bottom: 13px; font-weight: 500;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-col a { color: #cdc4b2; font-size: 12.8px; border-bottom: 1px solid transparent; }
.footer-col a:hover { color: #ff8264; border-bottom-color: #ff8264; }
.footer-bottom {
  margin-top: 34px; padding-top: 18px; border-top: 1px solid #2b271e;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  color: #8f8674; font-family: var(--mono); font-size: 10px; letter-spacing: .04em;
}

/* --------------------------------------------------------- toast -------- */
#toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 14px); z-index: 100;
  background: #17150f; color: #f2ecdc; padding: 11px 18px; border-radius: 2px;
  border: 1px solid #3b362a; font-size: 12.5px; box-shadow: 0 16px 36px rgba(0, 0, 0, .3);
  opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease;
  display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast svg { width: 14px; height: 14px; color: var(--accent); flex: none; }

.hidden { display: none !important; }

/* --------------------------------------------------------- motion ------- */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
.hero-inner > * { animation: riseIn .6s cubic-bezier(.2, .7, .3, 1) both; }
.hero-inner > *:nth-child(1) { animation-delay: .03s; }
.hero-inner > *:nth-child(2) { animation-delay: .08s; }
.hero-inner > *:nth-child(3) { animation-delay: .13s; }
.hero-inner > *:nth-child(4) { animation-delay: .18s; }
.hero-inner > *:nth-child(5) { animation-delay: .23s; }
.hero-inner > *:nth-child(6) { animation-delay: .28s; }
.hero-inner > *:nth-child(7) { animation-delay: .33s; }

.tool-card { animation: riseIn .45s cubic-bezier(.2, .7, .3, 1) both; }
.tool-card:nth-child(2) { animation-delay: .05s; }
.tool-card:nth-child(3) { animation-delay: .1s; }
.tool-card:nth-child(4) { animation-delay: .15s; }
.tool-card:nth-child(5) { animation-delay: .2s; }

.tool-hero .icon-tile { animation: riseIn .5s cubic-bezier(.2, .7, .3, 1) both; }
.tool-hero h1 { animation: riseIn .55s cubic-bezier(.2, .7, .3, 1) .04s both; }
.tool-hero .lead { animation: riseIn .55s cubic-bezier(.2, .7, .3, 1) .09s both; }
.tool-hero .badges { animation: riseIn .55s cubic-bezier(.2, .7, .3, 1) .13s both; }
.tool-panel { animation: riseIn .55s cubic-bezier(.2, .7, .3, 1) .12s both; }

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

/* --------------------------------------------------------- responsive --- */
@media (max-width: 900px) {
  .tool-grid, .feature-grid, .related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .content-card { padding: 24px; }
  .grid-2 { grid-template-columns: 1fr; }
  .tool-card:nth-child(n) { animation-delay: 0s; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .container { padding: 0 16px; }
  .hero { padding: 52px 0 44px; }
  .hero h1 { font-size: clamp(28px, 8vw, 36px); }
  .hero .lead { font-size: 14.5px; }
  .hero-meta { gap: 12px; }
  .hero-inner::before, .hero-inner::after { display: none; }
  .tool-grid, .feature-grid, .related-grid { grid-template-columns: 1fr; }
  .header-nav a.nav-link { display: none; }
  .tool-hero-inner { gap: 14px; }
  .tool-hero .icon-tile { width: 46px; height: 46px; }
  .tool-hero .icon-tile svg { width: 22px; height: 22px; }
  .tool-body { padding: 14px; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat b { font-size: 21px; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .res-row .label { min-width: 76px; }
  .palette { grid-template-columns: repeat(5, 1fr); }
  .palette-wrap { padding-bottom: 0; }
  .swatch:hover::after { content: none; }
  textarea { min-height: 175px; }
  .content-blocks { padding-top: 34px; }
  .content-card { padding: 20px; }
  .content-card h2 { font-size: 19px; }
  .section { padding: 44px 0; }
}

/* --------------------------------------------------------- new tools --- */
.color-line { display: flex; gap: 8px; align-items: center; }
.color-line input[type="color"] { width: 40px; height: 38px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel); cursor: pointer; }
.color-line input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-line input[type="color"]::-webkit-color-swatch { border: none; border-radius: 2px; }
.color-line input[type="text"] { flex: 1; min-width: 0; }

.contrast-preview {
  padding: 26px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  transition: background .15s, color .15s;
}

.img-preview {
  min-height: 140px;
  background: var(--panel-soft) repeating-conic-gradient(var(--border-soft) 0 25%, transparent 0 50%) 0/16px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 8px;
}
.img-preview img { border-radius: 2px; box-shadow: 0 1px 4px rgba(0,0,0,.12); }

.qr-wrap { display: flex; justify-content: center; }
.qr-box {
  display: inline-flex;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}
.qr-box img { display: block; image-rendering: pixelated; max-width: 100%; height: auto; }

@media (max-width: 640px) {
  .color-line { flex-wrap: wrap; }
  .contrast-preview { font-size: 15px; padding: 20px 14px; }
  .img-preview { min-height: 110px; }
}

/* --------------------------------------------------------- ad slots --- */
.ad-slot {
  display: none; /* 广告位隐藏中；恢复时删除此行，并恢复下面的 display: flex */
  position: relative;
  /* display: flex; */
  align-items: center;
  justify-content: center;
  margin: 28px auto;
  max-width: 728px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .04em;
  overflow: hidden;
}
.ad-slot::before {
  content: attr(data-label);
  opacity: .6;
}
.ad-slot[data-label]::after {
  content: "广告位 AD";
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 10px;
  opacity: .4;
}
.ad-slot.banner { min-height: 90px; }
.ad-slot.rect   { min-height: 250px; max-width: 300px; }
.ad-slot.feed   { min-height: 120px; }
.ad-slot.full   { max-width: 100%; }

/* 广告位内的实际广告脚本注入后，移除占位提示 */
.ad-slot > ins, .ad-slot > iframe { position: relative; z-index: 1; }
.ad-slot:has(ins), .ad-slot:has(iframe) { border-style: solid; background: transparent; }
.ad-slot:has(ins)::before, .ad-slot:has(ins)::after,
.ad-slot:has(iframe)::before, .ad-slot:has(iframe)::after { display: none; }

@media (max-width: 640px) {
  .ad-slot { margin: 20px auto; }
  .ad-slot.banner { min-height: 50px; }
  .ad-slot.rect   { min-height: 250px; }
}
