:root { --bg:#15181f; --card:#1d2129; --card-hi:#252a34; --line:#2d3340; --fg:#e9ebf1; --muted:#8f97a8; --accent:#f2a93b; --accent-dn:#a8762c; --accent-fg:#1b1304; --ok:#3ecf8e; --bad:#ef5f5f; --key:#2a303c; }
* { box-sizing:border-box; }
[hidden] { display:none !important; }
html, body { margin:0; background:var(--bg); color:var(--fg); }
body { font-family:"Malgun Gothic","Apple SD Gothic Neo",sans-serif; font-size:16px; line-height:1.6; }
main { max-width:960px; margin:0 auto; padding:36px 20px 56px; }
a { color:var(--accent); }
.head { display:flex; align-items:center; gap:14px; }
.leaf { width:48px; height:48px; border-radius:12px; background:var(--card); display:flex; align-items:center; justify-content:center; flex:none; }
h1 { font-size:26px; margin:0; line-height:1.25; }
.sub { color:var(--muted); margin:2px 0 0; font-size:15px; }
.card { background:var(--card); border:1px solid var(--line); border-radius:12px; padding:18px 20px; margin-top:20px; }
.card h2 { font-size:16px; color:var(--accent); margin:0 0 12px; display:flex; align-items:center; gap:10px; }
.card h2 .r { margin-left:auto; }
.muted { color:var(--muted); }
.small { font-size:13px; }
button { font-family:inherit; font-size:15px; border-radius:8px; border:1px solid var(--line); background:var(--card-hi); color:var(--fg); padding:8px 14px; cursor:pointer; }
button:hover:not(:disabled) { border-color:#4a5263; }
button:disabled { opacity:.45; cursor:default; }
button.primary { background:var(--accent); color:var(--accent-fg); border-color:var(--accent); font-weight:700; }
button.primary:hover:not(:disabled) { background:#f8bd63; }
button.link { background:none; border:0; color:var(--muted); padding:4px 6px; font-size:13px; text-decoration:underline; }
kbd { background:var(--key); border:1px solid #3a4150; border-radius:6px; padding:0 6px; font-family:inherit; font-size:14px; white-space:nowrap; }

/* 준비 */
.prep { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,420px); gap:20px; align-items:start; }
.steps { list-style:none; margin:0; padding:0; }
.steps li { display:flex; gap:12px; padding:10px 0; border-top:1px solid var(--line); }
.steps li:first-child { border-top:0; padding-top:0; }
.num { width:26px; height:26px; flex:none; border-radius:50%; background:var(--card-hi); color:var(--muted); font-weight:700; font-size:14px; display:flex; align-items:center; justify-content:center; margin-top:2px; }
.steps li.done .num { background:var(--ok); color:#06210f; }
.steps li.now .num { background:var(--accent); color:var(--accent-fg); }
.st-t { margin:0; font-weight:700; }
.st-s { margin:2px 0 0; color:var(--muted); font-size:14px; }
.st-s.bad { color:var(--bad); }
.st-s.good { color:var(--ok); }
.st-b { margin-top:8px; display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.bar { height:6px; border-radius:3px; background:var(--card-hi); overflow:hidden; margin-top:8px; }
.bar > i { display:block; height:100%; width:0; background:var(--accent); transition:width .2s; }
.pv { background:#0d0f14; border:1px solid var(--line); border-radius:10px; overflow:hidden; position:relative; }
.pv canvas { display:block; width:100%; height:auto; }
#pvCanvas { cursor:crosshair; touch-action:none; }
.pv-empty { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; text-align:center; color:var(--muted); font-size:14px; padding:20px; }
.strip { margin-top:8px; background:#0d0f14; border:1px solid var(--line); border-radius:8px; overflow:hidden; }
.strip canvas { display:block; width:100%; height:auto; }
.read { margin-top:6px; font-size:13px; color:var(--muted); min-height:20px; }
.read b { color:var(--fg); font-weight:700; }

/* 측정 */
.ctl { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.seg { display:inline-flex; background:var(--line); border-radius:8px; padding:1px; gap:1px; }
.seg button { border:0; border-radius:7px; background:var(--card-hi); color:var(--muted); padding:6px 12px; font-size:14px; }
.seg button.on { background:var(--accent); color:var(--accent-fg); font-weight:700; }
.seg.lock button:not(.on) { cursor:default; opacity:.6; }
#goBtn { min-width:84px; }
#state { color:var(--muted); font-size:14px; }
.ctl .r { margin-left:auto; }
.cards { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin-top:14px; }
.kpi { background:var(--card-hi); border-radius:10px; padding:10px 12px; min-width:0; }
.kpi .l { font-size:13px; color:var(--muted); }
.kpi .v { font-size:24px; font-weight:700; line-height:1.3; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-variant-numeric:tabular-nums; }
.kpi .s { font-size:12px; color:var(--muted); min-height:18px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sec { font-size:13px; color:var(--muted); margin:16px 0 6px; }
.chart { background:#12151b; border:1px solid var(--line); border-radius:10px; }
.chart canvas { display:block; width:100%; height:120px; }
#nextLine { margin-top:8px; font-size:14px; color:var(--muted); min-height:22px; }
#nextLine b { color:var(--fg); }

/* 기록 */
.hist { list-style:none; margin:0; padding:0; font-size:14px; }
.hist li { display:grid; grid-template-columns:96px 60px minmax(0,1fr) auto; gap:10px; padding:7px 2px; border-top:1px solid var(--line); font-variant-numeric:tabular-nums; }
.hist li:first-child { border-top:0; }
.hist .g { color:var(--fg); font-weight:700; }
.hist .m { color:var(--muted); }
.hist-empty { color:var(--muted); font-size:14px; }

.help { font-size:14px; color:var(--muted); }
.help ul { margin:0; padding-left:18px; }
.help li { margin:4px 0; }
.help b { color:var(--fg); }
.foot { margin-top:24px; font-size:13px; color:var(--muted); text-align:center; }
.warn { background:#2a1b1b; border:1px solid #5a2c2c; color:#ffd2d2; border-radius:10px; padding:10px 14px; margin-top:16px; font-size:14px; }

/* 작게 띄우기 (Document Picture-in-Picture 창 안) */
#mini { display:none; }
body.pip { margin:0; background:var(--bg); overflow:hidden; }
body.pip #mini { display:flex; flex-direction:column; justify-content:center; gap:2px; padding:8px 12px; height:100vh; }
.mi-top { display:flex; align-items:baseline; gap:8px; }
.mi-rate { font-size:22px; font-weight:700; font-variant-numeric:tabular-nums; white-space:nowrap; }
.mi-unit { font-size:12px; color:var(--muted); }
.mi-left { margin-left:auto; font-size:13px; color:var(--muted); font-variant-numeric:tabular-nums; white-space:nowrap; }
.mi-row { font-size:13px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-variant-numeric:tabular-nums; }
.mi-row b { color:var(--fg); }
.mi-bot { display:flex; align-items:center; gap:8px; margin-top:4px; }
.mi-bot .mi-row { flex:1; min-width:0; }
.mi-bot button { padding:3px 10px; font-size:13px; }

@media (max-width:760px) {
  main { padding:24px 14px 40px; }
  .prep { grid-template-columns:1fr; }
  .cards { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .kpi .v { font-size:20px; }
  .hist li { grid-template-columns:84px 52px minmax(0,1fr); }
  .hist li .m:last-child { display:none; }
}
