:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --ink: #1a1c23;
  --muted: #5b6172;
  --line: #e6e8f0;
  --brand: #3b5bfd;
  --brand-dark: #2a45d6;
  --ok: #15924f;
  --info: #1f6feb;
  --warn: #b45309;
  --radius: 14px;
  --shadow: 0 2px 8px rgba(20, 24, 60, .06), 0 8px 24px rgba(20, 24, 60, .05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}
img { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 18px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), #7b5bff);
  display: grid; place-items: center; color: #fff; font-size: 16px;
}
.nav a { color: var(--muted); font-size: 14px; margin-left: 16px; }

/* Hero */
.hero { padding: 30px 0 8px; }
.hero h1 { font-size: 27px; line-height: 1.25; margin: 0 0 8px; }
.hero p { color: var(--muted); margin: 0 0 14px; font-size: 16px; }
.privacy-pill {
  display: inline-flex; align-items: center; gap: 7px;
  background: #eafaf0; color: var(--ok); border: 1px solid #c7eed6;
  padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
}

/* Card / tool */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin: 16px 0; }

.controls { display: grid; gap: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 140px; }
label { font-size: 13px; font-weight: 600; color: var(--muted); }
select, input[type="number"] {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); width: 100%;
}
select:focus, input:focus { outline: 2px solid var(--brand); border-color: var(--brand); }

.segmented { display: inline-flex; background: #eef0f7; border-radius: 10px; padding: 3px; }
.segmented label {
  padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--muted);
  font-weight: 600; user-select: none;
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented input:checked + span { background: #fff; color: var(--brand); box-shadow: var(--shadow); }
.segmented span { padding: 8px 16px; border-radius: 8px; display: inline-block; }

.spec-bar { background: #f0f3ff; border: 1px dashed #c8d2ff; border-radius: 10px; padding: 10px 14px; font-size: 14px; color: var(--ink); }
.spec-bar .spec-sub { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

.adv-toggle { background: none; border: none; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.adv-panel { margin-top: 10px; }

/* Drop zone */
.drop-zone {
  border: 2px dashed #c2c8db; border-radius: var(--radius); padding: 30px 16px; text-align: center;
  cursor: pointer; background: #fafbff; transition: border-color .15s, background .15s;
}
.drop-zone:hover, .drop-zone.drag { border-color: var(--brand); background: #f0f3ff; }
.drop-zone .big { font-size: 15px; font-weight: 600; }
.drop-zone .small { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* Editor */
.editor-wrap { margin-top: 8px; }
.crop-stage { max-height: 60vh; background: #f0f1f6; border-radius: 10px; overflow: hidden; }
.crop-stage img { max-width: 100%; }
.crop-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }

/* Buttons */
.btn {
  font: inherit; font-weight: 600; border-radius: 10px; padding: 11px 18px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
}
.btn:hover { background: #f3f5fb; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.primary:disabled { background: #aeb6e6; border-color: #aeb6e6; cursor: not-allowed; }
.btn.small { padding: 8px 12px; font-size: 13px; }
.btn.block { width: 100%; }

.status { min-height: 20px; font-size: 14px; color: var(--muted); margin-top: 8px; }
.status.err { color: #c0392b; }

/* Result */
.result { text-align: center; }
.result img { margin: 0 auto 12px; border: 1px solid var(--line); border-radius: 8px; max-height: 280px; width: auto; }
.result .meta { font-size: 15px; margin-bottom: 6px; }
.note { font-size: 14px; border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.note.ok { background: #eafaf0; color: var(--ok); }
.note.info { background: #eaf2ff; color: var(--info); }
.note.warn { background: #fef3e2; color: var(--warn); }
.result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }

/* Content sections */
.section { margin: 26px 0; }
.section h2 { font-size: 20px; margin: 0 0 12px; }
.section h3 { font-size: 16px; margin: 18px 0 6px; }
.steps { padding-left: 18px; }
.steps li { margin: 6px 0; }

.spec-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.spec-table th, .spec-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.spec-table th { color: var(--muted); font-weight: 600; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.grid a {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; font-weight: 600; color: var(--ink); box-shadow: var(--shadow);
}
.grid a:hover { border-color: var(--brand); text-decoration: none; }
.grid a span { display: block; color: var(--muted); font-weight: 400; font-size: 12px; margin-top: 3px; }

details.faq { border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; margin: 8px 0; background: #fff; }
details.faq summary { cursor: pointer; font-weight: 600; padding: 12px 0; list-style: none; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq[open] summary { border-bottom: 1px solid var(--line); }
details.faq p { color: var(--muted); }

.disclaimer { font-size: 13px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--card); margin-top: 30px; padding: 22px 0; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between; color: var(--muted); font-size: 13px; }
.site-footer a { color: var(--muted); }

@media (min-width: 640px) {
  .hero h1 { font-size: 32px; }
}
