:root {
        color-scheme: light dark;
        --bg: #f6f7f4;
        --surface: #ffffff;
        --surface-2: #eef1ea;
        --ink: #17200f;
        --ink-2: #4c5844;
        --line: #dde3d5;
        --brand: #3f7d0c;
        --brand-strong: #356b09;
        --brand-soft: #e7f3d8;
        --accent: #e9c400;
        --danger: #b3261e;
        --checker-a: #ffffff;
        --checker-b: #d9d9d9;
        --shadow: 0 10px 30px rgba(23, 32, 15, 0.10);
        --radius: 14px;
      }
      @media (prefers-color-scheme: dark) {
        :root {
          --bg: #10130c;
          --surface: #1a1f14;
          --surface-2: #232a1a;
          --ink: #eef3e4;
          --ink-2: #a9b69b;
          --line: #333d27;
          --brand: #8fd14f;
          --brand-strong: #a5dd6d;
          --brand-soft: #26351a;
          --accent: #e9c400;
          --danger: #ff8a80;
          --checker-a: #2c2c2c;
          --checker-b: #1c1c1c;
          --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
        }
      }
      * { box-sizing: border-box; }
      html { scroll-behavior: smooth; }
      body {
        margin: 0;
        background: var(--bg);
        color: var(--ink);
        font-family: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
        line-height: 1.55;
        -webkit-font-smoothing: antialiased;
      }
      button, [role="button"], select, summary, input:not([type="checkbox"], [type="radio"]) { min-height: 2.25rem; }
      button { font: inherit; cursor: pointer; }
      img { max-width: 100%; }
      .wrap { max-width: 1080px; margin: 0 auto; padding: 0 18px; }

      /* ---------- Hero ---------- */
      .hero { padding: 44px 0 8px; text-align: center; }
      .hero h1 {
        font-size: clamp(2rem, 6vw, 3.4rem);
        line-height: 1.08;
        letter-spacing: -0.02em;
        margin: 0 auto 14px;
        max-width: 16em;
        font-weight: 800;
      }
      .hero h1 .hl { background: linear-gradient(transparent 62%, var(--accent) 62%, var(--accent) 94%, transparent 94%); padding: 0 2px; }
      .hero p.lede { color: var(--ink-2); font-size: clamp(1rem, 2.6vw, 1.2rem); max-width: 38em; margin: 0 auto; }
      .trust-row { display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: center; margin: 18px 0 4px; color: var(--ink-2); font-size: 0.92rem; }
      .trust-row span { display: inline-flex; align-items: center; gap: 7px; }
      .trust-row svg { flex: none; }

      /* ---------- Tool card ---------- */
      .tool {
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: 20px;
        box-shadow: var(--shadow);
        margin: 26px auto 10px;
        padding: 20px;
      }
      .dropzone {
        border: 2px dashed var(--line);
        border-radius: var(--radius);
        padding: 40px 20px 30px;
        text-align: center;
        transition: border-color 0.15s, background 0.15s;
        background: var(--surface);
      }
      .dropzone.dragging { border-color: var(--brand); background: var(--brand-soft); }
      .dropzone .dz-icon { margin-bottom: 10px; }
      .dropzone h2 { margin: 0 0 6px; font-size: 1.3rem; }
      .dropzone p { margin: 0 0 18px; color: var(--ink-2); }
      .btn {
        display: inline-flex; align-items: center; justify-content: center; gap: 9px;
        border: 1px solid transparent; border-radius: 10px;
        padding: 10px 22px; font-weight: 700; font-size: 1rem;
        background: var(--brand); color: #fff; text-decoration: none;
        transition: background 0.15s, transform 0.05s;
      }
      @media (prefers-color-scheme: dark) { .btn { color: #131a08; } }
      .btn:hover { background: var(--brand-strong); }
      .btn:active { transform: translateY(1px); }
      .btn.secondary { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
      .btn.secondary:hover { background: var(--brand-soft); }
      .btn.ghost { background: transparent; color: var(--ink-2); border-color: var(--line); }
      .btn:disabled { opacity: 0.55; cursor: wait; }
      .dz-note { margin-top: 14px; font-size: 0.85rem; color: var(--ink-2); }
      .dz-note kbd { background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; font-family: inherit; }

      .samples { margin-top: 22px; }
      .samples p { font-size: 0.9rem; color: var(--ink-2); margin: 0 0 10px; }
      .sample-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
      .sample-btn {
        border: 1px solid var(--line); background: var(--surface); border-radius: 12px;
        padding: 6px; display: flex; flex-direction: column; align-items: center; gap: 6px;
        color: var(--ink); font-size: 0.82rem; font-weight: 600;
      }
      .sample-btn img { width: 92px; height: 92px; object-fit: cover; border-radius: 8px; display: block; }
      .sample-btn:hover { border-color: var(--brand); }

      /* ---------- Editor ---------- */
      .editor { display: none; }
      .editor.on { display: block; }
      .stage {
        position: relative; border-radius: var(--radius); overflow: hidden;
        border: 1px solid var(--line); background: var(--checker-a);
        max-height: 62vh; display: flex; align-items: center; justify-content: center;
      }
      .stage canvas { display: block; max-width: 100%; max-height: 62vh; width: auto; height: auto; }
      .stage .orig-layer {
        position: absolute; inset: 0; margin: auto; max-width: 100%; max-height: 62vh;
        object-fit: contain; pointer-events: none;
      }
      .compare-handle {
        position: absolute; top: 0; bottom: 0; width: 2px; background: #fff;
        box-shadow: 0 0 0 1px rgba(0,0,0,0.35); pointer-events: none; display: none;
      }
      .compare-handle::after {
        content: "↔"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
        background: #fff; color: #17200f; border-radius: 50%; width: 30px; height: 30px;
        display: flex; align-items: center; justify-content: center; font-size: 15px;
        box-shadow: 0 1px 6px rgba(0,0,0,0.4);
      }
      .stage.comparing .orig-layer, .stage.comparing .compare-handle { display: block; }
      .stage.comparing .orig-layer { display: block; }
      .orig-layer { display: none; }

      .progress-box { display: none; text-align: center; padding: 34px 16px; }
      .progress-box.on { display: block; }
      .bar { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; max-width: 420px; margin: 14px auto 8px; }
      .bar i { display: block; height: 100%; width: 0%; background: var(--brand); border-radius: 99px; transition: width 0.25s ease; }
      .progress-box p { color: var(--ink-2); margin: 4px 0; }

      .controls { margin-top: 18px; display: grid; gap: 18px; }
      @media (min-width: 760px) { .controls { grid-template-columns: 1fr 1fr; } }
      .ctl-group h3 { margin: 0 0 9px; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2); }
      .seg { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 4px; gap: 4px; }
      .seg button {
        flex: 1; border: 0; background: transparent; color: var(--ink-2); border-radius: 8px;
        padding: 8px 6px; font-weight: 700; font-size: 0.92rem;
      }
      .seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,0.14); }
      .seg-help { font-size: 0.85rem; color: var(--ink-2); margin: 8px 2px 0; }
      .swatches { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
      .swatch {
        width: 40px; height: 40px; border-radius: 10px; border: 2px solid var(--line);
        padding: 0; position: relative; flex: none;
      }
      .swatch[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
      .swatch.checker { background: conic-gradient(var(--checker-b) 25%, var(--checker-a) 0 50%, var(--checker-b) 0 75%, var(--checker-a) 0); background-size: 14px 14px; }
      .swatch input[type="color"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }
      .slider-row { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
      .slider-row[hidden] { display: none; }
      .slider-row label { font-size: 0.92rem; font-weight: 600; white-space: nowrap; }
      .slider-row output { font-size: 0.88rem; color: var(--ink-2); min-width: 3ch; text-align: right; }
      input[type="range"] { flex: 1; accent-color: var(--brand); min-height: 2.25rem; }
      .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
      .actions .btn { flex: 1 1 auto; }
      .status-line { min-height: 1.4em; font-size: 0.9rem; color: var(--ink-2); margin-top: 12px; }
      .status-line.error { color: var(--danger); font-weight: 600; }

      /* ---------- Sections ---------- */
      section.block { padding: 46px 0 6px; }
      section.block h2 { font-size: clamp(1.5rem, 4vw, 2.1rem); letter-spacing: -0.01em; margin: 0 0 8px; text-align: center; }
      section.block .sub { text-align: center; color: var(--ink-2); max-width: 40em; margin: 0 auto 26px; }
      .steps { display: grid; gap: 14px; }
      @media (min-width: 760px) { .steps { grid-template-columns: repeat(3, 1fr); } }
      .step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
      .step .num {
        width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff;
        display: flex; align-items: center; justify-content: center; font-weight: 800; margin-bottom: 10px;
      }
      @media (prefers-color-scheme: dark) { .step .num { color: #131a08; } }
      .step h3 { margin: 0 0 6px; font-size: 1.05rem; }
      .step p { margin: 0; color: var(--ink-2); font-size: 0.95rem; }
      .uses { display: grid; gap: 14px; }
      @media (min-width: 760px) { .uses { grid-template-columns: repeat(2, 1fr); } }
      .use { display: flex; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
      .use .ic { flex: none; width: 44px; height: 44px; border-radius: 11px; background: var(--brand-soft); display: flex; align-items: center; justify-content: center; }
      .use h3 { margin: 2px 0 4px; font-size: 1rem; }
      .use p { margin: 0; color: var(--ink-2); font-size: 0.93rem; }
      .faq { max-width: 760px; margin: 0 auto; }
      .faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 18px; margin-bottom: 10px; }
      .faq summary { font-weight: 700; cursor: pointer; padding: 10px 0; }
      .faq details p { color: var(--ink-2); margin: 0 0 14px; }
      footer { margin-top: 54px; border-top: 1px solid var(--line); padding: 22px 0 34px; color: var(--ink-2); font-size: 0.9rem; text-align: center; }
      .hidden-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }

      /* ---------- Site header ---------- */
      .site-head {
        position: sticky; top: 0; z-index: 40;
        display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
        padding: 12px 0; margin-bottom: 4px;
        background: var(--bg); border-bottom: 1px solid var(--line);
      }
      .brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 1.06rem; letter-spacing: -0.01em; }
      .brand .brand-mark { width: 32px; height: 32px; border-radius: 9px; background: var(--brand); display: flex; align-items: center; justify-content: center; flex: none; }
      .main-nav { display: flex; flex-wrap: wrap; gap: 4px 6px; }
      .main-nav a { color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 0.92rem; padding: 7px 10px; border-radius: 8px; }
      .main-nav a:hover { color: var(--ink); background: var(--surface-2); }

      /* ---------- Tool tabs ---------- */
      .tool-tabs { display: flex; gap: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 13px; padding: 5px; max-width: 560px; margin: 22px auto 0; }
      .tool-tabs button { flex: 1; border: 0; background: transparent; color: var(--ink-2); border-radius: 9px; padding: 11px 8px; font-weight: 800; font-size: 0.98rem; }
      .tool-tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 5px rgba(0,0,0,0.15); }

      /* ---------- Compressor ---------- */
      .comp-title { margin: 0 0 6px; font-size: 1.35rem; }
      .comp-sub { margin: 0 0 18px; color: var(--ink-2); }
      .comp-grid { display: grid; gap: 18px; }
      @media (min-width: 760px) { .comp-grid { grid-template-columns: 1.15fr 1fr; align-items: start; } }
      .comp-preview { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; max-height: 62vh; }
      .comp-preview img { display: block; max-width: 100%; max-height: 62vh; object-fit: contain; }
      .stat-rows { display: grid; gap: 7px; margin-bottom: 16px; }
      .stat-row { display: flex; justify-content: space-between; gap: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 13px; font-size: 0.94rem; }
      .stat-row b { font-variant-numeric: tabular-nums; }
      .stat-row .saved-good { color: var(--brand); }
      .stat-row .saved-bad { color: var(--danger); }

      /* ---------- Legal / about ---------- */
      .legal { max-width: 760px; margin: 0 auto; text-align: left; }
      .legal h2 { text-align: left !important; }
      .legal p { color: var(--ink-2); margin: 0 0 12px; }
      .legal a { color: var(--brand); font-weight: 600; }

      /* ---------- Full footer ---------- */
      .site-footer { text-align: left; margin-top: 60px; }
      .footer-grid { display: grid; gap: 26px; }
      @media (min-width: 760px) { .footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1fr; } }
      .site-footer h4 { margin: 0 0 10px; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink); }
      .site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
      .site-footer a { color: var(--ink-2); text-decoration: none; }
      .site-footer a:hover { color: var(--brand); text-decoration: underline; }
      .site-footer .foot-brand p { margin: 10px 0 0; max-width: 26em; }
      .footer-bottom { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 6px 20px; justify-content: space-between; }
