:root {
  --bg: #f4f1ec;
  --card: #fffdfa;
  --ink: #1d1c1a;
  --muted: #6f6a62;
  --line: #ddd6ca;
  --accent: #7a5c3a;
  --accent-soft: #f1ebe1;
  --main: #2d4739;
  --main-ink: #fbf9f5;
  --main-soft: #e6ece7;
  --gold-soft: #f3ead9;
  --warn: #a4441c;
  --warn-soft: #f8ece4;
  --lock: #bdb6aa;
  --radius: 12px;
  --fs: 20px;
  --serif: "Noto Serif KR", "Nanum Myeongjo", serif;
}
* { box-sizing: border-box; }
html { font-size: var(--fs); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  line-height: 1.65;
  word-break: keep-all;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.big { --fs: 24px; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px; background: rgba(244, 241, 236, 0.94); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { background: none; border: 0; font-family: var(--serif); font-weight: 600; font-size: 1.05rem; letter-spacing: 0.04em; color: var(--ink); padding: 6px 0; }
.topbar-right { display: flex; gap: 14px; align-items: center; }
.brand, .xp, .ghost { white-space: nowrap; }
.xp { color: var(--muted); font-size: 0.85rem; letter-spacing: 0.02em; }
.xp:empty { display: none; }
.ghost { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 4px 12px; font-weight: 600; font-size: 0.9rem; }

main { max-width: 720px; margin: 0 auto; padding: 32px 20px 130px; }
h1, h2 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; line-height: 1.4; margin: 8px 0 16px; }
h2 { font-size: 1.35rem; line-height: 1.4; margin: 4px 0 12px; }
h3 { font-size: 1.05rem; font-weight: 700; margin: 18px 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.eyebrow { font-size: 0.75rem; letter-spacing: 0.18em; color: var(--accent); font-weight: 600; margin: 0 0 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 60px; padding: 12px 28px; border-radius: 8px; border: 1px solid var(--ink);
  background: var(--ink); color: var(--main-ink); font-weight: 600; font-size: 1.02rem; letter-spacing: 0.01em;
  transition: background 0.15s, opacity 0.15s;
}
.btn:hover { background: #33312d; }
.btn:active { opacity: 0.85; }
.btn:disabled { background: var(--lock); border-color: var(--lock); cursor: not-allowed; }
.btn.secondary { background: transparent; color: var(--ink); border-color: var(--lock); }
.btn.secondary:hover { background: var(--accent-soft); }
.btn.wide { width: 100%; }

/* 시작 */
.hero { padding: 28px 0 8px; }
.hero h1 { font-size: 2.1rem; line-height: 1.35; margin-bottom: 18px; }
.hero .lead { font-size: 1.05rem; color: var(--muted); margin-bottom: 28px; }
.hero ol { list-style: none; counter-reset: s; margin: 0 0 24px; padding: 0; border-top: 1px solid var(--line); }
.hero li { counter-increment: s; display: flex; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.hero li::before { content: counter(s, decimal-leading-zero); font-family: var(--serif); color: var(--accent); font-size: 0.95rem; padding-top: 2px; flex: none; }

/* 전체 단계 */
.map { display: flex; flex-direction: column; margin: 20px 0 24px; border-top: 1px solid var(--line); }
.node {
  display: flex; align-items: center; gap: 18px; width: 100%; text-align: left;
  background: none; border: 0; border-bottom: 1px solid var(--line); padding: 18px 17px;
  transition: background 0.15s;
}
.node:not(.locked):hover { background: var(--accent-soft); }
.node .num { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--lock); font-family: var(--serif); font-size: 1rem; flex: none; }
.node .t { font-weight: 600; font-size: 1.08rem; }
.node .s { color: var(--muted); font-size: 0.88rem; }
.node .go { margin-left: auto; font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.node.done .num { background: var(--ink); border-color: var(--ink); color: var(--main-ink); font-size: 0; }
.node.done .num::after { content: "✓"; font-size: 1rem; font-family: system-ui, sans-serif; }
.node.current { background: var(--card); border: 1px solid var(--ink); border-radius: var(--radius); padding: 18px 16px; margin: 10px 0; }
.node.current .num { border-color: var(--ink); border-width: 2px; }
.node.current .s, .node.current .go { color: var(--accent); font-weight: 600; }
.node.locked { opacity: 0.45; cursor: not-allowed; }

/* 질문 */
.quest-head { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.88rem; letter-spacing: 0.02em; }
.progress { height: 3px; background: var(--line); overflow: hidden; margin: 12px 0 28px; }
.progress > i { display: block; height: 100%; background: var(--ink); transition: width 0.4s; }
.help { background: var(--accent-soft); border-left: 2px solid var(--accent); padding: 10px 14px; font-size: 0.92rem; color: #4d463c; }
.options { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 20px 0; }
.opt {
  display: flex; align-items: center; gap: 14px; min-height: 72px; padding: 14px 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; text-align: left; font-weight: 500;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.opt:hover { border-color: var(--lock); }
.opt .e { display: none; }
.opt::before { content: ""; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--lock); flex: none; transition: all 0.15s; }
.opt[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--accent-soft); font-weight: 600; }
.opt[aria-pressed="true"]::before { border-color: var(--ink); background: var(--ink); box-shadow: inset 0 0 0 4px var(--accent-soft); }
.opt small { font-weight: 400; font-size: 0.8rem; }
.field { width: 100%; font: inherit; font-size: 1.2rem; padding: 14px 16px; border: 1px solid var(--lock); border-radius: 8px; background: var(--card); color: var(--ink); }
.field:focus { border-color: var(--ink); }
.num-row { display: flex; align-items: center; gap: 12px; margin: 20px 0; }
.num-row .field { max-width: 200px; text-align: center; font-weight: 600; font-size: 1.4rem; }
.stepper { width: 60px; height: 60px; border-radius: 8px; border: 1px solid var(--lock); background: var(--card); font-size: 1.5rem; font-weight: 400; }
.stepper:hover { background: var(--accent-soft); }
.nav { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(255, 253, 250, 0.96); backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding: 14px 20px; z-index: 4; }
.nav-inner { max-width: 720px; margin: 0 auto; display: flex; gap: 12px; }
.nav-inner .btn { flex: 1; }
.nav-inner .btn.secondary { flex: 0 0 auto; min-width: 110px; }
.speak { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 3px 14px; font-size: 0.82rem; margin-left: auto; white-space: nowrap; flex: none; color: var(--muted); }
.speak:hover { border-color: var(--lock); color: var(--ink); }

.options.three { grid-template-columns: repeat(3, 1fr); }
.caution { background: var(--warn-soft); border-left: 2px solid var(--warn); padding: 12px 16px; font-size: 0.92rem; }
.caution b { color: var(--warn); font-size: 0.8rem; letter-spacing: 0.06em; }
.term { color: var(--muted); font-size: 0.88rem; }
.term b { color: var(--ink); font-weight: 600; }
.spec[hidden] { display: none; }
.spec .field { font-size: 1rem; margin-top: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip-btn { min-height: 48px; padding: 6px 18px; border-radius: 999px; border: 1px solid var(--lock); background: var(--card); font-weight: 500; font-size: 0.95rem; }
.chip-btn[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--main-ink); }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 4px; padding: 8px 0; font-size: 0.9rem; }
.link-btn:hover { color: var(--ink); }
h3.space { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 24px; font-family: var(--serif); font-weight: 600; }

/* 안내 자료·범위·코드 */
.item-photo { display: block; width: 100%; height: min(320px, 36vh); max-height: min(320px, 36vh); object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); margin: 4px 0 14px; background: #fff; }
.hint { font-size: 0.92rem; color: #4d463c; margin: 0 0 12px; }
.hint b { display: inline-block; font-size: 0.75rem; letter-spacing: 0.04em; color: var(--accent); border: 1px solid var(--accent); border-radius: 4px; padding: 0 8px; margin-right: 10px; font-weight: 600; }
.scope-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 0.9rem; color: var(--muted); margin-top: 8px; }
.scope-bar b { color: var(--ink); }
.alert-card { border-left: 2px solid var(--warn); border-radius: 0 var(--radius) var(--radius) 0; }
.alert-card .btn { min-height: 52px; font-size: 0.95rem; padding: 8px 20px; }
.code-box { font-family: var(--serif); font-size: 2.6rem; letter-spacing: 0.3em; text-align: center; background: var(--card); border: 1px solid var(--ink); border-radius: var(--radius); padding: 24px 12px 24px calc(12px + 0.3em); margin: 24px 0 12px; }
.code-input { text-align: center; font-size: 1.8rem; letter-spacing: 0.3em; text-transform: uppercase; }
.link-text { font-size: 0.85rem; color: var(--muted); word-break: break-all; margin: 6px 0 12px; }

/* 단계 완료 */
.reward { text-align: center; padding: 56px 0 30px; }
.done-mark { width: 72px; height: 72px; border-radius: 50%; border: 1px solid var(--ink); display: inline-grid; place-items: center; margin-bottom: 20px; animation: appear 0.5s ease-out; }
.done-mark::after { content: "✓"; font-size: 1.6rem; font-family: system-ui, sans-serif; }
@keyframes appear { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: none; } }

/* 도면 */
.drop {
  display: block; border: 1px dashed var(--lock); border-radius: var(--radius); background: var(--card);
  padding: 40px 16px; text-align: center; cursor: pointer; margin: 20px 0; transition: border-color 0.15s, background 0.15s;
}
.drop:hover { border-color: var(--ink); background: var(--accent-soft); }
.drop .e { display: none; }
.drop b { font-weight: 600; font-size: 1.05rem; }
.drop input { display: none; }
.plan-preview { width: 100%; max-height: 420px; object-fit: contain; background: #fff; border-radius: var(--radius); border: 1px solid var(--line); }
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin: 14px 0; }
.room { background: var(--bg); border-radius: 8px; padding: 12px 14px; }
.room b { display: block; font-weight: 600; }
.room small { color: var(--muted); font-size: 0.8rem; line-height: 1.5; display: block; }
.spinner { width: 44px; height: 44px; border: 2px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: spin 0.9s linear infinite; margin: 24px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 결과 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin: 14px 0; }
.card > h3:first-child { margin-top: 0; }
.total { background: var(--ink); color: var(--main-ink); border-radius: var(--radius); padding: 28px 22px; text-align: center; }
.total > div:first-child { font-size: 0.85rem; letter-spacing: 0.08em; opacity: 0.75; }
.total .n { font-family: var(--serif); font-size: 2.4rem; font-weight: 600; line-height: 1.3; }
.total small { opacity: 0.75; font-size: 0.85rem; }
.notice { background: var(--warn-soft); color: var(--warn); border-left: 2px solid var(--warn); padding: 10px 14px; font-weight: 500; font-size: 0.92rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { padding: 10px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
td.r, th.r { text-align: right; white-space: nowrap; }
td small { color: var(--muted); display: block; }
.judge { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.judge:last-child { border-bottom: 0; padding-bottom: 0; }
.chip { flex: none; border-radius: 4px; padding: 0 8px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em; height: 1.9em; display: inline-flex; align-items: center; vertical-align: middle; }
.chip.good { background: var(--main-soft); color: var(--main); }
.chip.check { background: var(--gold-soft); color: #7a5a1e; }
.chip.warning { background: var(--warn-soft); color: var(--warn); }
ul.clean, ol.clean { padding-left: 1.2em; margin: 0; }
ul.clean li, ol.clean li { margin: 4px 0; }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; border-bottom: 1px solid var(--ink); padding-bottom: 8px; margin: 40px 0 16px; }
.section-title h2 { margin: 0; }
.section-title small { color: var(--muted); font-size: 0.8rem; }

/* 견적 요청서 (업체 제출용) */
.doc { background: #fff; border: 1px solid var(--lock); border-radius: 4px; padding: 28px 22px; margin: 12px 0; font-size: 0.85rem; box-shadow: 0 8px 24px rgba(40, 30, 15, 0.06); }
.doc-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px; border-bottom: 3px double var(--ink); padding-bottom: 10px; margin-bottom: 14px; }
.doc-head h2 { margin: 0; font-size: 1.5rem; letter-spacing: 0.08em; }
.doc table.info { margin: 8px 0 14px; }
.doc table.info th, .doc table.info td { border: 1px solid #a9a39a; padding: 6px 8px; }
.doc table.info th { background: #f4f1ec; width: 7.5em; white-space: nowrap; font-weight: 600; }
.doc table.sign td { min-width: 8em; height: 2.4em; }
.ask { border: 1px solid #a9a39a; background: #faf8f4; border-radius: 2px; padding: 10px 12px; margin: 12px 0; }
.ask ol { margin: 6px 0 0; padding-left: 1.4em; }
.ask li { margin: 3px 0; }
.answer-line { border-bottom: 1px solid #a9a39a; height: 1.8em; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.form { min-width: 680px; font-size: 0.8rem; }
table.form th, table.form td { border: 1px solid #a9a39a; padding: 6px; }
table.form thead th { background: #ebe6dd; white-space: nowrap; font-weight: 600; }
table.form tr.group td { background: #f4f1ec; font-weight: 700; letter-spacing: 0.04em; }
table.form tfoot th { text-align: right; background: #faf8f4; }
table.form .c { text-align: center; white-space: nowrap; }
table.form td.blank { min-width: 6.5em; }
table.form small { color: var(--muted); display: block; }

/* 업체 견적 비교 */
.next-cta { border-color: var(--ink); }
.bid-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.bid-line { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin: 8px 0; }
.bid-inputs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 8px; }
.bid-inputs label { font-size: 0.78rem; color: var(--muted); font-weight: 500; }
.bid-inputs .field { font-size: 1rem; padding: 8px 10px; margin-top: 2px; text-align: right; }
.bid-inputs select.field { text-align: left; }
#bidName { font-size: 1.1rem; margin-top: 4px; }
.cmp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.cmp-grid .card { margin: 0; border-top: 2px solid var(--ink); border-radius: 0 0 var(--radius) var(--radius); }
.cmp-card .n { font-family: var(--serif); font-size: 1.7rem; font-weight: 600; color: var(--ink); margin-top: 6px; line-height: 1.3; }
table.cmp { min-width: 520px; }
table.cmp td.r { min-width: 9em; width: 13em; white-space: normal; }
table.cmp td.r b { white-space: nowrap; }
table.cmp tbody td:nth-child(2) { min-width: 11em; }
table.cmp tbody td:first-child:not([colspan]) { width: 3em; }
table.cmp td.r .chip { margin-left: 2px; }
table.cmp tr.gap td { background: #fbf3ec; }
pre.ask-text { white-space: pre-wrap; font-family: inherit; font-size: 0.92rem; background: var(--bg); border-radius: 8px; padding: 14px; margin: 8px 0 12px; }

.toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--main-ink); padding: 10px 22px; border-radius: 6px; font-size: 0.9rem; opacity: 0; transition: 0.3s; pointer-events: none; z-index: 10; max-width: 90vw; }
.toast.on { opacity: 1; transform: translateX(-50%); }

@media print {
  .topbar, .nav, .row-btns, .screen-only, main > h1, main > .eyebrow { display: none !important; }
  @page { size: A4; margin: 12mm; }
  html { font-size: 13px; }
  body { background: #fff; }
  main { max-width: none; padding: 0; }
  .doc { border: 0; padding: 0; margin: 0; box-shadow: none; }
  .table-wrap { overflow: visible; }
  table.form { min-width: 0; }
  table.form thead { display: table-header-group; }
  table.form tr, .ask, table.info { break-inside: avoid; }
}
@media (max-width: 480px) {
  main { padding: 24px 16px 130px; }
  .topbar { padding: 10px 16px; }
  .topbar-right { gap: 10px; }
  .brand { font-size: 0.95rem; letter-spacing: 0; }
  .xp { font-size: 0.78rem; }
  .ghost { padding: 4px 8px; font-size: 0.8rem; }
  h1 { font-size: 1.5rem; }
  .hero h1 { font-size: 1.7rem; }
  .options, .options.three { grid-template-columns: 1fr; }
  .opt { min-height: 66px; }
  .card { padding: 16px 14px; }
  .doc { padding: 18px 12px; }
  table { font-size: 0.85rem; }
  .bid-inputs { grid-template-columns: 1fr 1fr; }
  .bid-inputs label:last-child { grid-column: 1 / -1; }
  .node .go { display: none; }
}
