:root {
  --accent: #6b4f2a;
  --ink: #1f1d1a;
  --muted: #6b665e;
  --line: #e3ddd3;
  --bg: #ffffff;
  --soft: #faf7f2;
  --error: #a3261b;
  --ok: #2f6b3a;
  --on-accent: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); }
.wrap { max-width: 640px; margin: 0 auto; padding: 24px 16px 32px; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 1.3rem; margin: 0 0 12px; }
h3 { font-size: 1.05rem; margin: 0 0 10px; }
.lead { color: var(--muted); margin: 0 0 20px; }
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; font-weight: 600; }
.brand img { max-height: 40px; max-width: 160px; }

.drop {
  display: block; border: 2px dashed var(--line); border-radius: 12px; padding: 28px 16px;
  text-align: center; cursor: pointer; background: var(--soft); transition: border-color .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.drop-text small { color: var(--muted); }
.thumbs { display: flex; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.thumbs figure { margin: 0; position: relative; }
.thumbs img { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.thumbs button {
  position: absolute; top: 4px; right: 4px; border: 0; border-radius: 50%; width: 26px; height: 26px;
  background: rgba(0,0,0,.65); color: #fff; cursor: pointer; font-size: 16px; line-height: 26px; padding: 0;
}

fieldset.purpose { border: 0; padding: 0; margin: 16px 0; }
fieldset.purpose legend { font-weight: 600; margin-bottom: 8px; }
fieldset.purpose label { display: inline-flex; align-items: center; gap: 6px; margin: 0 16px 8px 0; }
legend small { color: var(--muted); font-weight: 400; }

.tips { margin: 0 0 18px; color: var(--muted); }
.tips summary { cursor: pointer; }

button, .button {
  display: inline-block; font: inherit; font-weight: 600; border: 0; border-radius: 8px; padding: 12px 22px;
  background: var(--accent); color: var(--on-accent); cursor: pointer; text-decoration: none; text-align: center;
}
button:disabled { opacity: .45; cursor: not-allowed; }
button.link { background: none; color: var(--accent); padding: 8px 0; font-weight: 500; text-decoration: underline; }

.error { color: var(--error); }
.ok { color: var(--ok); font-weight: 600; }

.working { text-align: center; padding: 32px 0; color: var(--muted); }
.spinner {
  width: 36px; height: 36px; border-radius: 50%; margin: 0 auto 12px;
  border: 4px solid var(--line); border-top-color: var(--accent); animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.result { margin-top: 8px; }
.headline { display: flex; gap: 32px; flex-wrap: wrap; padding: 16px; background: var(--soft); border-radius: 12px; margin-bottom: 12px; }
.big { font-size: 1.9rem; font-weight: 700; color: var(--accent); }
.unit { display: block; color: var(--muted); font-size: .9rem; }
.summary { margin: 8px 0 12px; }
.stats { list-style: none; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.stats li { border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.stats b { display: block; font-size: 1.2rem; }
.stats span { color: var(--muted); font-size: .85rem; }
.pieces { margin-bottom: 12px; }
.pieces summary { cursor: pointer; font-weight: 600; }
.pieces li { margin: 6px 0; }
.pieces .tag { font-size: .75rem; padding: 2px 6px; border-radius: 4px; background: var(--soft); border: 1px solid var(--line); margin-left: 6px; color: var(--muted); }
.note { background: var(--soft); border-left: 3px solid var(--accent); padding: 8px 12px; }
.fine { color: var(--muted); font-size: .9rem; }
.next { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 16px; }
.contact { margin-top: 12px; display: grid; gap: 10px; }
.contact label { display: grid; gap: 4px; font-weight: 500; }
.contact input, .contact textarea { font: inherit; padding: 10px; border: 1px solid var(--line); border-radius: 6px; width: 100%; }
.powered { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 28px; }

@media (prefers-color-scheme: dark) {
  :root:not([data-embed]) { --ink: #f2eee8; --muted: #b3ada4; --line: #3a3631; --bg: #1a1816; --soft: #24211e; --accent: #d1a866; --on-accent: #1a1816; }
}
