:root {
  --bg: #f6f5f1;
  --card: #ffffff;
  --ink: #1b1f23;
  --muted: #5d6670;
  --line: #dcd9d0;
  --ion: #1f5fd6;
  --elec: #b9810a;
  --heat: #d4442a;
  --good: #1d7a4a;
  --soft: #eef1f6;
  --fix-bg: #fff4ee;
  --analogy-bg: #f1f4fb;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161a;
    --card: #1b2127;
    --ink: #eceff2;
    --muted: #9aa5b0;
    --line: #2b343c;
    --ion: #6ea0ff;
    --elec: #f2b83a;
    --heat: #ff7a59;
    --good: #55c58a;
    --soft: #232b33;
    --fix-bg: #2b1f1a;
    --analogy-bg: #1d2430;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: break-word;
}
b, strong { font-weight: 700; }

.progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 10; background: transparent; }
.progress i { display: block; height: 100%; width: 0; background: var(--ion); transition: width .1s linear; }

/* hero */
.hero {
  max-width: 1080px; margin: 0 auto;
  padding: calc(48px + env(safe-area-inset-top)) 20px 24px;
  display: grid; gap: 24px; align-items: center;
}
.eyebrow { margin: 0 0 8px; color: var(--ion); font-weight: 700; font-size: 14px; letter-spacing: .04em; }
h1 { margin: 0 0 16px; font-size: clamp(30px, 8vw, 48px); line-height: 1.25; letter-spacing: -0.02em; }
.lead { font-size: 19px; margin: 0 0 12px; }
.note { margin: 0; color: var(--muted); font-size: 15px; }
.hero-phone { width: 110px; justify-self: start; }
.ph-body { fill: var(--ink); }
.ph-screen { fill: var(--card); }
.ph-island { fill: var(--ink); }
.ph-bolt { fill: var(--elec); }
@media (min-width: 720px) {
  .hero { grid-template-columns: 1fr 160px; padding-top: 72px; }
  .hero-phone { width: 150px; justify-self: end; }
}

/* steps */
main { max-width: 1080px; margin: 0 auto; padding: 0 20px 40px; }
.step { padding: 48px 0; border-top: 1px solid var(--line); display: grid; gap: 24px; }
.num {
  margin: 0 0 4px; width: 34px; height: 34px; border-radius: 50%;
  background: var(--ink); color: var(--bg);
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
}
h2 { margin: 8px 0 16px; font-size: clamp(24px, 6vw, 32px); line-height: 1.3; letter-spacing: -0.015em; }
h3 { margin: 0 0 6px; font-size: 15px; }
.copy p { margin: 0 0 14px; }
.hint { color: var(--muted); font-size: 15px; }
ul.plain { margin: 0 0 14px; padding-left: 1.2em; }
ul.plain li { margin-bottom: 6px; }
.callout { border-radius: var(--radius); padding: 14px 16px; margin: 18px 0; font-size: 16px; }
.callout p { margin: 0 0 8px; }
.callout p:last-child { margin-bottom: 0; }
.callout.fix { background: var(--fix-bg); border-left: 4px solid var(--heat); }
.callout.analogy { background: var(--analogy-bg); border-left: 4px solid var(--ion); }

@media (min-width: 960px) {
  .step { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 48px; padding: 72px 0; align-items: start; }
  .sim-wrap { position: sticky; top: 24px; }
}
.step.wip { opacity: .7; }
.step.wip .copy { grid-column: 1 / -1; }

/* simulation card */
.sim { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.sim figcaption { margin-top: 12px; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.sim-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.btn {
  appearance: none; font: inherit; font-size: 15px; font-weight: 600;
  min-height: 44px; padding: 0 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--soft); color: var(--ink);
}
.btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary { background: var(--ion); color: #fff; border-color: var(--ion); }
.btn.primary[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--ion); outline-offset: 2px; }

canvas { display: block; width: 100%; border-radius: 12px; background: var(--soft); }
#cv1 { aspect-ratio: 1.1 / 1; }
#cv2 { aspect-ratio: 1.25 / 1; }

.legend { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; color: var(--muted); }
.dot { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: #fff; font-size: 13px; font-weight: 700; line-height: 1; vertical-align: -3px; margin-right: 4px; }
.dot.ion { background: var(--ion); }
.dot.elec { background: var(--elec); }

.meter { margin-top: 14px; }
.meter-label { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.meter-label b { color: var(--ink); }
.meter-track { height: 12px; border-radius: 6px; background: var(--soft); overflow: hidden; border: 1px solid var(--line); }
.meter-track i { display: block; height: 100%; width: 0; background: var(--ion); transition: width .15s linear; }

/* section 0 journey */
.journey { list-style: none; margin: 0; padding: 0; }
.node { margin: 0; }
.node details { border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.node summary {
  list-style: none; cursor: pointer; display: grid; grid-template-columns: 40px 1fr auto; gap: 4px 12px;
  align-items: center; padding: 10px 12px; min-height: 56px;
}
.node summary::-webkit-details-marker { display: none; }
.node .ico { width: 36px; height: 36px; color: var(--ink); }
.node .nm { font-weight: 700; line-height: 1.3; }
.node .nm small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.node .w { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.node .bar { grid-column: 2 / 4; height: 10px; background: var(--soft); border-radius: 5px; overflow: hidden; display: flex; }
.node .bar i { display: block; height: 100%; width: 0; transition: width .9s ease; }
.node .bar .ok { background: var(--ion); }
.node .bar .lost { background: var(--heat); }
.node .heat { grid-column: 2 / 4; font-size: 13px; color: var(--heat); min-height: 1.2em; font-weight: 600; }
.node .more { padding: 0 14px 14px; font-size: 15.5px; color: var(--ink); }
.node .more p { margin: 0 0 8px; }
.node summary::after { content: ""; display: none; }
.flow { position: relative; height: 28px; margin: 0 auto; width: 2px; background: var(--line); overflow: hidden; }
.flow i { position: absolute; left: -2px; width: 6px; height: 6px; border-radius: 50%; background: var(--ion); top: -8px; opacity: 0; }
.on .flow i { opacity: 1; animation: drip 1.1s linear infinite; }
.on .flow i:nth-child(2) { animation-delay: .55s; }
@keyframes drip { from { transform: translateY(0); } to { transform: translateY(40px); } }
@media (prefers-reduced-motion: reduce) { .on .flow i { animation: none; top: 10px; } .node .bar i { transition: none; } }
.summary { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--soft); font-size: 15.5px; min-height: 3.2em; }
.summary b.good { color: var(--good); }
.summary b.heat { color: var(--heat); }

/* section 2 */
.controls { margin-top: 12px; }
.controls label { display: flex; justify-content: space-between; font-weight: 700; font-size: 15px; margin-top: 10px; }
.controls output { color: var(--ion); font-variant-numeric: tabular-nums; }
.controls input[type=range] { width: 100%; height: 44px; accent-color: var(--ion); }
.tiny { margin: 0; font-size: 13px; color: var(--muted); }
.readout { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 0; }
.readout div { background: var(--soft); border-radius: 12px; padding: 8px 12px; }
.readout dt { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.readout dd { margin: 2px 0 0; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.warn { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--fix-bg); color: var(--heat); font-size: 14.5px; font-weight: 600; }

.foot { max-width: 1080px; margin: 0 auto; padding: 24px 20px calc(48px + env(safe-area-inset-bottom)); color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }

/* shared widgets (sections 3-8) */
.seg { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.seg .btn { min-height: 44px; font-size: 14.5px; padding: 0 14px; }
.group-label { margin: 6px 0 6px; font-size: 13.5px; font-weight: 700; color: var(--muted); }
.row { display: flex; align-items: center; gap: 12px; }
.row .grow { flex: 1; margin-top: 0; }
ol.plain { margin: 0 0 14px; padding-left: 1.4em; }
ol.plain li { margin-bottom: 6px; }
.stage-note { margin: 12px 0 0; font-size: 15.5px; min-height: 4.8em; }
#cv3 { aspect-ratio: 1.5 / 1; }
#cv5 { aspect-ratio: 1.15 / 1; }
#cv6 { aspect-ratio: 1.6 / 1; margin-top: 10px; }
#cv7 { aspect-ratio: 1.4 / 1; }

/* section 4 */
.chat { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.chat li { max-width: 88%; padding: 8px 12px; border-radius: 14px; font-size: 14.5px; line-height: 1.5; background: var(--soft); }
.chat li small { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 1px; }
.chat li.charger { align-self: flex-start; border-bottom-left-radius: 4px; }
.chat li.phone { align-self: flex-end; border-bottom-right-radius: 4px; background: var(--ion); color: #fff; }
.chat li.phone small { color: rgba(255,255,255,.85); }
.chat li.sys { align-self: center; max-width: 100%; background: transparent; color: var(--muted); font-size: 13px; padding: 2px 4px; text-align: center; }
.chain { margin-top: 14px; display: grid; gap: 8px; }
.chain .link { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; font-size: 14px; padding: 6px 8px; border-radius: 10px; border: 2px solid transparent; }
.chain .link .tr { grid-column: 1 / 3; height: 10px; border-radius: 5px; background: var(--soft); overflow: hidden; border: 1px solid var(--line); }
.chain .link .tr i { display: block; height: 100%; background: var(--ion); transition: width .4s ease; }
.chain .link b { font-variant-numeric: tabular-nums; }
.chain .link.weak { border-color: var(--heat); }
.chain .link.weak .tr i { background: var(--heat); }
.chain .link .tag { color: var(--heat); font-weight: 700; font-size: 12.5px; }

/* section 5 */
.controls .row { margin-top: 4px; }

/* section 8 */
.recap-h { margin: 18px 0 8px; font-size: 16px; }
.quiz-h { font-size: 17px; margin: 2px 0 10px; }
.q { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; background: var(--card); }
.q p { margin: 0 0 8px; font-weight: 700; }
.q .ans { display: flex; gap: 8px; }
.q .res { margin-top: 10px; font-size: 15px; }
.q .res p { font-weight: 400; margin: 6px 0 0; }
.q .res .v { display: inline-block; font-weight: 700; padding: 2px 10px; border-radius: 999px; font-size: 13.5px; }
.q .res .v.ok { background: var(--good); color: #fff; }
.q .res .v.no { background: var(--heat); color: #fff; }
.q .res .link { color: var(--muted); font-size: 13.5px; }
