:root {
  --paper: #f5f0e8;
  --card: #fffdf9;
  --ink: #1f1a17;
  --ink-2: #5c534c;
  --ink-3: #8f857c;
  --line: #e4dbcf;
  --wood: #3a2a1e;
  --wood-2: #5a412d;
  --accent: #c8372d;
  --accent-ink: #ffffff;
  --accent-soft: #fbe9e6;
  --ok: #2f7a4f;
  --warn-bg: #fff6df;
  --warn-line: #ecd28f;
  --err: #b3261e;
  --err-bg: #fdecea;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(58, 42, 30, 0.06), 0 6px 24px rgba(58, 42, 30, 0.06);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --font: "Noto Sans JP", "Noto Sans KR", system-ui, -apple-system, "Hiragino Sans", sans-serif;
}
:lang(zh) { --font: "Noto Sans SC", "Noto Sans JP", system-ui, -apple-system, "PingFang SC", sans-serif; }
:lang(ko) { --font: "Noto Sans KR", "Noto Sans JP", system-ui, -apple-system, sans-serif; }
.lang button:lang(zh) { font-family: "Noto Sans SC", sans-serif; }
.lang button:lang(ko) { font-family: "Noto Sans KR", sans-serif; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 0 0 calc(96px + env(safe-area-inset-bottom));
}
.app[data-screen="intro"], .app[data-screen="done"] { padding-bottom: 40px; }

/* ---------- brand header ---------- */
.brand {
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 196, 120, 0.18), transparent 60%),
    linear-gradient(180deg, var(--wood) 0%, #2a1e15 100%);
  color: #f7efe4;
  padding: calc(18px + env(safe-area-inset-top)) 20px 18px;
}
.brand__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.wordmark {
  font-family: "Jost", sans-serif;
  font-weight: 300;
  font-size: 24px;
  letter-spacing: 0.32em;
  line-height: 1;
}
.wordmark .dot { position: relative; }
.wordmark .dot::after {
  content: "";
  position: absolute;
  left: 50%; top: 52%;
  width: 6px; height: 6px;
  margin-left: -0.16em;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
}
.wordmark small { font-size: 0.62em; letter-spacing: 0.12em; }
.brand__tag { margin: 8px 0 0; font-size: 12px; letter-spacing: 0.08em; color: rgba(247, 239, 228, 0.72); }
.devbadge {
  display: inline-block; margin: 10px 0 0; padding: 2px 10px;
  border-radius: 999px; background: rgba(255, 255, 255, 0.14); font-size: 11px;
}

.lang { display: flex; background: rgba(255, 255, 255, 0.1); border-radius: 999px; padding: 3px; }
.lang button {
  border: 0; background: transparent; color: rgba(247, 239, 228, 0.78);
  padding: 5px 9px; border-radius: 999px; font-size: 12px; cursor: pointer; white-space: nowrap;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
  min-height: 32px;
}
.lang button.is-on { background: #f7efe4; color: var(--wood); font-weight: 700; }

/* ---------- progress ---------- */
.progress { padding: 16px 20px 4px; }
.progress__meta { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; }
.progress__label { font-weight: 700; }
.progress__count { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.progress__bar { margin-top: 8px; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress__bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.45s var(--ease); }

/* ---------- card ---------- */
.card {
  background: var(--card);
  margin: 12px 16px 0;
  padding: 22px 20px 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.is-entering .card { animation: rise 0.35s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .card { animation: none; } .progress__bar i { transition: none; } }

h1 { font-size: 24px; line-height: 1.4; margin: 0 0 12px; letter-spacing: 0.02em; }
h2 { font-size: 20px; line-height: 1.4; margin: 0 0 18px; }
h3 { font-size: 15px; margin: 0; }
p { margin: 0 0 12px; }
.lead { font-weight: 700; }
.muted { color: var(--ink-3); }

.intro .facts { margin: 18px 0 24px; padding: 14px 16px; border-radius: 12px; background: var(--paper); font-size: 14px; }
.intro .facts div { display: flex; gap: 10px; }
.intro .facts div + div { margin-top: 8px; }
.intro .facts dt { flex: none; }
.intro .facts dd { margin: 0; color: var(--ink-2); }

/* ---------- fields ---------- */
.fields { display: flex; flex-wrap: wrap; gap: 22px 12px; }
.field { width: 100%; margin: 0; padding: 0; border: 0; min-width: 0; }
.field--half { width: calc(50% - 6px); }
legend { padding: 0; }
.label { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-weight: 700; font-size: 15px; line-height: 1.5; margin-bottom: 8px; }
.tag { font-size: 11px; font-weight: 500; padding: 1px 7px; border-radius: 4px; background: var(--line); color: var(--ink-2); }
.tag--req { background: var(--accent-soft); color: var(--accent); }
.hint { font-size: 13px; color: var(--ink-3); margin: -4px 0 8px; line-height: 1.55; }

.input {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 16px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
textarea.input { resize: vertical; line-height: 1.6; }
input[type="date"].input, input[type="datetime-local"].input { min-height: 48px; display: block; }
.input:focus, .select select:focus { outline: none; border-color: var(--wood-2); box-shadow: 0 0 0 3px rgba(90, 65, 45, 0.14); }
.has-err .input, .has-err .select select { border-color: var(--err); }
.other-input { margin-top: 10px; }

.select { position: relative; }
.select::after {
  content: ""; position: absolute; right: 16px; top: 50%; width: 8px; height: 8px;
  border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2);
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}
.select select {
  width: 100%; min-height: 48px; padding: 11px 40px 11px 14px;
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
  font-size: 16px; -webkit-appearance: none; appearance: none;
}

.choices { display: grid; gap: 8px; }
.choices--inline { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.choices--cards { grid-template-columns: 1fr 1fr; }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span {
  display: flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 10px 14px;
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
  font-size: 15px; line-height: 1.45;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.choice span::before {
  content: ""; flex: none; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid #c9bdb0; background: #fff;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); font-weight: 500; }
.choice input:checked + span::before { border-color: var(--accent); box-shadow: inset 0 0 0 4px #fff; background: var(--accent); }
.choice input:focus-visible + span { box-shadow: 0 0 0 3px rgba(200, 55, 45, 0.22); }
.choice--card span { min-height: 64px; justify-content: flex-start; font-weight: 500; }
.has-err .choice span { border-color: #e9b9b5; }
@media (hover: hover) { .choice:hover span { border-color: #cdbfb1; } }

.confirm {
  display: flex; gap: 12px; align-items: flex-start; cursor: pointer;
  padding: 14px; border-radius: 12px; background: var(--paper); border: 1.5px solid transparent;
  font-size: 15px; line-height: 1.55; position: relative;
}
.confirm input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.confirm__box {
  flex: none; width: 22px; height: 22px; margin-top: 1px; border-radius: 6px;
  border: 2px solid #bfb2a4; background: #fff; position: relative;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.confirm input:checked + .confirm__box { background: var(--accent); border-color: var(--accent); }
.confirm input:checked + .confirm__box::after {
  content: ""; position: absolute; left: 6px; top: 2px; width: 6px; height: 11px;
  border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
.confirm input:focus-visible + .confirm__box { box-shadow: 0 0 0 3px rgba(200, 55, 45, 0.22); }
.has-err .confirm { border-color: #e9b9b5; background: var(--err-bg); }

.note {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  background: var(--warn-bg); border: 1px solid var(--warn-line);
  font-size: 14px; color: #6b5420; line-height: 1.6;
}
.err { color: var(--err); font-size: 13px; margin: 6px 0 0; }
.err::before { content: "! "; font-weight: 700; }

.banner { padding: 12px 14px; border-radius: 10px; font-size: 14px; line-height: 1.6; margin: 0 0 18px; }
.banner--err { background: var(--err-bg); color: var(--err); }
.banner--warn { background: var(--warn-bg); color: #6b5420; border: 1px solid var(--warn-line); }

/* ---------- review ---------- */
.review { border-top: 1px solid var(--line); padding: 16px 0 6px; }
.review:first-of-type { margin-top: 8px; }
.review__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.review dl { margin: 0; }
.review .row { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 12px; padding: 7px 0; font-size: 14px; }
.review dt { color: var(--ink-3); line-height: 1.5; }
.review dd { margin: 0; word-break: break-word; line-height: 1.5; }
@media (max-width: 380px) { .review .row { grid-template-columns: 1fr; gap: 0; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 22px; border-radius: 12px; border: 1.5px solid transparent;
  font-weight: 700; font-size: 16px; cursor: pointer;
  transition: transform 0.12s var(--ease), background 0.15s var(--ease), opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: default; transform: none; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn--small { min-height: 34px; padding: 0 14px; font-size: 13px; border-color: var(--line); background: #fff; color: var(--ink-2); border-radius: 999px; }
.btn--block { width: 100%; }
.btn:focus-visible { outline: 3px solid rgba(200, 55, 45, 0.35); outline-offset: 2px; }

.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: 1fr 2fr; gap: 10px;
  max-width: 560px; margin: 0 auto;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(245, 240, 232, 0) 0%, var(--paper) 26%);
}

.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.45); border-top-color: #fff; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- done ---------- */
.done { text-align: center; padding-top: 36px; }
.done__mark svg { width: 72px; height: 72px; margin: 0 auto 14px; display: block; }
.done__mark circle { fill: none; stroke: var(--ok); stroke-width: 2.5; stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw 0.6s var(--ease) forwards; }
.done__mark path { fill: none; stroke: var(--ok); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw 0.4s 0.45s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.done p { color: var(--ink-2); }
.done .btn { margin-top: 12px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 20;
  transform: translate(-50%, 8px); opacity: 0;
  background: var(--ink); color: #fff; font-size: 13px; padding: 9px 16px; border-radius: 999px;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  white-space: nowrap; max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- phase list (status screen) ---------- */
.phase-list {
  list-style: none; margin: 20px 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 0;
}
.phase-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-left: 2px solid var(--line);
  margin-left: 14px;
  padding-left: 20px;
  position: relative;
  color: var(--ink-3);
  font-size: 0.9rem;
}
.phase-item:first-child { padding-top: 0; }
.phase-item:last-child { border-left-color: transparent; }
.phase-dot {
  position: absolute; left: -14px;
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  background: var(--card); border: 2px solid var(--line); color: var(--ink-3);
  flex-shrink: 0;
}
.phase-item.is-done { color: var(--ink-2); border-left-color: var(--ok); }
.phase-item.is-done .phase-dot { background: var(--ok); border-color: var(--ok); color: #fff; font-size: 13px; }
.phase-item.is-active { color: var(--ink); font-weight: 600; }
.phase-item.is-active .phase-dot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.intro .btn + .btn { margin-top: 10px; }
