:root {
  --paper: #f2eee5;
  --sheet: #fffdf7;
  --ink: #191c1a;
  --green: #72b393;
  --green-dark: #4e7f67;
  --lime: #d8ef74;
  --orange: #ff9c5a;
  --blue: #8eb8ef;
  --violet: #a995e8;
  --shadow: 7px 7px 0 var(--ink);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { min-height: 100vh; margin: 0; overflow-x: hidden; background: var(--paper); color: var(--ink); }
button, input, select, textarea { color: inherit; font: inherit; }
button, label, a { -webkit-tap-highlight-color: transparent; }

.paper-noise {
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  opacity: .13;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.2'/%3E%3C/svg%3E");
}

.tool-header, main, .tool-footer { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }
.tool-header { display: flex; min-height: 84px; align-items: center; justify-content: space-between; border-bottom: 3px solid var(--ink); }
.tool-brand { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; font-weight: 950; }
.tool-brand__mark { display: grid; width: 42px; height: 42px; place-items: center; border: 2px solid var(--ink); border-radius: 9px 13px 8px 15px; background: var(--green); box-shadow: 3px 3px 0 var(--ink); font-size: 20px; }
.tool-brand small { display: block; margin-top: 2px; font-size: 8px; letter-spacing: .12em; }
.tool-header nav { display: flex; gap: 10px; }
.tool-header nav a, .tool-footer a { padding: 8px 11px; border: 1.5px dashed var(--ink); color: inherit; font-size: 11px; font-weight: 900; text-decoration: none; }

.tools-hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(330px, .75fr); gap: clamp(42px, 8vw, 110px); align-items: center; min-height: 640px; padding: 62px 0; }
.tool-kicker { font-size: 10px; font-weight: 950; letter-spacing: .17em; text-transform: uppercase; }
.tools-hero h1 { max-width: 770px; margin: 18px 0 24px; font-size: clamp(61px, 8.5vw, 112px); line-height: .87; letter-spacing: -.085em; }
.tools-hero > div > p { max-width: 650px; margin: 0; font-size: clamp(16px, 2vw, 24px); font-weight: 800; line-height: 1.55; }
.tool-feature-link { display: flex; max-width: 700px; min-height: 66px; gap: 20px; align-items: center; justify-content: space-between; margin-top: 28px; padding: 13px 16px; border: 2px solid var(--ink); background: var(--lime); box-shadow: 4px 4px 0 var(--ink); color: inherit; text-decoration: none; }
.tool-feature-link span, .tool-feature-link b { display: block; }
.tool-feature-link span { font-size: 12px; font-weight: 750; line-height: 1.5; }
.tool-feature-link b { font-size: 10px; letter-spacing: .09em; }
.tool-feature-link strong { font-size: 12px; white-space: nowrap; }
.tool-feature-link--time { margin-top: 10px; background: var(--blue); }
.tool-search { position: relative; display: block; max-width: 700px; margin-top: 35px; }
.tool-search > span { display: block; margin-bottom: 9px; font-size: 11px; font-weight: 950; }
.tool-search input { width: 100%; min-height: 62px; padding: 14px 58px 14px 17px; border: 3px solid var(--ink); border-radius: 4px; background: var(--sheet); box-shadow: 5px 5px 0 var(--ink); font-size: 15px; font-weight: 750; }
.tool-search b { position: absolute; right: 19px; bottom: 12px; font-size: 31px; }

.tool-counter { position: relative; display: grid; min-height: 395px; place-items: center; align-content: center; overflow: hidden; border: 3px solid var(--ink); border-radius: 31px 7px 38px 12px; background: var(--green); box-shadow: 12px 12px 0 var(--ink); transform: rotate(1.4deg); }
.tool-counter::before, .tool-counter::after { position: absolute; inset-inline: 0; height: 3px; background: var(--ink); content: ""; }
.tool-counter::before { top: 45px; } .tool-counter::after { bottom: 45px; }
.tool-counter > span { font-size: 11px; font-weight: 950; letter-spacing: .2em; }
.tool-counter strong { display: flex; align-items: baseline; margin: 22px 0 12px; line-height: .75; }
.tool-counter strong b { font-size: clamp(120px, 17vw, 205px); letter-spacing: -.11em; text-shadow: 5px 5px 0 rgba(255,255,255,.6); }
.tool-counter strong i { font-size: 36px; font-style: normal; }
.tool-counter p { margin: 0; font-size: 12px; font-weight: 900; }
.tool-counter em { position: absolute; right: 25px; bottom: 62px; padding: 7px 9px; border: 2px solid var(--ink); background: var(--lime); font-size: 10px; font-style: normal; font-weight: 950; transform: rotate(-7deg); }

.tool-directory { padding: 52px 0 95px; border-top: 3px solid var(--ink); }
.directory-heading { display: flex; gap: 24px; align-items: end; justify-content: space-between; }
.directory-heading h2, .tool-principles h2 { margin: 10px 0 0; font-size: clamp(38px, 5vw, 64px); line-height: .95; letter-spacing: -.06em; }
.tool-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.tool-filters button { min-height: 39px; padding: 8px 14px; border: 2px solid var(--ink); background: transparent; font-size: 11px; font-weight: 900; cursor: pointer; }
.tool-filters button.is-active { background: var(--lime); box-shadow: 3px 3px 0 var(--ink); }
.directory-status { margin: 20px 0 15px; font-size: 11px; font-weight: 850; }
.tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.tool-card { position: relative; min-height: 245px; padding: 19px; border: 2px solid var(--ink); border-radius: 13px 20px 10px 18px; background: var(--sheet); text-align: left; cursor: pointer; transition: transform .17s ease, box-shadow .17s ease; }
.tool-card:hover, .tool-card:focus-visible { transform: translate(-2px,-3px) rotate(-.4deg); box-shadow: 6px 7px 0 var(--ink); }
.tool-card[data-category="image"] { background: #d9eddf; }
.tool-card[data-category="pdf"] { background: #ffe0cc; }
.tool-card[data-category="content"] { background: #ded6fa; }
.tool-card__top { display: flex; justify-content: space-between; font-size: 10px; font-weight: 950; letter-spacing: .07em; }
.tool-card__top span:last-child { padding: 4px 6px; border: 1.5px solid var(--ink); border-radius: 999px; }
.tool-card h3 { margin: 56px 0 9px; font-size: 23px; line-height: 1.05; letter-spacing: -.045em; }
.tool-card p { max-width: 90%; margin: 0; font-size: 12px; font-weight: 700; line-height: 1.55; }
.tool-card__arrow { position: absolute; right: 17px; bottom: 13px; font-size: 30px; font-weight: 950; }
.empty-search { padding: 35px; border: 2px dashed var(--ink); background: var(--sheet); text-align: center; }
.empty-search strong, .empty-search span { display: block; }
.empty-search span { margin-top: 8px; font-size: 12px; }

.tool-workbench { margin: 20px 0 95px; padding: clamp(25px, 4vw, 48px); border: 3px solid var(--ink); background: var(--sheet); box-shadow: 10px 10px 0 var(--ink); scroll-margin-top: 24px; }
.tool-workbench[hidden] { display: none; }
.workbench-header { display: flex; gap: 25px; align-items: start; justify-content: space-between; }
.workbench-header h2 { margin: 12px 0 10px; font-size: clamp(40px, 6vw, 74px); line-height: .93; letter-spacing: -.07em; }
.workbench-header p { max-width: 720px; margin: 0; font-size: 14px; font-weight: 700; line-height: 1.7; }
.workbench-close { border: 0; background: transparent; font-size: 42px; font-weight: 900; cursor: pointer; }
.privacy-strip { display: flex; gap: 15px; align-items: center; margin: 28px 0; padding: 12px 14px; border: 2px solid var(--ink); background: var(--lime); font-size: 11px; }
.privacy-strip strong { font-size: 12px; }
.workbench-body { display: grid; grid-template-columns: minmax(0,.95fr) minmax(350px,1.05fr); gap: 24px; }
.tool-controls, .tool-output { min-width: 0; padding: clamp(20px,3vw,30px); border: 2px solid var(--ink); background: var(--paper); }
.tool-output { background: #eef5f0; }
.output-label, .control-label { display: block; margin-bottom: 12px; font-size: 10px; font-weight: 950; letter-spacing: .12em; }
.output-placeholder { display: grid; min-height: 300px; place-items: center; align-content: center; text-align: center; }
.output-placeholder b { font-size: 74px; line-height: 1; }
.output-placeholder strong, .output-placeholder span { display: block; }
.output-placeholder span { margin-top: 8px; font-size: 12px; }
.file-field { display: block; padding: 22px; border: 2px dashed var(--ink); background: var(--sheet); cursor: pointer; }
.file-field strong, .file-field span { display: block; }
.file-field span { margin-top: 7px; font-size: 11px; line-height: 1.5; }
.file-field input { width: 100%; margin-top: 14px; font-size: 11px; }
.selected-file-queue { margin-top: 12px; border: 2px solid var(--ink); background: var(--sheet); }
.selected-file-queue[hidden] { display: none; }
.selected-file-queue__header { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1.5px dashed var(--ink); background: var(--lime); }
.selected-file-queue__header strong { font-size: 11px; }
.selected-file-queue button { padding: 6px 8px; border: 1.5px solid var(--ink); background: var(--sheet); font-size: 9px; font-weight: 900; cursor: pointer; }
.selected-file-queue__list { display: grid; max-height: 240px; overflow: auto; }
.selected-file-row { display: flex; min-width: 0; gap: 10px; align-items: center; justify-content: space-between; padding: 9px 11px; border-bottom: 1px solid #c8c6be; }
.selected-file-row:last-child { border-bottom: 0; }
.selected-file-row span { min-width: 0; }
.selected-file-row b, .selected-file-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-file-row b { font-size: 10px; }
.selected-file-row small { margin-top: 3px; font-size: 9px; }
.control-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-top: 16px; }
.control-field { display: block; }
.control-field span { display: block; margin-bottom: 7px; font-size: 11px; font-weight: 900; }
.control-field input, .control-field select, .control-field textarea { width: 100%; min-height: 46px; padding: 10px; border: 2px solid var(--ink); background: var(--sheet); }
.control-field textarea { min-height: 260px; resize: vertical; line-height: 1.65; }
.control-field--wide { grid-column: 1 / -1; }
.control-field[hidden] { display: none; }
.target-presets { display: grid; gap: 9px; margin-top: 16px; padding: 14px; border: 2px solid var(--ink); background: var(--sheet); }
.target-presets > strong { font-size: 11px; }
.target-presets > span { font-size: 10px; line-height: 1.55; }
.target-preset-buttons { display: flex; flex-wrap: wrap; gap: 7px; }
.target-preset-buttons button { min-height: 36px; padding: 7px 10px; border: 1.5px solid var(--ink); background: var(--paper); font-size: 10px; font-weight: 900; cursor: pointer; }
.target-preset-buttons button.is-active { background: var(--lime); box-shadow: 2px 2px 0 var(--ink); }
.compression-advanced { margin-top: 14px; border: 2px solid var(--ink); background: var(--sheet); }
.compression-advanced summary { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 14px; cursor: pointer; list-style-position: inside; }
.compression-advanced summary strong { font-size: 11px; }
.compression-advanced__state { color: #4f514b; font-size: 9px; font-weight: 850; text-align: right; }
.compression-advanced[open] summary { border-bottom: 1.5px dashed var(--ink); background: #edf7f0; }
.compression-advanced__note { margin: 0; padding: 12px 14px 0; font-size: 10px; font-weight: 750; line-height: 1.6; }
.compression-advanced__grid { margin: 0; padding: 12px 14px 14px; }
.tool-button { display: inline-flex; min-height: 50px; align-items: center; justify-content: center; margin-top: 17px; padding: 12px 18px; border: 2px solid var(--ink); background: var(--green); box-shadow: 4px 4px 0 var(--ink); font-weight: 950; cursor: pointer; }
.tool-button:hover { transform: translate(-1px,-1px); box-shadow: 6px 6px 0 var(--ink); }
.tool-button--ghost { background: transparent; box-shadow: none; }
.tool-button:disabled { cursor: wait; opacity: .55; }
.tool-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.result-card { display: grid; gap: 15px; }
.result-card img, .result-card canvas { display: block; width: 100%; max-height: 430px; object-fit: contain; border: 2px solid var(--ink); background: white; }
.utility-result { min-width: 0; }
.utility-output { max-height: 520px; overflow: auto; margin: 18px 0; padding: 18px; border: 1px solid var(--ink); background: var(--sheet); font: 12px/1.7 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; white-space: pre-wrap; }
.color-picker-canvas { display: block; width: auto; max-width: 100%; height: auto; max-height: 620px; margin: 18px 0; border: 1px solid var(--ink); cursor: crosshair; }
.picked-color-swatch { display: inline-block; width: 28px; height: 28px; margin-right: 10px; border: 1px solid var(--ink); vertical-align: middle; }
.picked-color-value { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }
.result-card h3 { margin: 0; font-size: 22px; }
.result-card p { margin: 0; font-size: 12px; line-height: 1.65; }
.result-meta { display: flex; flex-wrap: wrap; gap: 7px; }
.result-meta span { padding: 6px 8px; border: 1.5px solid var(--ink); background: var(--sheet); font-size: 10px; font-weight: 850; }
.image-compare { display: grid; gap: 9px; }
.image-compare__heading { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.image-compare__title { font-size: 11px; }
.image-compare__result { flex: 0 0 auto; padding: 5px 8px; border: 1.5px solid var(--ink); background: var(--lime); font-size: 10px; font-weight: 950; }
.image-compare__result.is-warning { background: #ffcf79; }
.image-compare__stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); border: 2px solid var(--ink); background: var(--sheet); }
.image-compare__stats span { display: grid; gap: 4px; min-width: 0; padding: 9px 10px; }
.image-compare__stats span + span { border-left: 1.5px dashed var(--ink); }
.image-compare__stats small { font-size: 8px; font-weight: 850; }
.image-compare__stats strong { overflow-wrap: anywhere; font-size: 12px; }
.image-compare__verdict { padding: 10px 12px; border-left: 5px solid var(--green-dark); background: #edf7f0; font-size: 10px !important; font-weight: 800; }
.image-compare__verdict.is-lossless { border-left-color: #c38315; background: #fff3c7; }
.image-compare__verdict.is-warning { border-left-color: #b55b16; background: #fff0d4; }
.image-compare__toolbar { display: flex; flex-wrap: wrap; gap: 7px; }
.image-compare__toolbar button { min-height: 34px; padding: 6px 9px; border: 1.5px solid var(--ink); background: var(--sheet); font-size: 9px; font-weight: 900; cursor: pointer; }
.image-compare__toolbar button.is-active { background: var(--lime); box-shadow: 2px 2px 0 var(--ink); }
.image-compare__toolbar .image-compare__zoom { margin-left: auto; background: #fff3c7; }
.image-compare__frame { --compare-position: 50%; position: relative; height: clamp(230px,55vw,380px); overflow: hidden; border: 2px solid var(--ink); background: repeating-conic-gradient(#f0f0ea 0 25%,#fff 0 50%) 0 / 18px 18px; cursor: ew-resize; touch-action: pan-y; }
.image-compare__frame img { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; object-fit: contain; border: 0; background: transparent; transition: transform .18s ease; }
.image-compare__frame.is-zoomed img { transform: scale(2); }
.image-compare__after { clip-path: inset(0 calc(100% - var(--compare-position)) 0 0); }
.image-compare__divider { position: absolute; z-index: 2; top: 0; bottom: 0; left: var(--compare-position); width: 3px; background: var(--ink); box-shadow: 0 0 0 1px white; pointer-events: none; transform: translateX(-50%); }
.image-compare__divider::after { position: absolute; top: 50%; left: 50%; display: grid; width: 34px; height: 34px; place-items: center; border: 2px solid var(--ink); border-radius: 50%; background: var(--lime); box-shadow: 2px 2px 0 var(--ink); content: "↔"; font-size: 17px; font-weight: 950; transform: translate(-50%,-50%); }
.image-compare__before-label, .image-compare__after-label { position: absolute; z-index: 1; bottom: 8px; padding: 5px 7px; border: 1.5px solid var(--ink); background: var(--sheet); font-size: 9px; font-weight: 950; }
.image-compare__before-label { right: 8px; }
.image-compare__after-label { left: 8px; background: var(--lime); }
.image-compare__frame[data-mode="original"] .image-compare__after-label, .image-compare__frame[data-mode="compressed"] .image-compare__before-label { display: none; }
.image-compare > input { width: 100%; accent-color: var(--green-dark); }
.image-compare__slider-hint { display: flex; justify-content: space-between; color: #444; font-size: 8px; font-weight: 850; }
.compression-download-all { justify-self: start; margin-top: 0; }
.compression-preview-host { scroll-margin-top: 18px; }
.compression-result-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 10px; align-items: center; padding: 11px; border: 1.5px solid var(--ink); background: var(--sheet); }
.compression-result-row.is-error { background: #fff0ed; }
.compression-result-main { min-width: 0; }
.compression-result-main strong, .compression-result-main span { display: block; overflow-wrap: anywhere; }
.compression-result-main strong { font-size: 11px; }
.compression-result-main span { margin-top: 4px; font-size: 9px; line-height: 1.5; }
.compression-result-row button { padding: 7px 9px; border: 1.5px solid var(--ink); background: var(--green); font-weight: 900; cursor: pointer; }
.compression-result-actions { display: flex; gap: 6px; }
.compression-result-actions .compression-preview-button { background: var(--sheet); }
.compression-status { padding: 5px 7px; border: 1.5px solid var(--ink); background: var(--lime); font-size: 9px; white-space: nowrap; }
.compression-status.is-warning { background: #ffe08a; }
.compression-status.is-error { background: #ffb5aa; }
.download-list { display: grid; gap: 8px; }
.download-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 9px 10px; border: 1.5px solid var(--ink); background: var(--sheet); font-size: 11px; font-weight: 800; }
.download-row button { padding: 7px 9px; border: 1.5px solid var(--ink); background: var(--green); font-weight: 900; cursor: pointer; }
.redact-canvas { width: 100%; border: 2px solid var(--ink); background: white; touch-action: none; cursor: crosshair; }
.markdown-preview { min-height: 300px; overflow-wrap: anywhere; border: 2px solid var(--ink); background: white; }
.processing-note { padding: 12px; border-left: 5px solid var(--green-dark); background: var(--sheet); font-size: 12px; font-weight: 750; line-height: 1.6; }

.tool-principles { display: grid; grid-template-columns: minmax(0,.7fr) minmax(0,1.3fr); gap: 55px; padding: 65px 0 90px; border-top: 3px solid var(--ink); }
.tool-principles ol { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; margin: 0; padding: 0; list-style: none; }
.tool-principles li { position: relative; min-height: 160px; padding: 18px; border: 2px solid var(--ink); background: var(--sheet); }
.tool-principles li b { position: absolute; top: 15px; right: 15px; font-size: 20px; }
.tool-principles li strong, .tool-principles li span { display: block; max-width: 85%; }
.tool-principles li strong { margin-top: 48px; font-size: 17px; }
.tool-principles li span { margin-top: 7px; font-size: 11px; line-height: 1.55; }
.tool-footer { display: flex; min-height: 92px; gap: 18px; align-items: center; justify-content: space-between; border-top: 3px solid var(--ink); font-size: 11px; font-weight: 850; }
.tool-toast { position: fixed; z-index: 20; right: 22px; bottom: 22px; max-width: min(360px,calc(100% - 44px)); padding: 12px 16px; border: 2px solid var(--ink); background: var(--lime); box-shadow: 4px 4px 0 var(--ink); font-size: 12px; font-weight: 900; opacity: 0; pointer-events: none; transform: translateY(12px); transition: .18s; }
.tool-toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 920px) {
  .tool-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .workbench-body { grid-template-columns: 1fr; }
  .tool-output { min-height: 330px; }
}

@media (max-width: 720px) {
  .tool-header, main, .tool-footer { width: min(100% - 28px,1180px); }
  .tool-header nav a:last-child { display: none; }
  .tools-hero { grid-template-columns: 1fr; min-height: 0; padding: 45px 0 70px; }
  .tools-hero h1 { font-size: clamp(58px,17vw,88px); }
  .tool-counter { min-height: 305px; }
  .tool-counter strong b { font-size: 145px; }
  .directory-heading { align-items: start; flex-direction: column; }
  .tool-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .tool-card { min-height: 220px; }
  .compression-result-row { grid-template-columns: minmax(0,1fr) auto; }
  .compression-result-actions { grid-column: 1 / -1; }
  .compression-result-actions button { flex: 1; }
  .image-compare__toolbar .image-compare__zoom { margin-left: 0; }
  .privacy-strip { align-items: start; flex-direction: column; }
  .tool-principles { grid-template-columns: 1fr; }
  .tool-footer { flex-wrap: wrap; padding: 22px 0; }
}

@media (max-width: 440px) {
  .tool-header { min-height: 72px; }
  .tool-header nav a { padding: 7px; font-size: 9px; }
  .tools-hero h1 { font-size: 56px; }
  .tool-grid { grid-template-columns: 1fr; }
  .tool-card { min-height: 190px; }
  .tool-card h3 { margin-top: 38px; }
  .control-grid { grid-template-columns: 1fr; }
  .control-field--wide { grid-column: auto; }
  .compression-advanced summary { align-items: flex-start; flex-direction: column; }
  .compression-advanced__state { padding-left: 18px; text-align: left; }
  .image-compare__stats strong { font-size: 10px; }
  .tool-principles ol { grid-template-columns: 1fr; }
  .workbench-header h2 { font-size: 42px; }
  .tool-workbench { padding: 20px 15px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
