/* Pandoo — base styles */
:root {
  --bg: #f6f4ee;
  --surface: #ffffff;
  --surface-2: #efece4;
  --ink: #16171b;
  --ink-2: #4a4c55;
  --ink-3: #7b7d86;
  --line: #e2ded3;
  --accent: #ff5a36;
  --accent-ink: #ffffff;
  --accent-soft: #ffe6df;
  --good: #1f8a5b;
  --warn: #b7791f;
  --bad: #c2362b;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(22, 23, 27, .05), 0 8px 24px -12px rgba(22, 23, 27, .12);
  --font-display: "Syne", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --max: 1080px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121316;
    --surface: #1b1c21;
    --surface-2: #24252b;
    --ink: #f1efe9;
    --ink-2: #b9b8b2;
    --ink-3: #8a8a88;
    --line: #2e2f36;
    --accent: #ff6d4d;
    --accent-ink: #160b07;
    --accent-soft: #3a1f18;
    --good: #4cc38a;
    --warn: #e0a84a;
    --bad: #ff6b5e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
img, svg, canvas { max-width: 100%; }
a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; }
h2 { font-size: 1.45rem; font-weight: 700; margin-top: 1.8em; }
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0 0 1em; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 62px; gap: 16px; }
.logo { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; letter-spacing: -0.02em; }
.logo:hover { color: var(--ink); }
.logo-mark { width: 26px; height: 26px; flex: none; }
.logo .tld { color: var(--accent); }
.nav { display: flex; align-items: center; gap: 6px; font-size: .95rem; }
.nav a { text-decoration: none; padding: 6px 10px; border-radius: 999px; color: var(--ink-2); }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.lang-switch { border: 1px solid var(--line); font-weight: 600; color: var(--ink) !important; }

/* Hero (home) */
.hero { padding: 56px 0 28px; }
.hero h1 { max-width: 15ch; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { font-size: 1.15rem; color: var(--ink-2); max-width: 54ch; }
.search { margin-top: 22px; position: relative; max-width: 460px; }
.search input { width: 100%; padding: 14px 16px 14px 44px; font: inherit; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.search svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-3); }

/* Tool grid */
.cat { margin: 34px 0 10px; font-family: var(--font-display); font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 700; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.card { display: flex; flex-direction: column; gap: 6px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; transition: transform .15s ease, border-color .15s ease; }
.card:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--ink); }
.card .ico { width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 1.1rem; margin-bottom: 4px; }
.card strong { font-family: var(--font-display); font-size: 1.05rem; }
.card span { color: var(--ink-2); font-size: .93rem; line-height: 1.45; }
.card[hidden] { display: none; }
.badge-new { align-self: flex-start; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--ink); color: var(--bg); }

/* Tool page */
.crumbs { font-size: .88rem; color: var(--ink-3); padding-top: 22px; }
.crumbs a { color: var(--ink-3); }
.tool-head { padding: 14px 0 18px; }
.tool-head p { font-size: 1.1rem; color: var(--ink-2); max-width: 62ch; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
@media (min-width: 960px) { .layout { grid-template-columns: minmax(0, 1fr) 300px; } }
.sidebar { display: flex; flex-direction: column; gap: 14px; }
.sidebar h3 { font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin: 0; }
.sidebar ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.sidebar li a { display: block; padding: 8px 10px; border-radius: var(--radius-sm); text-decoration: none; color: var(--ink-2); }
.sidebar li a:hover { background: var(--surface-2); color: var(--ink); }
.article { max-width: 70ch; }
.article ol, .article ul { padding-left: 1.2em; }
.article li { margin-bottom: .4em; }
.faq details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::after { content: "+"; color: var(--accent); font-weight: 700; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 10px 0 0; color: var(--ink-2); }
.note { font-size: .9rem; color: var(--ink-3); }

/* Ad slots — collapse while empty */
.ad-slot { margin: 24px 0; min-height: 90px; display: flex; justify-content: center; }
.ad-slot:empty { display: none; }

/* Forms */
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: .88rem; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: .8rem; color: var(--ink-3); }
input[type=text], input[type=number], input[type=url], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px;
}
textarea { min-height: 200px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=color] { width: 100%; height: 42px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); padding: 3px; }
.checks { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.checks label { display: inline-flex; align-items: center; gap: 7px; font-size: .95rem; cursor: pointer; }
.checks input { accent-color: var(--accent); width: 17px; height: 17px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; font: inherit; font-size: .92rem; font-weight: 600; padding: 7px 14px; border-radius: 999px; color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed=true] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; font: inherit; font-weight: 700; padding: 11px 18px; border-radius: 999px; cursor: pointer; background: var(--accent); color: var(--accent-ink); text-decoration: none; }
.btn:hover { filter: brightness(1.05); color: var(--accent-ink); }
.btn.ghost { background: var(--surface-2); color: var(--ink); }
.btn.ghost:hover { color: var(--ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Results */
.results { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px; }
.stat .k { font-size: .82rem; color: var(--ink-3); font-weight: 600; }
.stat .v { font-family: var(--font-display); font-size: 1.45rem; font-weight: 700; line-height: 1.2; word-break: break-word; }
.stat.hero-stat { background: var(--ink); color: var(--bg); }
.stat.hero-stat .k { color: inherit; opacity: .7; }
.output { font-family: var(--font-mono); font-size: 1.15rem; background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 16px; word-break: break-all; min-height: 52px; }
.meter { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.meter > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s ease, background .2s ease; }
.table-wrap { overflow-x: auto; max-height: 420px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 12px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { position: sticky; top: 0; background: var(--surface-2); font-weight: 700; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding-top: 8px; }
.bars > div { flex: 1; display: flex; flex-direction: column-reverse; min-width: 2px; }
.bars .b1 { background: var(--ink-3); }
.bars .b2 { background: var(--accent); }
.legend { display: flex; gap: 16px; font-size: .85rem; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.waterfall { display: flex; flex-direction: column; gap: 8px; }
.waterfall .wl { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: .93rem; }
.waterfall .wl .bar { grid-column: 1 / -1; height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.waterfall .wl .bar i { display: block; height: 100%; background: var(--accent); }
.waterfall .wl.neg span:last-child { color: var(--bad); }
.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 30px; text-align: center; cursor: pointer; color: var(--ink-2); }
.dropzone.over, .dropzone:hover { border-color: var(--accent); color: var(--ink); }
.preview-img { max-height: 260px; border-radius: var(--radius-sm); display: block; margin: 0 auto; }
.timer { font-family: var(--font-display); font-size: clamp(4rem, 16vw, 7rem); font-weight: 800; text-align: center; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.timer-phase { text-align: center; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; font-size: .9rem; }
.dots { display: flex; justify-content: center; gap: 8px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-2); }
.dots i.on { background: var(--accent); }
.ok { color: var(--good); font-weight: 700; }
.err { color: var(--bad); font-weight: 700; }
.qr-out { display: grid; place-items: center; background: var(--surface-2); border-radius: var(--radius); padding: 18px; }
.qr-out canvas { border-radius: 6px; max-width: 100%; height: auto; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; opacity: 0; transition: .2s; pointer-events: none; z-index: 20; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Footer */
.site-footer { margin-top: 80px; border-top: 1px solid var(--line); padding: 32px 0 48px; color: var(--ink-3); font-size: .9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--ink-2); }

.prose { max-width: 70ch; padding: 30px 0; }
.prose h2 { font-size: 1.2rem; }
.notfound { text-align: center; padding: 90px 0; }
.bars span { display: block; }
[hidden] { display: none !important; }
.stack > .seg { align-self: flex-start; }

/* --- v2 components --- */
.sep { border: 0; border-top: 1px solid var(--line); width: 100%; margin: 6px 0; }
.filelist { list-style: decimal; margin: 0; padding-left: 1.4em; display: flex; flex-direction: column; gap: 6px; }
.filelist:empty { display: none; }
.filelist li { padding: 8px 10px; background: var(--surface-2); border-radius: var(--radius-sm); }
.filelist li { display: list-item; }
.filelist li > span:first-child { word-break: break-all; }
.filelist li .row { float: right; }
.icon-btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; width: 30px; height: 30px; cursor: pointer; font: inherit; line-height: 1; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn:hover:not(:disabled) { border-color: var(--accent); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 12px; }
.thumbs a { display: flex; flex-direction: column; gap: 6px; text-decoration: none; font-size: .8rem; color: var(--ink-2); word-break: break-all; }
.thumbs img { width: 100%; aspect-ratio: 3/4; object-fit: contain; background: var(--surface-2); border-radius: var(--radius-sm); }
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.cmp { box-shadow: none; padding: 18px; }
.cmp h3 { margin: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cmp.best { border-color: var(--accent); }
.order { margin: 12px 0 0; padding-left: 1.2em; font-size: .92rem; }
table.edit td { padding: 6px; }
table.edit input { padding: 7px 9px; min-width: 90px; }
table.edit td:first-child input { min-width: 150px; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.swatch { border: 1px solid var(--line); border-radius: var(--radius-sm); min-height: 84px; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; padding: 10px; cursor: pointer; font: inherit; font-size: .85rem; }
.swatch b { font-family: var(--font-mono); }
.sprite-stage { display: grid; place-items: center; background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px; border-radius: var(--radius-sm); overflow: auto; }
.sprite-stage:empty { display: none; }
.sprite-stage canvas { image-rendering: pixelated; max-width: 100%; height: auto; }
.dist { display: flex; align-items: flex-end; gap: 2px; height: 170px; padding-bottom: 18px; }
.dist > div { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; position: relative; min-width: 2px; }
.dist i { display: block; background: var(--ink-3); border-radius: 3px 3px 0 0; }
.dist i.hit { background: var(--accent); }
.dist span { position: absolute; bottom: -18px; left: 0; right: 0; text-align: center; font-size: .68rem; color: var(--ink-3); }
.panel h3 { font-size: 1.05rem; }
input[type=date] { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px; }

/* --- blog --- */
.post-card { gap: 8px; }
.post-card strong { font-size: 1.08rem; line-height: 1.3; }
.post-card em { font-style: normal; margin-top: auto; }
.post { max-width: 760px; }
.post-head { padding: 14px 0 6px; }
.post-head h1 { font-size: clamp(1.9rem, 4.5vw, 2.6rem); }
.post .article { max-width: none; font-size: 1.05rem; }
.post .article p, .post .article li { color: var(--ink); }
.post .article .table-wrap { margin: 0 0 1.2em; }
.post-tools, .post-more { margin-top: 40px; }
.post-tools h2, .post-more h2 { font-size: 1.2rem; }
.sidebar ul + h3, .sidebar h3 + ul { margin-top: 6px; }
.sidebar ul + h3 { margin-top: 18px; }
