:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1d1c1a;
  --muted: #6b6862;
  --border: #e2dfd8;
  --accent: #d9622b;
  --accent-text: #ffffff;
  --chip-on: #fbe7dc;
  --checker: #e9e6e0;
  --error: #b3261e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161514;
    --surface: #211f1d;
    --text: #f1eee9;
    --muted: #a39f97;
    --border: #3a3733;
    --accent: #ef7a43;
    --accent-text: #1a0d06;
    --chip-on: #4a2a1a;
    --checker: #2c2a27;
    --error: #ff8a80;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

.site-header { padding: 32px 0 16px; }
.header-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.slogan {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: 600;
  font-size: 16px;
}
.slogan svg { color: var(--accent); flex: none; }
.logo { display: flex; align-items: center; gap: 12px; margin: 0; }
.logo img { display: block; border-radius: 15px; box-shadow: 0 4px 14px rgba(217, 68, 43, 0.35); }
.wordmark {
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: 700;
  font-size: 40px;
  line-height: 1;
  letter-spacing: -0.01em;
}
.wordmark span { color: var(--accent); }
.tagline { margin: 10px 0 0; color: var(--muted); }

@media (max-width: 520px) {
  .logo img { width: 46px; height: 46px; border-radius: 12px; }
  .wordmark { font-size: 32px; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 14px; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.step {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: var(--accent-text);
  font-size: 14px;
}

.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 32px 16px;
  border: 2px dashed var(--border);
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  color: var(--muted);
}
.dropzone strong { color: var(--text); font-size: 16px; }
.dropzone.over, .dropzone:focus-visible { border-color: var(--accent); outline: none; }

.photo-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.photo {
  position: relative;
  width: 84px; height: 84px;
  border-radius: 8px; overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0; background: var(--checker);
}
.photo.selected { border-color: var(--accent); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .remove {
  position: absolute; top: 3px; right: 3px;
  width: 22px; height: 22px; border-radius: 50%;
  border: 0; background: rgba(0, 0, 0, 0.65); color: #fff;
  font-size: 14px; line-height: 22px; cursor: pointer; padding: 0;
}

.group { margin-bottom: 14px; }
.group-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.group-head h3 { margin: 0; font-size: 15px; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font: inherit; font-size: 13px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer; user-select: none;
  font-size: 14px;
}
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip .dims { color: var(--muted); font-size: 12px; }
.chip:has(input:checked) { background: var(--chip-on); border-color: var(--accent); }
.chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip .del { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 0 0 2px; font-size: 15px; }

.custom-size summary { cursor: pointer; color: var(--accent); font-size: 14px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.custom-size form { margin-top: 10px; }
.custom-size input[type="number"] { width: 96px; }

.options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.options > label, .options > div { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input[type="text"], input[type="number"], select {
  font: inherit; color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
}
input[type="color"] { width: 44px; height: 34px; border: 1px solid var(--border); border-radius: 8px; background: none; padding: 2px; }
input[type="range"] { accent-color: var(--accent); }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-size: 14px; }

.watermark { border: 1px solid var(--border); border-radius: 10px; margin: 16px 0 0; padding: 12px 14px 14px; }
.watermark legend { padding: 0 6px; font-size: 14px; }

.note { font-size: 13px; color: var(--muted); margin: 12px 0 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; padding-bottom: 32px; }
.error { color: var(--error); font-size: 14px; }

.previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.preview figure { margin: 0; }
.preview .frame {
  display: grid; place-items: center;
  aspect-ratio: 1;
  border-radius: 8px;
  background-color: var(--checker);
  background-image:
    linear-gradient(45deg, var(--border) 25%, transparent 25%, transparent 75%, var(--border) 75%),
    linear-gradient(45deg, var(--border) 25%, transparent 25%, transparent 75%, var(--border) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
  padding: 8px;
}
.preview canvas { max-width: 100%; max-height: 100%; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); }
.preview figcaption { font-size: 13px; margin-top: 6px; }
.preview figcaption span { color: var(--muted); display: block; font-size: 12px; }

.export-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--border);
}
progress { width: 100%; margin-top: 12px; accent-color: var(--accent); }

.btn {
  font: inherit; font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg); color: var(--text);
  cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); padding: 10px 22px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 520px) {
  .card { padding: 16px; }
  .previews { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Pro ---------- */

.header-right { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pro-btn { padding: 8px 18px; border-radius: 999px; font-family: "Fredoka", system-ui, sans-serif; font-size: 16px; }
.pro-btn.is-pro { background: var(--surface); color: var(--accent); border-color: var(--accent); }

.pro-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent); color: var(--accent-text);
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  vertical-align: 1px;
}
.locked-note { margin: 0 0 12px; }
fieldset :disabled { opacity: 0.55; cursor: not-allowed; }

.pro-dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface); color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.pro-dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
.pro-dialog h2 { margin: 0 0 8px; font-family: "Fredoka", system-ui, sans-serif; font-size: 28px; }
.accent { color: var(--accent); }
.dialog-close { position: absolute; top: 12px; right: 12px; margin: 0; }
.dialog-close button { border: 0; background: none; color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer; }
.pro-reason { margin: 0 0 12px; padding: 10px 12px; border-radius: 8px; background: var(--chip-on); font-size: 14px; }

.benefits { margin: 0 0 16px; padding: 0; list-style: none; }
.benefits li { padding: 4px 0 4px 26px; position: relative; }
.benefits li::before { content: "✓"; position: absolute; left: 4px; color: var(--accent); font-weight: 700; }

.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.plan {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 16px 10px 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  color: var(--text); text-decoration: none;
  cursor: pointer;
}
.plan:hover { border-color: var(--accent); }
.plan.best { border-color: var(--accent); background: var(--chip-on); }
.plan strong { font-family: "Fredoka", system-ui, sans-serif; font-size: 32px; line-height: 1.1; }
.plan em { font-style: normal; font-size: 13px; color: var(--muted); }
.plan .badge {
  position: absolute; top: -11px;
  padding: 2px 10px; border-radius: 999px;
  background: var(--accent); color: var(--accent-text);
  font-size: 11px; font-weight: 700;
}
.plan.unavailable { opacity: 0.6; }
.free-download { width: 100%; margin-top: 12px; }

.license-form { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.license-form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.license-form input { flex: 1; min-width: 0; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.license-form .row { flex-wrap: nowrap; }
.license-msg { margin: 12px 0 0; font-size: 14px; }
.pro-active-line { font-size: 16px; margin: 0 0 12px; }

/* ---------- size guides ---------- */

a.logo { color: inherit; text-decoration: none; }
a { color: var(--accent); }

.breadcrumb { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.breadcrumb a { color: var(--muted); }

.guide-article { line-height: 1.65; }
.guide-article h1 { margin: 0; font-family: "Fredoka", system-ui, sans-serif; font-size: 34px; line-height: 1.15; }
.guide-article h2 { margin: 28px 0 10px; font-size: 21px; }
.guide-article h3 { margin: 18px 0 4px; font-size: 16px; }
.guide-article p { margin: 0 0 12px; }
.guide-article ul { padding-left: 20px; }
.guide-article li { margin-bottom: 6px; }
.updated { color: var(--muted); font-size: 13px; }

.answer {
  display: flex; flex-direction: column; gap: 2px;
  margin: 16px 0 20px; padding: 16px 20px;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: var(--chip-on);
}
.answer-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }
.answer strong { font-family: "Fredoka", system-ui, sans-serif; font-size: 32px; line-height: 1.2; }
.answer span:last-child { color: var(--muted); font-size: 14px; }

.btn.cta, .cta-box .btn { display: inline-block; text-decoration: none; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }

.cta-box {
  margin-top: 28px; padding: 18px 20px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg);
}

.related { columns: 2 240px; padding-left: 18px; margin: 0; }
.related li { margin-bottom: 6px; break-inside: avoid; }

.guide-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 12px; }
.guide-links a { color: var(--muted); }

@media (max-width: 520px) {
  .guide-article h1 { font-size: 27px; }
  .answer strong { font-size: 26px; }
}

/* ---------- photo tips (friendly suggestions, never blockers) ---------- */

.tip-badge {
  position: absolute; bottom: 4px; left: 4px;
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface);
  font-size: 11px; line-height: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.photo-check {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}
.photo-check.all-good { border-color: color-mix(in srgb, #3f9b5b 45%, var(--border)); background: color-mix(in srgb, #3f9b5b 6%, var(--surface)); }
.check-head { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.check-head span { color: var(--muted); font-size: 14px; }
.check-list { list-style: none; margin: 0; padding: 0; }
.check-list > li {
  display: flex; gap: 12px; align-items: flex-start;
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--border);
  cursor: pointer;
}
.check-list img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; flex: none; }
.check-list strong { font-size: 14px; word-break: break-all; }
.check-list strong { font-weight: 600; }
.check-list ul { margin: 2px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }

.bg-status { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.bg-status.error { color: var(--error); }
