:root {
  color-scheme: light;
  --bg: #f5f6f3;
  --surface: #ffffff;
  --surface-subtle: #eef1ec;
  --text: #20231f;
  --muted: #666d63;
  --line: #d7ddd4;
  --green: #1f7456;
  --green-dark: #155840;
  --blue: #27658a;
  --amber: #8a5a12;
  --danger: #b3261e;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --shadow: 0 10px 24px rgba(28, 38, 31, 0.08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 320px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

a { color: var(--blue); }

button, input, select, textarea { font: inherit; color: inherit; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary, .button.primary { border-color: var(--green); background: var(--green); color: #fff; font-weight: 700; }
button.primary:not(:disabled):hover, .button.primary:hover { background: var(--green-dark); }

input[type="text"], input[type="url"], input[type="number"], input[type="datetime-local"], select, textarea {
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
textarea {
  width: 100%;
  min-height: 220px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}
:focus-visible { outline: 3px solid rgba(39, 101, 138, 0.35); outline-offset: 1px; }

.site-shell { display: flex; min-height: 100vh; flex-direction: column; }
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.site-header nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-header nav a { color: var(--text); text-decoration: none; }
.site-header nav a:hover { color: var(--green); }
.brand { font-weight: 800; font-size: 20px; color: var(--green); text-decoration: none; }
.site-main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 24px clamp(16px, 4vw, 40px) 48px; }
.site-foot { padding: 20px clamp(16px, 4vw, 40px); border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

.page-hero h1 { margin: 8px 0 6px; font-size: clamp(26px, 4vw, 34px); }
.page-hero p { margin: 0 0 12px; max-width: 760px; color: var(--muted); }
.breadcrumb { font-size: 13px; color: var(--muted); }

.catalog-section h2 { margin: 28px 0 12px; font-size: 18px; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.tool-card > a, .tool-card.is-planned {
  display: flex;
  height: 100%;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}
.tool-card > a:hover { border-color: var(--green); box-shadow: var(--shadow); }
.tool-card.is-planned { opacity: 0.6; }
.tool-summary { color: var(--muted); font-size: 14px; flex: 1; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid transparent; }
.badge-free { background: #e3f1ea; color: var(--green-dark); }
.badge-credit { background: #fdf1dc; color: var(--amber); }
.badge-api { background: #e2eef6; color: var(--blue); }
.badge-beta { background: #f3e8fb; color: #6b2c91; }
.badge-muted { background: var(--surface-subtle); color: var(--muted); }

.pricing-note { margin-top: 36px; padding: 16px 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.pricing-note h2 { margin-top: 0; font-size: 18px; }

.tool-body { margin-top: 16px; }
.panel { padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.panel + .panel { margin-top: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row + .row, .row + textarea, textarea + .row, .panel > * + * { margin-top: 10px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } }
.label { font-size: 13px; color: var(--muted); }
.mono, pre.output { font-family: var(--mono); font-size: 13px; }
pre.output {
  margin: 0;
  min-height: 120px;
  max-height: 560px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  white-space: pre-wrap;
  word-break: break-word;
}
.status { min-height: 1.5em; font-size: 14px; color: var(--muted); }
.status.is-error { color: var(--danger); }
.status.is-ok { color: var(--green-dark); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.stat { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfa; }
.stat strong { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
table.kv { width: 100%; border-collapse: collapse; font-size: 14px; }
table.kv th, table.kv td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.kv th { width: 34%; color: var(--muted); font-weight: 600; }
table.kv td { font-family: var(--mono); word-break: break-all; }
.dropzone {
  display: grid;
  place-items: center;
  min-height: 140px;
  padding: 20px;
  border: 2px dashed var(--line);
  border-radius: 10px;
  background: #fbfcfa;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
}
.dropzone.is-over { border-color: var(--green); color: var(--green-dark); }
.file-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.file-list li { display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 12px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.file-list img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; background: var(--surface-subtle); }
.file-meta { font-size: 13px; color: var(--muted); word-break: break-all; }
.saving { color: var(--green-dark); font-weight: 700; }
.qr-preview { display: grid; place-items: center; min-height: 260px; }
.qr-preview img { max-width: 100%; height: auto; image-rendering: pixelated; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
details summary { cursor: pointer; font-weight: 600; }
.row > label { max-width: 100%; min-width: 0; }
select { max-width: 100%; min-width: 0; }
.developer-zone { margin-top: 32px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.developer-zone > summary { font-size: 17px; }
