:root {
  --bg: #F6F3EE;
  --card: #FFFFFF;
  --ink: #23262B;
  --muted: #666B73;
  --line: #D9D3C8;
  --accent: #5C7A63;
  --accent-soft: #E7F0E8;
  --warn-bg: #FFF4D6;
  --warn-ink: #6B5200;
  --bad-bg: #FBE4DE;
  --bad-ink: #8A2F16;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 20px 16px calc(100px + env(safe-area-inset-bottom));
}

h1 { font-size: 26px; line-height: 1.2; margin: 12px 0 8px; }
h2 { font-size: 20px; line-height: 1.25; margin: 0 0 4px; }
p { margin: 0 0 14px; }
.muted { color: var(--muted); font-size: 14px; }
.logo { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); font-weight: 700; }

.btn {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  margin-bottom: 10px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--bad-ink); }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, .tap:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
.link:focus-visible, .card:focus-visible { outline: 3px solid #2F6FBF; outline-offset: 2px; }
.btn input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
label.btn { position: relative; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

.link { background: none; border: 0; padding: 10px 0; color: var(--accent); font: inherit; font-weight: 600;
  text-decoration: underline; cursor: pointer; }

.card {
  display: block;
  width: 100%;
  background: var(--card);
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  text-align: left;
  font: inherit;
  color: inherit;
}
button.card { cursor: pointer; }
.card b { display: block; }

.note { border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; font-size: 14px; }
.note ul { margin: 6px 0 0; padding-left: 18px; }
.note.ok { background: var(--accent-soft); color: #2E4C35; }
.note.warn { background: var(--warn-bg); color: var(--warn-ink); }
.note.bad { background: var(--bad-bg); color: var(--bad-ink); }

details { margin-bottom: 12px; }
summary { cursor: pointer; padding: 12px 0; min-height: 46px; font-weight: 600; color: var(--accent); }

.plan { background: var(--card); border-radius: 14px; padding: 6px; margin-bottom: 12px; }
.plan svg { display: block; width: 100%; height: auto; max-height: 62dvh; }
.plan .tap, .plan .tap-zone { cursor: pointer; }
.plan img { display: block; width: 100%; border-radius: 10px; }

.field { display: block; margin-bottom: 14px; font-weight: 600; font-size: 14px; }
.field input, .field select, .field textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 13px 12px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: 400 17px/1.3 inherit;
  font-family: inherit;
}
.field textarea { min-height: 96px; resize: vertical; }
.field small { display: block; margin-top: 4px; font-weight: 400; color: var(--muted); }

.topbar { display: flex; align-items: center; justify-content: space-between; margin: -6px 0 8px; }

.steps {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  gap: 4px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.steps button { flex: 1; min-width: 0; min-height: 46px; padding: 6px 0 4px; border: 0; border-top: 4px solid var(--line);
  background: none; font: inherit; font-size: 11px; text-align: center; color: var(--muted); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.steps button.done { border-color: #A9C2AE; color: var(--ink); cursor: pointer; }
.steps button.on { border-color: var(--accent); color: var(--ink); font-weight: 700; }
.steps button:focus-visible { outline: 3px solid #2F6FBF; outline-offset: -3px; }

h3 { font-size: 16px; margin: 18px 0 8px; }
.question { border: 0; padding: 0; margin: 0 0 18px; }
.question legend { padding: 0; margin-bottom: 8px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--ink); font: inherit; cursor: pointer; }
.chip:focus-visible { outline: 3px solid #2F6FBF; outline-offset: 2px; }
.chip[aria-pressed=true], .btn[aria-pressed=true] { background: var(--accent-soft); border-color: var(--accent);
  font-weight: 700; }
.card[aria-pressed=true] { box-shadow: inset 0 0 0 2px var(--accent); }
.proscons { margin: 8px 0 0; padding: 0; list-style: none; }
.editor .item { touch-action: none; }
.editor svg { max-height: none; }

.wait { text-align: center; padding: 48px 8px; }
.spinner { width: 44px; height: 44px; margin: 0 auto 18px; border: 4px solid var(--line);
  border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 4s; } }

#sheet-root:empty { display: none; }
.backdrop { position: fixed; inset: 0; background: rgba(20, 22, 26, .45); display: flex; align-items: flex-end;
  justify-content: center; z-index: 10; }
.sheet { width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto; background: var(--bg);
  border-radius: 20px 20px 0 0; padding: 20px 16px calc(16px + env(safe-area-inset-bottom)); }

#toast { position: fixed; left: 16px; right: 16px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 20;
  max-width: 528px; margin: 0 auto; padding: 14px 16px; border-radius: 12px; background: var(--ink); color: #fff;
  font-size: 15px; display: none; }
#toast.show { display: block; }

.sketch-example { background: var(--card); border-radius: 12px; padding: 8px; }
.sketch-example svg { display: block; width: 100%; height: auto; }

.photo { margin: 0 0 14px; }
.photo img { display: block; width: 100%; border-radius: 14px; background: var(--line); aspect-ratio: 3 / 2; object-fit: cover; }
.photo figcaption { margin-top: 6px; }
a.btn { text-decoration: none; }
