:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f1f4f7;
  --text: #16202a;
  --muted: #5b6875;
  --border: #dde3ea;
  --brand: #0f766e;
  --brand-ink: #ffffff;
  --brand-soft: #e6f4f2;
  --accent: #b45309;
  --danger: #b42318;
  --ok: #067647;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419;
    --surface: #171e26;
    --surface-2: #1e2731;
    --text: #e7ecf1;
    --muted: #9aa7b4;
    --border: #2b3642;
    --brand: #2dd4bf;
    --brand-ink: #062a27;
    --brand-soft: #123532;
    --accent: #f59e0b;
    --danger: #f97066;
    --ok: #47cd89;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
a { color: var(--brand); }
img { max-width: 100%; }
.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* header / footer */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 56px; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; }
.logo-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: 15px; }
.main-nav { display: flex; gap: 4px; overflow-x: auto; margin-left: auto; scrollbar-width: none; }
.main-nav a { white-space: nowrap; padding: 6px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 14px; }
.main-nav a:hover { background: var(--surface-2); color: var(--text); }
@media (max-width: 640px) { .main-nav { margin-left: 0; width: 100%; padding-bottom: 8px; } }
.site-footer { margin-top: 48px; background: var(--surface); border-top: 1px solid var(--border); padding: 32px 0 16px; font-size: 14px; color: var(--muted); }
.footer-inner { display: grid; gap: 24px; grid-template-columns: 2fr 1fr 1fr; }
@media (max-width: 720px) { .footer-inner { grid-template-columns: 1fr; } }
.footer-links { display: flex; flex-direction: column; gap: 6px; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--brand); }
.copyright { margin-top: 24px; font-size: 13px; }

/* page head */
.breadcrumb { font-size: 13px; color: var(--muted); margin: 16px 0 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.tool-head h1, .hero h1 { font-size: clamp(26px, 4.5vw, 36px); line-height: 1.2; margin: 8px 0; }
.lead { color: var(--muted); font-size: 17px; margin: 0 0 12px; max-width: 760px; }
.pro-note { font-size: 14px; background: var(--brand-soft); padding: 8px 12px; border-radius: 8px; display: inline-block; margin: 0 0 8px; }

/* hero / cards */
.hero { padding: 32px 0 8px; }
.search { width: 100%; max-width: 620px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 16px; box-shadow: var(--shadow); }
.trust { display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--muted); font-size: 14px; margin-top: 12px; }
.home-cat { margin-top: 32px; }
.home-cat-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.home-cat-head h2 { font-size: 20px; margin: 0 0 12px; }
.card-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.tool-card-link { display: flex; gap: 12px; align-items: flex-start; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); position: relative; transition: border-color .15s, transform .15s; }
.tool-card-link:hover { border-color: var(--brand); transform: translateY(-1px); }
.tool-card-link small { display: block; color: var(--muted); font-size: 13px; line-height: 1.4; margin-top: 2px; }
.tool-icon { font-size: 22px; width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.badge { position: absolute; top: 8px; right: 8px; font-size: 11px; padding: 2px 6px; border-radius: 6px; background: var(--brand-soft); color: var(--brand); }
.tool-card-link.hidden { display: none; }

/* tool area */
.tool { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin: 12px 0 24px; }
@media (max-width: 520px) { .tool { padding: 14px; } }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-2 { display: grid; gap: 20px; grid-template-columns: 1fr 1fr; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }
label, .label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.hint { font-weight: 400; color: var(--muted); font-size: 12px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); font: inherit; font-size: 16px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
input[type="checkbox"], input[type="radio"] { width: auto; margin-right: 6px; }
input[type="range"] { padding: 0; accent-color: var(--brand); }
input[type="file"] { padding: 8px; background: var(--surface-2); }
textarea { min-height: 80px; resize: vertical; }
.check { display: flex; align-items: center; font-weight: 400; font-size: 15px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: transparent; color: var(--text); padding: 8px 14px; font: inherit; font-size: 14px; cursor: pointer; }
.seg button.on { background: var(--brand); color: var(--brand-ink); }
fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin: 0 0 14px; }
legend { font-weight: 700; padding: 0 6px; font-size: 15px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.05); }
.btn.secondary { background: transparent; color: var(--brand); }
.btn.small { padding: 6px 10px; font-size: 14px; }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--border); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

/* results */
.result { margin-top: 18px; padding: 16px; border-radius: var(--radius); background: var(--brand-soft); }
.result-big { font-size: clamp(26px, 5vw, 34px); font-weight: 800; color: var(--brand); line-height: 1.2; }
.result-label { color: var(--muted); font-size: 14px; }
.stats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-top: 12px; }
.stat { background: var(--surface); border-radius: 10px; padding: 10px 12px; }
.stat b { display: block; font-size: 18px; }
.stat span { color: var(--muted); font-size: 13px; }
.bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; margin-top: 12px; background: var(--surface-2); }
.bar i { display: block; height: 100%; }
.bar i:nth-child(1) { background: var(--brand); }
.bar i:nth-child(2) { background: var(--accent); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; background: var(--brand); }
.legend span:nth-child(2)::before { background: var(--accent); }
.table-wrap { overflow-x: auto; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { background: var(--surface-2); font-weight: 600; }
tr.total td { font-weight: 700; }
.winner { color: var(--ok); font-weight: 700; }
.warn { color: var(--accent); font-size: 14px; }
.error { color: var(--danger); font-size: 14px; }
.muted { color: var(--muted); }

/* content */
.content { max-width: 780px; }
.content h2 { font-size: 22px; margin: 28px 0 8px; }
.content h3 { font-size: 18px; margin: 20px 0 6px; }
.content table { margin: 12px 0; }
.content code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 14px; }
.formula { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--brand); padding: 10px 14px; border-radius: 8px; font-family: ui-monospace, Consolas, monospace; font-size: 14px; overflow-x: auto; }
.faq { max-width: 780px; margin-top: 24px; }
.faq h2 { font-size: 22px; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details div { margin-top: 8px; color: var(--muted); }
.related { margin-top: 32px; }
.related h2 { font-size: 20px; }
.updated { color: var(--muted); font-size: 13px; margin-top: 24px; }
.page { padding-top: 16px; }

/* affiliate */
.affiliate { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: center; padding: 14px 16px; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 24px; }
.affiliate p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.affiliate small { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
@media (max-width: 560px) { .affiliate { grid-template-columns: 1fr; } }

/* document editors */
.row-list { display: flex; flex-direction: column; gap: 8px; }
.item-row { display: grid; gap: 8px; grid-template-columns: 1.2fr .8fr 1.2fr 1fr auto; align-items: end; padding: 8px; border-radius: 8px; background: var(--surface-2); }
.item-row .wide { grid-column: 1 / -1; }
.item-row label { font-size: 12px; font-weight: 500; }
.item-row input, .item-row select { padding: 8px; }
@media (max-width: 520px) { .item-row { grid-template-columns: 1fr 1fr; } }
.preview-wrap { overflow-x: auto; background: var(--surface-2); padding: 12px; border-radius: var(--radius); }
.paper { width: 794px; min-height: 400px; margin: 0 auto; background: #fff; color: #111; padding: 40px; font-size: 13px; line-height: 1.45; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.paper table { font-size: 12px; }
.paper th, .paper td { border: 1px solid #cfd6dd; color: #111; padding: 6px 8px; }
.paper thead th { background: #eef2f5; }
.paper h1, .paper h2, .paper h3 { color: #111; margin: 0; }
.paper .wm { margin-top: 24px; text-align: center; color: #8a96a3; font-size: 11px; border-top: 1px dashed #cfd6dd; padding-top: 8px; }
.preview-scale { transform-origin: top left; }

/* image tools */
.drop { border: 2px dashed var(--border); border-radius: var(--radius); padding: 24px; text-align: center; background: var(--surface-2); cursor: pointer; }
.drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop input { display: none; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 12px; }
.thumb { background: var(--surface-2); border-radius: 10px; padding: 8px; font-size: 12px; text-align: center; }
.thumb img, .thumb canvas { max-height: 120px; object-fit: contain; display: block; margin: 0 auto 6px; }
.file-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 6px; }
.file-list li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--surface-2); border-radius: 8px; font-size: 14px; }
.file-list li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preset-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.preset-row button { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 4px 12px; font-size: 13px; cursor: pointer; }
.preset-row button.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.canvas-box { background: repeating-conic-gradient(var(--surface-2) 0% 25%, var(--surface) 0% 50%) 50% / 16px 16px; border-radius: 10px; padding: 8px; text-align: center; }
.canvas-box canvas, .canvas-box img { max-width: 100%; max-height: 420px; }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border-radius: 16px; max-width: 420px; width: 100%; padding: 22px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.modal h3 { margin: 0 0 8px; }
.modal ul { padding-left: 20px; color: var(--muted); }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plan { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.plan b { font-size: 22px; color: var(--brand); }
.plan small { color: var(--muted); font-size: 12px; }
.plan:hover, .plan.best { border-color: var(--brand); }
.plan.best { background: var(--brand-soft); }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 60; font-size: 14px; }
