:root {
  --accent: #0d6b40;
  --accent-soft: #e7f4ec;
  --bg: #fbfaf8;
  --card: #ffffff;
  --text: #1c1b1a;
  --muted: #6b6764;
  --line: #e7e3de;
  --radius: 10px;
  --shadow: none;
  --error: #b3261e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #5cd096;
    --accent-soft: #12261b;
    --bg: #141312;
    --card: #1d1b1a;
    --text: #f2efec;
    --muted: #a29d98;
    --line: #35312e;
    --shadow: none;
    --error: #ff9182;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 0 20px;
}

/* header */
.site-head {
  padding: 28px 0 10px;
}
.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  gap: 9px;
  font-weight: 650;
  letter-spacing: -.01em;
  color: var(--text);
  text-decoration: none;
  font-size: 1.02rem;
}
.brand .dot {
  width: 13px; height: 13px;
  border-radius: 4px;
  background: var(--accent);
}

h1 {
  font-size: clamp(1.6rem, 5.5vw, 2.1rem);
  line-height: 1.2;
  letter-spacing: -.02em;
  margin: 30px 0 10px;
  font-weight: 700;
}
h2 {
  font-size: 1.3rem;
  letter-spacing: -.015em;
  margin: 44px 0 10px;
  font-weight: 650;
}
h3 {
  font-size: 1.03rem;
  margin: 26px 0 6px;
  font-weight: 650;
}
p { margin: 0 0 14px; }
.lead { color: var(--muted); font-size: 1.06rem; margin-bottom: 26px; max-width: 60ch; }
a { color: var(--accent); }

/* card + dropzone */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.drop {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: 44px 22px;
  text-align: center;
  transition: border-color .15s, background .15s;
  cursor: pointer;
}
.drop:focus-visible,
.drop.over {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}
.drop strong { display: block; font-size: 1.08rem; margin-bottom: 4px; }
.drop span { color: var(--muted); font-size: .92rem; }

.btn {
  font: inherit;
  font-weight: 600;
  font-size: .95rem;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn:hover { filter: brightness(1.06); }
.btn.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}
.btn.small { padding: 8px 14px; font-size: .88rem; flex: none; }

/* controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin: 18px 0 0;
  align-items: flex-end;
}
.field { flex: 1 1 220px; }
.field label {
  display: block;
  font-size: .9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
select, input[type=range] {
  font: inherit;
  width: 100%;
  accent-color: var(--accent);
}
input[type=range] { height: 44px; }
select {
  min-height: 44px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
}
.hint { font-size: .85rem; color: var(--muted); margin: 8px 0 0; }

/* results */
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
[hidden] { display: none !important; }
.results { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; }
.item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.item img {
  width: 52px; height: 52px;
  object-fit: cover;
  border-radius: 9px;
  background: var(--accent-soft);
  flex: none;
}
.item .meta { min-width: 0; flex: 1; }
.item .name {
  font-weight: 600;
  font-size: .94rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item .sizes { font-size: .86rem; color: var(--muted); }
.saved { color: var(--accent); font-weight: 600; }

/* faq */
.faq h3 { margin-top: 24px; }
.faq p { color: var(--muted); }

/* Ad slots.
   Height is reserved at every breakpoint so the page does not move when an ad
   loads (CLS = 0). If you change the unit size served, change the min-height here
   to match, otherwise the reservation is wrong and CLS comes back.
   The dashed placeholder chrome only applies while the slot is :empty — insert
   the real <ins> tag and it disappears on its own, no CSS change needed. */
.ad-slot {
  margin: 40px 0;
  min-height: 280px; /* mobile: 300x250 rectangle */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.ad-slot:empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}
.ad-slot:empty::before {
  content: "Advertisement";
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}
@media (min-width: 700px) {
  .ad-slot { min-height: 100px; } /* desktop: 728x90 leaderboard */
}

/* Wide-screen skyscraper. Fixed position, so it can never push content around;
   hidden entirely below 1240px because there is no room beside the 780px column. */
.ad-slot--side { display: none; }
@media (min-width: 1240px) {
  .ad-slot--side {
    display: flex;
    position: fixed;
    top: 96px;
    left: calc(50% + 410px);
    width: 160px;
    min-height: 600px;
    margin: 0;
  }
}

footer {
  margin-top: 60px;
  padding: 24px 0 40px;
  border-top: 1px solid var(--line);
  font-size: .9rem;
  color: var(--muted);
}
footer nav { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 8px; }
footer nav a { display: inline-flex; align-items: center; min-height: 44px; }

.notice {
  margin: 14px 0 0;
  font-size: .92rem;
  color: var(--muted);
}

@media (max-width: 520px) {
  body { font-size: 16px; }
  .card, .drop { padding: 18px; }
  .item { gap: 11px; }
}

/* ---- text, code and result blocks (shared by every tool on this site) ---- */
textarea,
input[type=text], input[type=number], input[type=url],
input[type=email], input[type=datetime-local], input[type=color] {
  font: inherit;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
}
input[type=color] { padding: 4px; min-width: 64px; }
textarea { min-height: 170px; resize: vertical; line-height: 1.5; }
textarea.code, .out, code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9rem; }
code { background: var(--accent-soft); border-radius: 4px; padding: 1px 5px; }

.io { display: grid; gap: 16px; margin: 18px 0 0; }
@media (min-width: 860px) { .io.two { grid-template-columns: 1fr 1fr; } }
.io label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 6px; }

.out {
  margin: 0;
  padding: 12px 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 170px;
  max-height: 62vh;
  overflow: auto;
}
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
.err { color: var(--error); font-weight: 600; font-size: .92rem; margin: 12px 0 0; }
.err:empty { display: none; }

/* result counters */
.stats { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 10px;
         grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); }
.stats li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stats b { display: block; font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.stats span { color: var(--muted); font-size: .85rem; }

/* key/value result tables */
.kv { border-collapse: collapse; width: 100%; margin-top: 10px; font-size: .94rem; }
.kv th, .kv td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.kv th { width: 36%; font-weight: 600; color: var(--muted); }
.kv td { overflow-wrap: anywhere; }

/* hub list of tools */
.tool-list { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; }
@media (min-width: 700px) { .tool-list { grid-template-columns: 1fr 1fr; } }
.tool-list a {
  display: block;
  min-height: 44px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
}
.tool-list a:hover, .tool-list a:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.tool-list strong { display: block; }
.tool-list span { color: var(--muted); font-size: .88rem; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
