:root {
  --bg: #f7f8f7;
  --surface: #ffffff;
  --text: #1c2321;
  --muted: #5b6763;
  --line: #dfe4e2;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #e3f2ef;
  --great: #15803d;
  --good: #4d7c0f;
  --ok: #b45309;
  --poor: #b91c1c;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111615;
    --surface: #1a2120;
    --text: #e7ecea;
    --muted: #a3afab;
    --line: #2d3735;
    --accent: #2dd4bf;
    --accent-ink: #062b27;
    --accent-soft: #153a35;
    --great: #4ade80;
    --good: #a3e635;
    --ok: #fbbf24;
    --poor: #f87171;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); }
img { max-width: 100%; }
.wrap { max-width: 920px; margin: 0 auto; padding: 0 16px; }

/* header + nav */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--text); margin-right: auto; }
.logo { color: var(--accent); }
.site-nav { display: flex; gap: 20px; align-items: center; }
.site-nav a { text-decoration: none; color: var(--muted); font-weight: 500; }
.site-nav a[aria-current="page"], .site-nav a:hover { color: var(--accent); }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; font-size: 1.2rem; padding: 4px 10px; color: var(--text); cursor: pointer; }
@media (max-width: 780px) {
  .nav-toggle { display: block; }
  .site-nav { display: none; }
  .site-nav.open {
    display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
    position: absolute; top: 60px; left: 0; right: 0; padding: 16px;
    background: var(--surface); border-bottom: 1px solid var(--line); z-index: 10;
  }
  .site-header { position: relative; }
}

/* language switcher: always the last item in the nav row */
.lang { position: relative; }
.lang-btn {
  font: inherit; font-weight: 500; color: var(--muted); background: none; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; white-space: nowrap;
}
.lang-btn:hover, .lang-btn[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }
.lang-menu {
  position: fixed; z-index: 50; margin: 0; padding: 6px; list-style: none; min-width: 180px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .15);
}
.lang-menu:not([hidden]) { display: flex; flex-direction: column; }
.lang-menu[hidden] { display: none; }
.lang-menu a { display: block; padding: 8px 12px; border-radius: 6px; color: var(--text); text-decoration: none; }
.lang-menu a:hover, .lang-menu a[aria-current="true"] { background: var(--accent-soft); color: var(--accent); }

/* hero */
.hero { padding: 32px 0 8px; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.2; margin: 0 0 12px; }
.lead { font-size: 1.1rem; color: var(--muted); margin: 0; max-width: 70ch; }

/* tool */
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 24px 0; }
.drop {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 36px 16px; text-align: center;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop:focus, .drop.drag { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.drop-title { font-size: 1.15rem; font-weight: 600; margin: 0 0 4px; }
.drop-sub { color: var(--muted); margin: 0; font-size: .93rem; }
.link { color: var(--accent); text-decoration: underline; }

.settings { display: flex; flex-wrap: wrap; gap: 16px 32px; margin-top: 20px; align-items: flex-start; }
.mode { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.mode legend { font-weight: 600; margin-bottom: 4px; padding: 0; }
.field { display: inline-flex; flex-direction: column; font-weight: 600; font-size: .9rem; gap: 4px; margin-right: 12px; margin-bottom: 8px; }
input[type=number], select {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text); width: 9em;
}
.presets { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: inherit; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--text); cursor: pointer; }
.chip-on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.hint { color: var(--muted); font-size: .9rem; margin: 0; }

.file-list { list-style: none; padding: 0; margin: 20px 0 0; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: var(--bg); flex: none; }
.file-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta, .file-note { color: var(--muted); font-size: .88rem; }
.file-new { font-size: .9rem; }
.file-error { color: var(--poor); font-size: .9rem; }
.btn { font: inherit; font-weight: 600; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; padding: 10px 18px; cursor: pointer; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-small { padding: 6px 12px; font-size: .9rem; flex: none; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn-icon { background: none; border: 0; color: var(--muted); font-size: 1.4rem; cursor: pointer; padding: 0 4px; flex: none; }
.bulk-actions:not([hidden]) { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.bulk-actions[hidden] { display: none; }
.status { color: var(--muted); margin: 12px 0 0; min-height: 1.2em; }
@media (max-width: 560px) {
  .file-row { flex-wrap: wrap; }
  .file-info { flex-basis: calc(100% - 68px); }
  .btn-small { margin-left: 68px; }
}

/* checker */
.check-results { margin-top: 20px; display: grid; gap: 16px; }
.check-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.check-name { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.check-dpi { font-size: 1.8rem; font-weight: 700; margin: 4px 0 8px; color: var(--accent); }
.check-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0 0 12px; font-size: .93rem; }
.check-facts dt { color: var(--muted); }
.check-facts dd { margin: 0; }
.quality-table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.quality-table th, .quality-table td { text-align: left; padding: 6px 8px; border-top: 1px solid var(--line); }
.q-great { color: var(--great); font-weight: 600; }
.q-good { color: var(--good); font-weight: 600; }
.q-ok { color: var(--ok); font-weight: 600; }
.q-poor { color: var(--poor); font-weight: 600; }

/* calculator */
.calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.calc-box h2 { margin-top: 0; font-size: 1.15rem; }
.calc-result { font-size: 1.05rem; margin: 8px 0 0; }

/* content */
.content { margin: 32px 0; max-width: 72ch; }
.content h2 { font-size: 1.35rem; margin: 0 0 8px; }
.prose { padding-top: 24px; }
.table-wrap { overflow-x: auto; }
.data-table { border-collapse: collapse; width: 100%; font-size: .93rem; background: var(--surface); }
.data-table th, .data-table td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; white-space: nowrap; }
.faq details { border-top: 1px solid var(--line); padding: 10px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 8px 0 0; color: var(--muted); }
.related ul { padding-left: 1.2em; }

/* footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 20px 0; color: var(--muted); font-size: .9rem; }
.footer-row p { margin: 4px 0; }
.site-footer a { color: var(--muted); }
