:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #16181d;
  --muted: #6b7280;
  --line: #e4e7ec;
  --accent: #2563eb;
  --accent-ink: #ffffff;
  --accent-soft: #e8efff;
  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --maybe: #b45309;
  --maybe-soft: #fdf3e2;
  --no: #6b7280;
  --no-soft: #eef0f3;
  --hot: #dc2626;
  --hot-soft: #fdecec;
  --lh: #0f766e;
  --sh: #1d4ed8;
  --gh: #7c3aed;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1e222b;
    --text: #e8eaef;
    --muted: #9aa3b2;
    --line: #2a2f3a;
    --accent: #5b8cff;
    --accent-ink: #0b1020;
    --accent-soft: #1c2742;
    --ok: #4ade80;
    --ok-soft: #13291c;
    --maybe: #fbbf24;
    --maybe-soft: #2e2412;
    --no: #9aa3b2;
    --no-soft: #22262f;
    --hot: #f87171;
    --hot-soft: #331818;
    --lh: #2dd4bf;
    --sh: #7aa2ff;
    --gh: #b794f6;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115; --surface: #171a21; --surface-2: #1e222b; --text: #e8eaef; --muted: #9aa3b2; --line: #2a2f3a;
  --accent: #5b8cff; --accent-ink: #0b1020; --accent-soft: #1c2742; --ok: #4ade80; --ok-soft: #13291c;
  --maybe: #fbbf24; --maybe-soft: #2e2412; --no: #9aa3b2; --no-soft: #22262f; --hot: #f87171; --hot-soft: #331818;
  --lh: #2dd4bf; --sh: #7aa2ff; --gh: #b794f6; --shadow: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  word-break: keep-all; overflow-wrap: anywhere;
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px 96px; }
.muted { color: var(--muted); }
.center { text-align: center; }
small { font-size: 13px; }

/* 상단 */
.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 640px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 10px; min-height: 52px; }
.top .brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); font-size: 17px; }
.top .brand img { width: 26px; height: 26px; }
.top .back { font-size: 15px; color: var(--text); display: flex; align-items: center; gap: 2px; }
.top .sp { flex: 1; }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; color: var(--muted); }
.iconbtn:hover { background: var(--surface-2); }

/* 탭·칩 */
.tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 12px; margin: 14px 0 10px; }
.tabs a { flex: 1; text-align: center; padding: 8px 4px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 15px; }
.tabs a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 14px; white-space: nowrap; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }

/* 카드 목록 */
.list { display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
a.card { display: block; color: inherit; }
a.card:active { transform: scale(.995); }
.meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.meta .sp { flex: 1; }
.ttl { font-size: 16px; font-weight: 650; margin: 6px 0 8px; line-height: 1.4; }
.foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }

.prov { font-weight: 800; font-size: 12px; letter-spacing: .02em; padding: 1px 6px; border-radius: 6px; color: var(--surface); }
.prov.lh { background: var(--lh); } .prov.sh { background: var(--sh); } .prov.gh { background: var(--gh); }

.dday { font-weight: 700; font-size: 13px; padding: 2px 8px; border-radius: 999px; }
.dday.hot { color: var(--hot); background: var(--hot-soft); }
.dday.soon { color: var(--maybe); background: var(--maybe-soft); }
.dday.far { color: var(--muted); background: var(--surface-2); }
.dday.done { color: var(--muted); background: var(--surface-2); text-decoration: line-through; }

.pill { display: inline-flex; align-items: center; gap: 4px; font-weight: 650; font-size: 13px; padding: 2px 9px; border-radius: 999px; }
.pill.ok { color: var(--ok); background: var(--ok-soft); }
.pill.maybe { color: var(--maybe); background: var(--maybe-soft); }
.pill.no { color: var(--no); background: var(--no-soft); }
.pill.wait { color: var(--muted); background: var(--surface-2); font-weight: 500; }
.pill.fav { color: var(--accent); background: var(--accent-soft); }

.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 17px; margin-bottom: 6px; }
.status-line { font-size: 12px; color: var(--muted); text-align: center; margin: 18px 0 0; }

/* 상세 */
.hero { padding: 16px 0 6px; }
.hero h1 { font-size: 21px; margin: 8px 0 10px; }
.actions { display: flex; gap: 8px; margin: 10px 0 4px; }
.actions > * { flex: 1; }
.sec { margin-top: 14px; }
.sec > h2 { font-size: 15px; color: var(--muted); font-weight: 650; margin: 0 0 8px 2px; }
.oneline { font-size: 16px; font-weight: 550; }
.verdicts { display: flex; flex-direction: column; gap: 8px; }
.vrow { display: flex; gap: 10px; align-items: flex-start; }
.vrow .pill { flex: none; margin-top: 1px; }
.vrow .g { font-weight: 650; }
.vrow .why { font-size: 13px; color: var(--muted); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 15px; }
.timeline li:last-child { border-bottom: 0; }
.timeline .d { flex: none; width: 92px; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; }
.timeline li.past { opacity: .5; }
.timeline li.now .d { color: var(--accent); font-weight: 700; }
.cx + .cx { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.cx h3 { font-size: 16px; }
.cx .addr { font-size: 13px; color: var(--muted); margin: 2px 0 8px; }
.tblwrap { overflow-x: auto; margin: 0 -4px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 7px 6px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 13px; }
.tbl td:first-child { white-space: normal; min-width: 96px; }
.tbl td small { display: block; font-size: 12px; line-height: 1.4; margin-top: 2px; }
.bul { margin: 0; padding-left: 18px; }
.bul li { margin: 4px 0; }
.files a { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); color: var(--text); font-size: 15px; }
.files a:last-child { border-bottom: 0; }
.files .ext { flex: none; font-size: 11px; font-weight: 800; padding: 2px 5px; border-radius: 5px; background: var(--surface-2); color: var(--muted); text-transform: uppercase; }
.pick { padding: 10px 0; border-bottom: 1px solid var(--line); }
.pick:last-child { border-bottom: 0; }
.pick .h { display: flex; gap: 8px; align-items: center; font-weight: 650; }
.pick .n { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.pick p { margin: 4px 0 0 30px; font-size: 14px; }
.wait-box { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 15px; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: sp 1s linear infinite; flex: none; }
@keyframes sp { to { transform: rotate(360deg); } }
details.more summary { cursor: pointer; color: var(--muted); font-size: 14px; padding: 4px 0; }
.note { font-size: 12px; color: var(--muted); margin-top: 10px; }

/* 버튼·폼 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 650; cursor: pointer; text-align: center; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn[disabled] { opacity: .5; }
.stack { display: flex; flex-direction: column; gap: 14px; }
label > span { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number], input:not([type]), select {
  width: 100%; min-height: 48px; padding: 10px 14px; font: inherit; font-size: 17px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; outline: none;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.alert { background: var(--hot-soft); color: var(--hot); padding: 10px 14px; border-radius: 12px; font-size: 14px; }
.ok-msg { background: var(--ok-soft); color: var(--ok); padding: 10px 14px; border-radius: 12px; font-size: 14px; }

.auth { max-width: 400px; margin: 0 auto; padding-top: 8vh; display: flex; flex-direction: column; gap: 16px; }
.auth-brand { text-align: center; }
.auth-brand h1 { font-size: 22px; margin: 10px 0 4px; }

/* 설문 */
.survey { padding-top: 8px; }
.prog { height: 4px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin: 6px 0 22px; }
.prog i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .3s; }
.q h1 { font-size: 23px; margin-bottom: 6px; }
.q .hint { color: var(--muted); font-size: 15px; margin: 0 0 20px; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opts.one { grid-template-columns: 1fr; }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt span { display: flex; flex-direction: column; justify-content: center; min-height: 52px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); font-weight: 600; cursor: pointer; }
.opt span small { font-weight: 400; color: var(--muted); font-size: 13px; margin-top: 2px; }
.opt input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.opt input:checked + span small { color: var(--accent); }
.opt input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }
.num { display: flex; align-items: center; gap: 10px; }
.num input { text-align: right; font-size: 22px; font-weight: 700; }
.num .unit { font-size: 18px; font-weight: 600; flex: none; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 22px; padding: 18px 0; }
.stepper button { width: 54px; height: 54px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 26px; color: var(--text); cursor: pointer; }
.stepper output { font-size: 40px; font-weight: 800; min-width: 70px; text-align: center; font-variant-numeric: tabular-nums; }
.fields { display: flex; flex-direction: column; gap: 14px; }
.bar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--bg); border-top: 1px solid var(--line); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
.bar-in { max-width: 640px; margin: 0 auto; display: flex; gap: 8px; }
.bar-in .btn.primary { flex: 1; }
.preview { margin-top: 18px; font-size: 14px; color: var(--muted); }

/* 설정 */
.set-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-row .l { flex: 1; }
.set-row .l b { display: block; font-weight: 600; }
.set-row .l small { color: var(--muted); }
.sw { position: relative; width: 50px; height: 30px; flex: none; }
.sw input { opacity: 0; width: 0; height: 0; }
.sw i { position: absolute; inset: 0; background: var(--line); border-radius: 30px; transition: .2s; cursor: pointer; }
.sw i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.sw input:checked + i { background: var(--accent); }
.sw input:checked + i::after { transform: translateX(20px); }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
