:root {
  --ink: #0f1424;
  --muted: #5d6478;
  --line: #e3e6ee;
  --bg: #ffffff;
  --card: #ffffff;
  --soft: #f4f6fb;
  --signal: #144fff;
  --signal-ink: #ffffff;
  --error: #c0262f;
  --ok: #157347;
  --radius: 12px;
  --font: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #eef1f8; --muted: #a1a8bb; --line: #2a3043; --bg: #0f1320; --card: #161b2b; --soft: #1c2234; --signal: #4d7aff;
  }
}
:root[data-theme="dark"] { --ink: #eef1f8; --muted: #a1a8bb; --line: #2a3043; --bg: #0f1320; --card: #161b2b; --soft: #1c2234; --signal: #4d7aff; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.5; font-size: 16px; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; padding-top: 24px; padding-bottom: 32px; border-top: 1px solid var(--line); margin-top: 32px; }
.small p { margin: 6px 0; }
.small-inline { font-size: 13px; margin: 12px 0 0; }
.error { color: var(--error); }
a { color: var(--signal); }
h1 { font-size: clamp(24px, 3.4vw, 36px); line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 12px; }
h2 { font-size: 20px; margin: 0 0 6px; }

.top { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 2; }
.top .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 56px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; text-decoration: none; color: var(--ink); white-space: nowrap; }
.mark { width: 22px; height: 22px; border-radius: 6px; background: var(--signal); position: relative; }
.mark::after { content: ""; position: absolute; left: 4px; right: 4px; bottom: 5px; height: 3px; border-radius: 2px; background: #fff; }
nav.tools { display: flex; gap: 4px; font-size: 14px; overflow-x: auto; scrollbar-width: none; }
nav.tools::-webkit-scrollbar { display: none; }
nav.tools a { padding: 6px 10px; border-radius: 999px; text-decoration: none; color: var(--muted); white-space: nowrap; }
nav.tools a[aria-current="page"] { color: var(--signal); background: var(--soft); font-weight: 600; }
nav.tools { margin-inline-start: auto; }
.lang { position: relative; font-size: 14px; flex: none; }
.lang summary { list-style: none; cursor: pointer; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); white-space: nowrap; }
.lang summary::-webkit-details-marker { display: none; }
.lang summary::after { content: " ▾"; }
.lang[open] summary { color: var(--ink); border-color: var(--signal); }
.lang ul { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 5; margin: 0; padding: 6px; list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .14); max-height: min(70vh, 560px); overflow-y: auto; columns: 2; column-gap: 4px; width: max-content; max-width: calc(100vw - 32px); }
.lang li { break-inside: avoid; }
.lang a { display: block; padding: 5px 10px; text-decoration: none; color: var(--ink); border-radius: 6px; white-space: nowrap; }
.lang a:hover, .lang a:focus-visible { background: var(--soft); }
.lang a[aria-current] { color: var(--signal); font-weight: 600; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (max-width: 720px) {
  .top .wrap { flex-wrap: wrap; padding-bottom: 8px; }
  .lang { order: 2; }
  nav.tools { width: 100%; order: 3; margin-inline-start: 0; }
}

.hero { padding: 36px 0 16px; max-width: 760px; }
.hero p { color: var(--muted); margin: 0; font-size: 17px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 16px 0; }
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 32px 16px; text-align: center; cursor: pointer; display: flex; flex-direction: column; gap: 6px; background: var(--soft); transition: border-color .15s; }
.drop:hover, .drop:focus-visible, .drop.over { border-color: var(--signal); outline: none; }
.drop.busy { opacity: .6; cursor: progress; pointer-events: none; }
.options { margin-top: 16px; }
.hint { font-size: 13px; margin: 10px 0 0; }
.grid { display: grid; gap: 14px; margin-top: 14px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: 1fr 1fr 1fr; }
.grid.four { grid-template-columns: 1fr 1fr 1fr 1fr; }
@media (max-width: 760px) { .grid.three, .grid.four { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .grid.two, .grid.three, .grid.four { grid-template-columns: 1fr; } }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); min-width: 0; }
select, input[type="text"], input[type="number"], input[type="password"], input[type="file"] {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0; width: 100%;
}
input[type="file"] { padding: 6px 8px; font-size: 14px; }
.row { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.wrap-row { flex-wrap: wrap; }
button, .button { font: inherit; font-weight: 600; border-radius: 8px; padding: 9px 16px; cursor: pointer; border: 1px solid var(--line); background: var(--bg); color: var(--ink); text-decoration: none; display: inline-block; }
button.primary, .button.primary { background: var(--signal); color: var(--signal-ink); border-color: var(--signal); }
button.ghost { background: transparent; }
button:disabled { opacity: .5; cursor: not-allowed; }
.bar { position: relative; height: 10px; background: var(--soft); border-radius: 999px; overflow: hidden; margin: 14px 0 28px; }
.bar > div { height: 100%; width: 0; background: var(--signal); transition: width .3s; }
.bar > span { position: absolute; inset-inline-start: 0; top: 14px; font-size: 13px; color: var(--muted); white-space: nowrap; }

.details { margin: 12px 0 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin: 20px 0; }
.tool-card { display: block; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); background: var(--card); transition: border-color .15s; }
.tool-card:hover { border-color: var(--signal); }
.tool-card h2 { color: var(--signal); }
.tool-card p { margin: 0; color: var(--muted); font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 14px; text-decoration: none; color: var(--ink); background: var(--bg); }
.chip:hover { border-color: var(--signal); color: var(--signal); }

.how, .faq, .related { padding: 24px 0 8px; max-width: 760px; }
.how ol { padding-inline-start: 20px; color: var(--muted); }
.how li { margin: 6px 0; }
.faq details { border-top: 1px solid var(--line); padding: 10px 0; }
.faq summary { font-weight: 600; cursor: pointer; }
.faq p { color: var(--muted); margin: 8px 0 0; }

/* image tools */
.small-note { font-size: 13px; }
.preview { margin: 0 0 12px; }
.preview img { display: block; max-width: 100%; max-height: 70vh; margin: 0 auto; border-radius: 8px; }
.compare { position: relative; display: grid; max-width: 100%; margin: 0 auto; width: fit-content; }
.compare img { grid-area: 1 / 1; display: block; max-width: 100%; max-height: 70vh; width: auto; height: auto; border-radius: 8px; }
.compare img.before { width: 100%; height: 100%; object-fit: contain; clip-path: inset(0 calc(100% - var(--pos, 50%)) 0 0); }
.compare::after { content: ""; position: absolute; top: 0; bottom: 0; left: var(--pos, 50%); width: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); pointer-events: none; }
.compare input[type="range"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }
fieldset.segs { border: 0; padding: 0; margin: 0; display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; min-width: 0; }
fieldset.segs legend { font-size: 14px; color: var(--muted); padding: 0; margin-bottom: 6px; }
label.seg { flex-direction: row; align-items: center; gap: 0; position: relative; }
label.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
label.seg span { border: 1px solid var(--line); border-radius: 8px; padding: 8px 18px; color: var(--ink); cursor: pointer; font-weight: 600; }
label.seg input:checked + span { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
label.seg input:focus-visible + span { outline: 2px solid var(--signal); outline-offset: 2px; }
label.seg input:disabled + span { opacity: .4; cursor: not-allowed; }
label.slider > span { display: flex; justify-content: space-between; gap: 8px; }
label.slider output { color: var(--ink); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--signal); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .split { grid-template-columns: 1fr; } }
.pane { border: 1px solid var(--line); border-radius: 8px; min-height: 120px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pane img { display: block; max-width: 100%; max-height: 60vh; }
.checker { background-color: #fff; background-image: linear-gradient(45deg, #eef0f5 25%, transparent 25%), linear-gradient(-45deg, #eef0f5 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #eef0f5 75%), linear-gradient(-45deg, transparent 75%, #eef0f5 75%); background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0; }
.chips .chip { cursor: pointer; font: inherit; font-size: 14px; }
.chips > .muted { align-self: center; font-size: 14px; margin-inline-end: 4px; }
.stage { position: relative; display: grid; width: fit-content; max-width: 100%; margin: 0 auto 12px; }
.stage canvas { grid-area: 1 / 1; display: block; max-width: 100%; max-height: 70vh; width: auto; height: auto; border-radius: 8px; }
.stage canvas.mask { width: 100%; height: 100%; opacity: .5; cursor: crosshair; touch-action: none; }
.progress { margin-top: 8px; }
.progress .row { margin-top: 0; }
