:root {
  --bg: #f4f6f8; --card: #fff; --text: #1b1f24; --muted: #667085; --line: #d9dee5;
  --accent: #1f6feb; --accent-weak: #e8f0fe; --danger: #c62828;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111418; --card: #1a1f25; --text: #e8ebef; --muted: #98a2b3; --line: #2e3640; --accent: #5b9bff; --accent-weak: #1d2a3d; --danger: #ff6b6b; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; }
main { max-width: 560px; margin: 0 auto; padding: 16px 16px 48px; }
.top h1 { font-size: 24px; margin: 8px 0 4px; }
.sub, .hint { color: var(--muted); font-size: 14px; margin: 4px 0 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 12px 0; }
.card h2 { font-size: 18px; margin: 0 0 12px; }
.card h2 small { font-weight: 400; color: var(--muted); font-size: 13px; }
label { display: block; margin: 10px 0; font-weight: 600; font-size: 15px; }
label b, h2 b { color: var(--danger); }
.label { font-weight: 600; font-size: 15px; margin: 10px 0 6px; }
input:not([type=checkbox]), select {
  display: block; width: 100%; margin-top: 6px; padding: 12px; font-size: 17px; font-weight: 400;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }
.rrn { display: flex; align-items: center; gap: 8px; }
.rrn input { margin-top: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.chip { margin: 0; font-weight: 400; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 15px; cursor: pointer; }
.chip input:checked + span { background: var(--accent-weak); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { width: 22px; height: 22px; flex: none; margin: 0; }
.check.all { border-top: 1px solid var(--line); padding-top: 10px; font-weight: 700; }
details { margin-bottom: 8px; }
summary { color: var(--accent); cursor: pointer; font-size: 14px; }
.terms { white-space: pre-wrap; font-size: 13px; color: var(--muted); background: var(--bg); padding: 10px; border-radius: 8px; margin-top: 8px; max-height: 240px; overflow: auto; }
canvas { width: 100%; height: auto; aspect-ratio: 3 / 1; background: #fff; border: 1px dashed var(--line); border-radius: 10px; touch-action: none; }
button { font: inherit; cursor: pointer; }
.primary { width: 100%; padding: 16px; font-size: 18px; font-weight: 700; background: var(--accent); color: #fff; border: 0; border-radius: 12px; }
.primary:disabled { opacity: .6; }
.ghost { margin-top: 8px; background: none; border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 6px 12px; }
.errors { color: var(--danger); font-size: 15px; }
.errors p { margin: 4px 0; }
.done { text-align: center; padding: 32px 16px; }
.hidden { display: none !important; }

/* ── 2단계 화면 ── */
label small { font-weight: 400; color: var(--muted); }
textarea { display: block; width: 100%; margin-top: 6px; padding: 12px; font: inherit; font-weight: 400; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); resize: vertical; }
.steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 8px 0 4px; }
.steps li { flex: 1; text-align: center; padding: 8px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.steps li.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.addr { display: flex; gap: 8px; align-items: center; }
.addr input { margin-top: 0; }
.addr .ghost { margin: 0; white-space: nowrap; padding: 12px 14px; }
#page1 > .card input + input, .card #address { margin-top: 8px; }
.postcode { position: fixed; inset: 0; z-index: 10; background: #fff; }
.postcode #postcodeWrap { position: absolute; inset: 48px 0 0; }
.postcode #closePostcode { position: absolute; top: 8px; right: 8px; border: 0; background: none; font-size: 22px; color: #111; }
.secondary { width: 100%; padding: 16px; font-size: 18px; font-weight: 700; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: 12px; }
.row2 > .secondary { grid-column: span 1; }
#page2 .row2 { grid-template-columns: 1fr 2fr; }

.teeth svg { width: 100%; max-width: 420px; display: block; margin: 0 auto; }
.tooth { cursor: pointer; outline: none; }
.tooth circle { fill: var(--card); stroke: var(--muted); stroke-width: 1.2; transition: fill .15s; }
.tooth text { font-size: 8.5px; fill: var(--muted); pointer-events: none; }
.tooth:hover circle, .tooth:focus-visible circle { stroke: var(--accent); stroke-width: 2; }
.tooth.on circle { fill: var(--accent); stroke: var(--accent); }
.tooth.on text { fill: #fff; font-weight: 700; }
.arch-label { font-size: 11px; fill: var(--muted); }
.quick { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.quick .ghost { margin-top: 4px; }
.picked { font-size: 14px; color: var(--accent); font-weight: 600; text-align: center; margin: 10px 0 0; }

.cats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cat { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; text-align: left; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); }
.cat .ic { grid-row: span 2; font-size: 24px; align-self: center; }
.cat strong { font-size: 16px; }
.cat small { color: var(--muted); font-size: 13px; }
.cat.on { border-color: var(--accent); background: var(--accent-weak); }
#treatBox { margin-top: 14px; }
#treats { display: flex; flex-wrap: wrap; gap: 8px; }
.treat { padding: 10px 14px; border-radius: 999px; border: 1px solid var(--accent); background: var(--card); color: var(--accent); font-weight: 600; font-size: 15px; }
.treat.flash { background: var(--accent); color: #fff; }
.count { display: inline-block; min-width: 24px; padding: 0 8px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 14px; text-align: center; }
.cart { list-style: none; padding: 0; margin: 0 0 8px; }
.cart li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart li.empty { color: var(--muted); font-size: 14px; justify-content: center; }
.cart .hint { margin: 2px 0 0; }
.tag { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.x { border: 0; background: none; color: var(--muted); font-size: 18px; padding: 6px 10px; }
.done .ok { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 36px; line-height: 64px; }
