:root {
  --bg: #eef1f6; --surface: #ffffff; --surface-2: #f4f6fa; --surface-3: #eef1f6;
  --text: #0f1929; --text-2: #475569; --muted: #8a94a6; --line: #e3e8f0; --line-2: #d3dae6;
  --brand: #16365c; --brand-2: #1f4e7a; --accent: #2563eb;
  --gain: #0e7a51; --loss: #c8392b; --gain-bg: #e7f4ee; --loss-bg: #fbecea;
  --warn-bg: #fdf3e3; --warn-tx: #97600d;
  --radius: 10px; --radius-lg: 16px;
  --shadow-1: 0 1px 2px rgba(15,25,41,.05), 0 1px 3px rgba(15,25,41,.07);
  --shadow-2: 0 4px 14px rgba(15,25,41,.08), 0 10px 30px rgba(15,25,41,.06);
  --font: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, 'Apple SD Gothic Neo', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0c1118; --surface: #131a24; --surface-2: #1a2330; --surface-3: #10161f;
    --text: #eaf0f8; --text-2: #aab6c6; --muted: #74808f; --line: #25303f; --line-2: #313e50;
    --brand: #cfe0f3; --brand-2: #9cc0e6; --accent: #5b9bf3;
    --gain: #34c98a; --loss: #f0726a; --gain-bg: #15291f; --loss-bg: #2a1714;
    --warn-bg: #2f2510; --warn-tx: #e7b864;
    --shadow-1: 0 1px 2px rgba(0,0,0,.3); --shadow-2: 0 8px 28px rgba(0,0,0,.4); }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  line-height: 1.5; -webkit-font-smoothing: antialiased; font-feature-settings: 'tnum'; padding-bottom: 84px; }
.up { color: var(--gain); } .down { color: var(--loss); }

.appbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.appbar-in { max-width: 720px; margin: 0 auto; padding: 12px 18px; display: flex; align-items: center; gap: 11px; }
.logo { width: 32px; height: 32px; border-radius: 9px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand-tx h1 { font-size: 15.5px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.brand-tx .en { color: var(--muted); font-weight: 500; }
.brand-tx p { font-size: 11.5px; color: var(--muted); margin: 1px 0 0; }
.chips { margin-left: auto; } .chip { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 20px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }

main { max-width: 640px; margin: 0 auto; padding: 18px; }
.stepnav { display: flex; gap: 6px; margin-bottom: 18px; }
.snav { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 4px;
  font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--line);
  border-radius: 9px; cursor: pointer; transition: all .12s; }
.snav .sn-n { width: 18px; height: 18px; border-radius: 50%; background: var(--surface-2); color: var(--muted);
  display: flex; align-items: center; justify-content: center; font-size: 11px; }
.snav.on { color: #fff; background: var(--brand); border-color: var(--brand); }
.snav.on .sn-n { background: rgba(255,255,255,.25); color: #fff; }
.snav.done { color: var(--brand-2); border-color: var(--line-2); }
.snav.done .sn-n { background: var(--gain-bg); color: var(--gain); }
@media (max-width: 480px) { .snav { font-size: 0; padding: 9px 4px; } .snav .sn-n { font-size: 11px; } }

.step-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.step-n { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 15px; }
.step-head h2 { font-size: 19px; font-weight: 700; margin: 2px 0 2px; letter-spacing: -.01em; }
.lead { font-size: 13px; color: var(--text-2); margin: 0; }
.opt-tag { font-size: 11px; font-weight: 600; color: var(--accent); background: var(--surface-2); padding: 2px 8px; border-radius: 6px; vertical-align: middle; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); padding: 18px; margin-bottom: 16px; }
.card-h { font-size: 13px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.grp-mini { padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.grp-mini:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.grp-mini h3 { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 0 0 11px; }

.field { margin-bottom: 13px; } .field:last-child { margin-bottom: 0; }
.field label { display: flex; align-items: center; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }
.field input, .field select { width: 100%; height: 44px; padding: 0 13px; font-size: 15px; font-family: var(--font);
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 10px; -webkit-appearance: none; appearance: none; }
.field select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a94a6' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; line-height: 1.5; }

.q { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; line-height: 1;
  font-size: 10px; font-weight: 700; border-radius: 50%; background: var(--surface-3); color: var(--muted);
  margin-left: 6px; cursor: pointer; font-style: normal; border: 1px solid var(--line-2); flex-shrink: 0; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-b { flex: 1; min-width: 56px; padding: 10px 6px; font-size: 13px; font-weight: 600; font-family: var(--font);
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line-2); border-radius: 9px; cursor: pointer; }
.seg-b.on { background: var(--brand); color: #fff; border-color: var(--brand); }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px;
  font-weight: 500; padding: 10px 0; cursor: pointer; }
.switch-row input[type=checkbox] { -webkit-appearance: none; appearance: none; margin: 0; flex-shrink: 0;
  width: 38px; height: 22px; border-radius: 22px; background: var(--line-2); position: relative; cursor: pointer; transition: background .15s; }
.switch-row input[type=checkbox]::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch-row input[type=checkbox]:checked { background: var(--accent); }
.switch-row input[type=checkbox]:checked::after { transform: translateX(16px); }

.adv { margin-top: 6px; } .adv summary { font-size: 12.5px; color: var(--accent); cursor: pointer; padding: 8px 0; font-weight: 600; }
.adv[open] summary { margin-bottom: 8px; }

.hero-take { font-size: 16px; line-height: 1.55; font-weight: 500; margin: 0 0 16px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); }
.hero-take b { font-weight: 700; }

.scen-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.scen { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 15px 16px; box-shadow: var(--shadow-1);
  border-top: 3px solid var(--line); }
.scen.pos { border-top-color: var(--gain); } .scen.neg { border-top-color: var(--loss); }
.scen-p { font-size: 13px; font-weight: 700; }
.scen-nom { font-size: 11.5px; color: var(--muted); margin-bottom: 8px; }
.scen-usd { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.scen.pos .scen-usd { color: var(--gain); } .scen.neg .scen-usd { color: var(--loss); }
.scen-lab { font-size: 11px; color: var(--muted); margin-top: 2px; }
.scen-sub { font-size: 11px; color: var(--text-2); margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--line); }
.legend { font-size: 12px; color: var(--muted); margin: 0 0 16px; line-height: 1.55; text-align: center; padding: 0 6px; }
.legend b { color: var(--text-2); font-weight: 600; }

.chartwrap { position: relative; width: 100%; height: 240px; }

.bd-gh { font-size: 11.5px; color: var(--brand-2); font-weight: 700; margin: 13px 0 3px; letter-spacing: .02em; }
.bd-gh:first-child { margin-top: 0; }
.bd-row { display: grid; grid-template-columns: 1fr auto 60px; gap: 10px; align-items: center; padding: 9px 2px; border-bottom: 1px solid var(--line); cursor: help; }
.bd-name { font-size: 13.5px; font-weight: 500; }
.bd-amt { font-size: 13.5px; text-align: right; font-weight: 600; white-space: nowrap; }
.bd-pct { font-size: 12.5px; text-align: right; color: var(--muted); }
.bd-row.total { border-top: 1.5px solid var(--line-2); border-bottom: none; margin-top: 5px; padding-top: 11px; cursor: default; }
.bd-row.total .bd-name, .bd-row.total .bd-amt { font-weight: 700; font-size: 14.5px; }
.bd-row.total .bd-pct { color: var(--text); font-weight: 600; }
.bd-row.income { cursor: default; } .bd-row.income .bd-name, .bd-row.income .bd-amt { color: var(--gain); }

.wiznav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--line);
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); display: flex; gap: 10px; justify-content: space-between; z-index: 25; }
.wiznav { max-width: 640px; margin: 0 auto; }
@media (min-width: 676px) { .wiznav { left: 50%; transform: translateX(-50%); border-radius: 14px 14px 0 0; border: 1px solid var(--line); border-bottom: none; box-shadow: var(--shadow-2); } }
.btn { height: 46px; padding: 0 22px; font-size: 15px; font-weight: 700; font-family: var(--font); border-radius: 11px; cursor: pointer; border: 1px solid transparent; }
.btn.primary { background: var(--brand); color: #fff; flex: 1; }
.btn.ghost { background: var(--surface-2); color: var(--text-2); border-color: var(--line-2); }

footer { max-width: 640px; margin: 0 auto; padding: 4px 18px 24px; }
.foot-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; }
.foot-card h3 { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.foot-card p { font-size: 12px; color: var(--text-2); margin: 0 0 7px; line-height: 1.65; }
.foot-card .src { font-size: 11.5px; color: var(--muted); }
.foot-card b { color: var(--text); font-weight: 600; }

.tip { position: fixed; z-index: 100; max-width: 280px; background: var(--text); color: var(--surface);
  font-size: 12.5px; line-height: 1.5; padding: 9px 12px; border-radius: 9px; box-shadow: var(--shadow-2); pointer-events: none; }
@media (prefers-color-scheme: dark) { .tip { background: #e9eef6; color: #0c1118; } }
