/* Layout: one calm reading column; the tool is a single framed workspace: preview on the left, settings and result on the right. */
:root {
  --bg: #f6f7f9; --surface: #ffffff; --ink: #18212b; --muted: #5a6573; --line: #dbe0e6;
  --accent: #0f766e; --accent-ink: #ffffff; --chip: #eef1f4; --focus: #1f5fbf;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #11161c; --surface: #18202a; --ink: #e7ecf1; --muted: #98a4b2; --line: #2b3644;
  --accent: #3dd6c3; --accent-ink: #062320; --chip: #212b37; --focus: #7fb0ff; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #11161c; --surface: #18202a; --ink: #e7ecf1; --muted: #98a4b2; --line: #2b3644;
  --accent: #3dd6c3; --accent-ink: #062320; --chip: #212b37; --focus: #7fb0ff; color-scheme: dark; }

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--font); -webkit-text-size-adjust: 100%; }
a { color: var(--ink); text-decoration-color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.wrap { max-width: 860px; margin: 0 auto; padding-inline: 16px; }
.site-head { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-head .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; padding-block: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 19px; text-decoration: none; }
.brand-mark { width: 30px; height: 24px; border-radius: 5px; border: 2px solid var(--ink); position: relative; overflow: hidden; background: var(--surface); }
.brand-mark::before { content: ""; position: absolute; left: -2px; right: -2px; bottom: -2px; height: 13px; background: var(--accent); clip-path: polygon(0 100%, 35% 20%, 60% 70%, 78% 45%, 100% 100%); }
.brand-mark::after { content: ""; position: absolute; width: 6px; height: 6px; border-radius: 50%; top: 4px; left: 5px; background: var(--ink); }
.nav { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14.5px; }
.nav a { text-decoration: none; color: var(--muted); padding-block: 4px; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }

main { padding-block: 28px 40px; }
.eyebrow { font: 500 12.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin: 0 0 10px; }
h1 { font-size: clamp(27px, 4.6vw, 38px); line-height: 1.15; margin: 0 0 10px; text-wrap: balance; letter-spacing: -.01em; }
h2 { font-size: 21px; margin: 34px 0 8px; text-wrap: balance; }
.lede { color: var(--muted); max-width: 62ch; margin: 0 0 22px; font-size: 17px; }
p, li { max-width: 68ch; }

.tool { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; display: grid; gap: 18px; }
.fields { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label, .field .lbl { font-size: 13px; color: var(--muted); font-weight: 500; }
input, select { font: 500 16px var(--mono); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; min-height: 44px; max-width: 100%; }
input[type=number] { width: 120px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14.5px; min-height: 44px; }
.check input { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); }
.result { border-top: 1px dashed var(--line); padding-top: 18px; display: flex; flex-wrap: wrap; gap: 20px; align-items: center; min-height: 140px; }
.result > * { min-width: 0; }

.answer { font-size: 22px; font-weight: 600; margin: 0 0 4px; line-height: 1.3; }
.answer.big { font-size: clamp(26px, 5vw, 34px); width: 100%; margin: 0; }
.sub { color: var(--muted); margin: 0; font-size: 15px; }
.result .sub { width: 100%; }
.error { color: var(--accent); font-weight: 600; margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; width: 100%; }
.stat { background: var(--chip); border-radius: 6px; padding: 10px 12px; display: grid; gap: 2px; }
.stat-v { font: 600 17px/1.3 var(--mono); font-variant-numeric: tabular-nums; }
.stat-l { font-size: 12.5px; color: var(--muted); }

.links { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; padding: 0; margin: 12px 0 0; list-style: none; }
.links a { display: block; padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); text-decoration: none; font-size: 14.5px; }
.links a:hover { border-color: var(--accent); }
.links .num { font-family: var(--mono); font-weight: 600; }
.note { font-size: 14.5px; color: var(--muted); }
table.ref { border-collapse: collapse; font-size: 14.5px; margin-top: 8px; }
table.ref td, table.ref th { border-bottom: 1px solid var(--line); padding: 7px 14px 7px 0; text-align: left; }
table.ref td.n { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }

/* Ad slots stay empty (zero height) until AdSense code is pasted in. */
.ad { margin: 26px 0; }
.ad:empty { margin: 0; }

.site-foot { border-top: 1px solid var(--line); background: var(--surface); font-size: 14px; color: var(--muted); }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 8px 22px; padding-block: 20px; justify-content: space-between; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.site-foot a { color: var(--muted); }
@media (max-width: 480px) { .tool { padding: 14px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.mono { font-family: var(--mono); }

/* ---------- photo tool ---------- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); font: 600 16px var(--font); cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.08); color: var(--accent-ink); }
.btn[disabled] { opacity: .45; cursor: default; filter: none; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--accent); color: var(--ink); }
.drop { border: 2px dashed var(--line); border-radius: 10px; padding: 34px 18px; display: grid; justify-items: center; gap: 12px; text-align: center; background: var(--bg); transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--accent); background: var(--chip); }
.drop-icon { width: 54px; height: 54px; fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.drop-title { font-size: 19px; font-weight: 600; margin: 0; }
.drop .note { margin: 0; max-width: 46ch; }
.work { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.work[hidden], .drop[hidden] { display: none; }
@media (max-width: 720px) { .work { grid-template-columns: minmax(0, 1fr); } }
.stage-col { display: grid; gap: 10px; min-width: 0; }
.stage { border-radius: 8px; border: 1px solid var(--line); background: var(--bg); display: grid; place-items: center; padding: 10px; min-height: 180px; }
.stage.checker { background-color: var(--surface); background-image: linear-gradient(45deg, var(--chip) 25%, transparent 25%, transparent 75%, var(--chip) 75%), linear-gradient(45deg, var(--chip) 25%, transparent 25%, transparent 75%, var(--chip) 75%);
  background-size: 18px 18px; background-position: 0 0, 9px 9px; }
#pv { max-width: 100%; max-height: 460px; width: auto; height: auto; display: block; box-shadow: 0 0 0 1px var(--line), 0 8px 22px -14px rgba(0,0,0,.45); }
#pv.pannable { cursor: grab; touch-action: none; }
#pv.pannable:active { cursor: grabbing; }
.hint { font-size: 13.5px; color: var(--muted); margin: 0; }
.panel { display: grid; gap: 16px; min-width: 0; }
.ctl { display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-end; padding-bottom: 14px; border-bottom: 1px dashed var(--line); }
.ctl .field { flex: 1 1 130px; }
.ctl .field.wide { flex-basis: 100%; }
.ctl .field input[type=number], .ctl select { width: 100%; }
.field[hidden], .field-row[hidden] { display: none; }
.field-row { display: flex; align-items: flex-end; gap: 8px; flex-basis: 100%; }
.field-row .field { flex: 1 1 0; }
.times { padding-bottom: 11px; color: var(--muted); }
.range { display: flex; align-items: center; gap: 12px; }
.range input { flex: 1; min-height: 0; padding: 0; accent-color: var(--accent); background: none; border: 0; }
.range output { min-width: 52px; text-align: right; font-size: 14px; }
input[type=color] { padding: 4px; width: 64px; height: 44px; }
details.adv { border: 1px solid var(--line); border-radius: 8px; padding: 0 14px; }
details.adv summary { cursor: pointer; padding: 12px 0; font-weight: 500; font-size: 15px; }
details.adv[open] { padding-bottom: 14px; }
.out { display: grid; gap: 10px; }
.out .stats { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
.stat.accent { background: var(--accent); color: var(--accent-ink); }
.stat.accent .stat-l { color: var(--accent-ink); opacity: .85; }
.warn { margin: 0; font-size: 14.5px; padding: 8px 12px; border-radius: 6px; background: var(--chip); border-left: 3px solid var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions .btn { flex: 1 1 auto; }
.spec { border-collapse: collapse; font-size: 15px; margin-top: 8px; }
.spec th, .spec td { text-align: left; padding: 7px 16px 7px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.spec th { font-weight: 500; color: var(--muted); }
ol.steps { padding-left: 1.3em; } ol.steps li { margin-bottom: 4px; }
.guide-box { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 22px 0 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.guide-box .eyebrow { margin: 0; }
.guide-box a { font-weight: 600; }
.guide-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 10px; }
.guide-list a { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); text-decoration: none; }
.guide-list a:hover { border-color: var(--accent); }
.guide-list span { color: var(--muted); font-size: 15px; }
.sources { font-size: 15px; }
img.pin { width: 100%; max-width: 320px; height: auto; border-radius: 8px; border: 1px solid var(--line); }
main .btn { margin-top: 4px; }
