:root {
  --bg: #f6f7f9; --panel: #ffffff; --ink: #14181f; --muted: #5b6472; --line: #e2e5ea; --soft: #eef1f4;
  --accent: #0f766e; --accent-ink: #ffffff; --accent-soft: #e0f2ef;
  --ok: #15803d; --ok-bg: #e7f6ec; --warn: #a16207; --warn-bg: #fdf4dc; --err: #b91c1c; --err-bg: #fdecec;
  --radius: 10px; --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216; --panel: #171b21; --ink: #e8ebef; --muted: #98a2b0; --line: #2a3039; --soft: #1f242c;
    --accent: #2dd4bf; --accent-ink: #062b27; --accent-soft: #123a36;
    --ok: #4ade80; --ok-bg: #11301d; --warn: #facc15; --warn-bg: #3a300c; --err: #f87171; --err-bg: #3b1515;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.7rem, 3.5vw, 2.4rem); margin: 0 0 .4rem; }
h2 { font-size: 1.3rem; margin: 0 0 .6rem; }
h3 { font-size: 1.05rem; margin: 1rem 0 .4rem; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
code, kbd, pre, .mono { font-family: var(--mono); font-size: .92em; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 .4em; background: var(--panel); }

/* header & footer */
.top { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top-in { display: flex; align-items: center; gap: 24px; min-height: 58px; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 1.05rem; }
.logo:hover { text-decoration: none; }
.logo b { color: var(--accent); }
.logo-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: .8rem; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; font-size: .9rem; }
.nav a { color: var(--muted); padding: 6px 10px; border-radius: 6px; }
.nav a:hover { background: var(--soft); color: var(--ink); text-decoration: none; }
.foot { margin-top: 64px; border-top: 1px solid var(--line); background: var(--panel); font-size: .9rem; }
.foot-in { padding: 24px 20px; }
.foot p { margin: .3rem 0; }

/* home */
.hero { padding: 48px 0 24px; text-align: center; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 760px; margin: 0 auto 1rem; }
.tool-head .lead { margin: 0 0 1rem; }
.search { position: relative; max-width: 620px; margin: 24px auto 8px; }
.search input { width: 100%; padding: 14px 48px 14px 18px; font-size: 1.05rem; border-radius: 12px; }
.search kbd { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.count { color: var(--muted); font-size: .9rem; }
.cat { margin-top: 40px; scroll-margin-top: 80px; }
.cat-head { display: flex; align-items: center; gap: 12px; }
.cat-head h2 { margin: 0; }
.pill { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; background: var(--accent-soft); color: var(--accent); padding: 3px 9px; border-radius: 99px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin-top: 14px; }
.card { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.card b { font-size: .98rem; }
.card span { font-size: .86rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.empty { text-align: center; color: var(--muted); padding: 40px; }

/* tool page */
.crumbs { font-size: .88rem; color: var(--muted); margin: 22px 0 14px; }
.crumbs span { margin: 0 4px; }
.tool { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; margin: 8px 0 32px; }
.about, .related { margin-top: 32px; }
.about p { max-width: 820px; color: var(--muted); }

/* form elements */
input[type=text], input[type=search], input[type=number], input[type=url], input[type=email], input[type=date], input[type=time], input[type=password], input[type=datetime-local], select, textarea {
  font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100%; min-width: 0;
}
textarea { font-family: var(--mono); font-size: .9rem; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
input[type=color] { width: 48px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: .88rem; color: var(--muted); min-width: 0; }
.field > span { font-weight: 600; }
.field.wide { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: .9rem; cursor: pointer; align-self: end; padding: 9px 0; }
.opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.opts:empty { display: none; }
.form { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } .top-in { padding: 8px 20px; } .nav { display: none; } .tool { padding: 16px; } }
.lbl { display: flex; align-items: center; justify-content: space-between; font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; min-height: 30px; }
.tools-inline { display: flex; gap: 6px; }
.io { min-height: 220px; }
.io.err, .err-text { color: var(--err); }
.btn { font: inherit; font-size: .92rem; font-weight: 600; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.sm { padding: 4px 10px; font-size: .8rem; font-weight: 500; }
.btn:disabled { opacity: .6; cursor: progress; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.urlrow { display: flex; gap: 10px; margin-bottom: 14px; }
.urlrow input { font-size: 1rem; padding: 11px 14px; }
.urlrow textarea { min-height: 120px; }
@media (max-width: 560px) { .urlrow { flex-direction: column; } }
.stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.stats:empty { display: none; }
.stat { background: var(--soft); border-radius: 8px; padding: 10px 14px; min-width: 110px; }
.stat b { display: block; font-size: 1.35rem; line-height: 1.2; }
.stat span { font-size: .8rem; color: var(--muted); }

/* results */
.result { margin-top: 8px; }
.result:empty { display: none; }
.loading { color: var(--muted); padding: 12px 0; }
.loading::before { content: ""; display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; margin-right: 8px; vertical-align: -2px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.alert { padding: 12px 14px; border-radius: 8px; background: var(--soft); margin: 10px 0; }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.err { background: var(--err-bg); color: var(--err); }
.badge { display: inline-block; font-size: .78rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); }
.tbl-wrap { overflow-x: auto; margin: 10px 0; border: 1px solid var(--line); border-radius: 8px; }
table.tbl { border-collapse: collapse; width: 100%; font-size: .9rem; }
.tbl th, .tbl td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl th { background: var(--soft); font-weight: 600; font-size: .82rem; color: var(--muted); white-space: nowrap; }
.tbl td.wrap-any, .break { word-break: break-all; }
table.kv { border-collapse: collapse; width: 100%; max-width: 640px; }
.kv th, .kv td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.kv th { font-weight: 500; color: var(--muted); width: 50%; }
.kv td { font-weight: 600; font-variant-numeric: tabular-nums; }
.kv tr.big td { font-size: 1.4rem; color: var(--accent); }
pre.code { background: var(--soft); border-radius: 8px; padding: 14px; overflow: auto; max-height: 560px; margin: 8px 0; white-space: pre-wrap; word-break: break-word; }
.preview-box { border: 1px dashed var(--line); border-radius: 8px; padding: 16px; margin: 10px 0; }
.serp { font-family: Arial, sans-serif; max-width: 600px; }
.serp .u { font-size: 14px; color: var(--muted); }
.serp .t { font-size: 20px; color: #1a0dab; margin: 2px 0; }
@media (prefers-color-scheme: dark) { .serp .t { color: #8ab4f8; } }
.serp .d { font-size: 14px; color: var(--muted); }
.social { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; max-width: 520px; background: var(--panel); margin: 10px 0; }
.social img { display: block; width: 100%; aspect-ratio: 1.91 / 1; object-fit: cover; background: var(--soft); }
.social .b { padding: 10px 14px; font-size: .9rem; }
.social .h { font-weight: 700; margin: 2px 0; }
.swatch { width: 100%; height: 120px; border-radius: 10px; border: 1px solid var(--line); }
.hl { background: #fde68a; color: #111; border-radius: 3px; }
.diff-add { background: var(--ok-bg); color: var(--ok); }
.diff-del { background: var(--err-bg); color: var(--err); text-decoration: line-through; }
.diff { font-family: var(--mono); font-size: .88rem; white-space: pre-wrap; word-break: break-word; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.diff div { padding: 1px 10px; }
.canvas-wrap { background: repeating-conic-gradient(var(--soft) 0 25%, transparent 0 50%) 50% / 20px 20px; border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: grid; place-items: center; min-height: 200px; }
.canvas-wrap img, .canvas-wrap svg, .canvas-wrap canvas { max-width: 100%; height: auto; }
.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 28px; text-align: center; color: var(--muted); cursor: pointer; }
.drop.over, .drop:hover { border-color: var(--accent); color: var(--ink); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }
.progress { height: 6px; background: var(--soft); border-radius: 99px; overflow: hidden; margin: 8px 0; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.meter { height: 10px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 99px; }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
details summary { cursor: pointer; font-weight: 600; margin: 8px 0; }
@media print {
  .top, .foot, .crumbs, .tool-head, .about, .related, .no-print { display: none !important; }
  .tool { border: 0; padding: 0; }
  body { background: #fff; }
}
