:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --ink: #17202a;
  --ink-2: #4a5663;
  --muted: #6b7785;
  --line: #e1e6eb;
  --accent: #155e75;
  --accent-ink: #ffffff;
  --accent-soft: #e3f1f5;
  --good: #1f7a4d;
  --good-soft: #e3f4ea;
  --warn: #8a5200;
  --warn-soft: #fdf1dc;
  --bad: #b42318;
  --bad-soft: #fde8e6;
  --code-bg: #0f1720;
  --code-ink: #dbe4ec;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 6px 18px rgba(16, 24, 40, 0.05);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, "D2Coding", monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1419;
    --surface: #151d24;
    --surface-2: #1b252e;
    --ink: #e6edf3;
    --ink-2: #b4c0cb;
    --muted: #8a98a6;
    --line: #27333d;
    --accent: #5fb8d1;
    --accent-ink: #06222b;
    --accent-soft: #15313b;
    --good: #5ccf8f;
    --good-soft: #143222;
    --warn: #f0b75a;
    --warn-soft: #3a2a10;
    --bad: #ff8a80;
    --bad-soft: #3d1715;
    --code-bg: #0a0f14;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1419;
  --surface: #151d24;
  --surface-2: #1b252e;
  --ink: #e6edf3;
  --ink-2: #b4c0cb;
  --muted: #8a98a6;
  --line: #27333d;
  --accent: #5fb8d1;
  --accent-ink: #06222b;
  --accent-soft: #15313b;
  --good: #5ccf8f;
  --good-soft: #143222;
  --warn: #f0b75a;
  --warn-soft: #3a2a10;
  --bad: #ff8a80;
  --bad-soft: #3d1715;
  --code-bg: #0a0f14;
  --shadow: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 76px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 var(--font);
  word-break: keep-all;
  overflow-wrap: anywhere;
}
a { color: var(--accent); }
code, pre { font-family: var(--mono); font-variant-ligatures: none; }
code { font-size: 0.92em; }
h1, h2, h3 { line-height: 1.35; }
.wrap { width: min(1120px, 100%); margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 20; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 상단 */
.top { background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-inner { display: flex; align-items: center; gap: 12px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; margin-right: auto; min-width: 0; }
.brand strong { display: block; font-size: 15px; line-height: 1.2; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.brand-mark { flex: none; width: 34px; height: 34px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; }
.brand-mark svg { width: 20px; height: 20px; fill: none; stroke: var(--accent-ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.top-right { display: flex; align-items: center; gap: 8px; }
.conn { font-size: 13px; padding: 5px 11px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.conn::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); margin-right: 7px; vertical-align: 1px; }
.conn.local::before { background: var(--good); }
.conn.online::before { background: var(--accent); }
.conn.lost::before { background: var(--bad); }

/* 소개 */
.hero { padding: 34px 0 22px; }
.hero h1 { margin: 0 0 8px; font-size: clamp(24px, 4vw, 32px); letter-spacing: -0.01em; }
.lead { margin: 0; color: var(--ink-2); max-width: 70ch; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; }
.hero-actions:empty { display: none; }
.summary { font-size: 14px; color: var(--ink-2); }
.summary b { color: var(--ink); }
.banner { margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--bad-soft); color: var(--ink); font-size: 14px; }
.banner b { color: var(--bad); }

/* 버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 34px; padding: 5px 12px; font-size: 13.5px; border-radius: 9px; }
.btn.big { min-height: 46px; padding: 10px 20px; font-size: 15px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.ready { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 50%, transparent); animation: ready 1.6s ease-out 3; }
@keyframes ready { 70% { box-shadow: 0 0 0 10px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.copy { flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 7px; font: inherit; font-size: 12.5px; padding: 2px 9px; min-height: 28px; cursor: pointer; }
.copy:hover { color: var(--ink); background: var(--surface-2); }
.copy.done { color: var(--good); border-color: var(--good); }

/* 프로그램 카드 */
.apps { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 18px; outline: none; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card.is-running { border-color: color-mix(in srgb, var(--good) 45%, var(--line)); }
.card-head { display: flex; align-items: flex-start; gap: 12px; }
.card-icon { flex: none; width: 44px; height: 44px; border-radius: 11px; background: var(--accent-soft); display: grid; place-items: center; }
.card-icon svg { width: 26px; height: 26px; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.card-title { flex: 1; min-width: 0; }
.card-title h2 { margin: 0; font-size: 18px; }
.card-title .folder { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.card p { margin: 0; color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; list-style: none; }
.chips li { font-size: 12.5px; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }

.pill { flex: none; font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pill.running { background: var(--good-soft); color: var(--good); border-color: transparent; }
.pill.running::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: currentColor; vertical-align: 1px; }
.pill.busy { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.error { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.busy::before, .spinner { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; vertical-align: -1px; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.control { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.mode-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ways { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 10px; }
.way { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.way h3 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.way-n { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 12.5px; }
.way p { margin: 0; font-size: 13.5px; flex: 1; }
.modes { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: var(--surface-2); gap: 3px; }
.modes button { border: 0; background: transparent; color: var(--ink-2); padding: 6px 12px; border-radius: 7px; font: inherit; font-size: 13.5px; cursor: pointer; }
.modes button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); font-weight: 600; }
.modes button:disabled { cursor: not-allowed; opacity: 0.6; }
.mode-hint { font-size: 13px; color: var(--muted); }

/* 진행 단계 */
.progress { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.stepper { display: flex; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.stepper li { flex: 1; display: flex; align-items: center; gap: 6px; color: var(--muted); min-width: 0; }
.stepper li::before { content: attr(data-n); flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; border: 1.5px solid var(--line); background: var(--surface); }
.stepper li.done { color: var(--ink-2); }
.stepper li.done::before { content: "✓"; background: var(--good); border-color: var(--good); color: #fff; }
.stepper li.now { color: var(--ink); font-weight: 600; }
.stepper li.now::before { border-color: var(--warn); color: var(--warn); }
.bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width 0.4s ease; }
.bar.indeterminate > span { width: 35%; animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(290%); } }
.progress-text { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) {
  .pill.busy::before, .spinner, .bar.indeterminate > span, .btn.ready { animation: none; }
}

.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 13.5px; align-items: center; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ok { color: var(--good); font-weight: 600; }
.no { color: var(--bad); font-weight: 600; }

.note { font-size: 13.5px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--ink); white-space: pre-wrap; }
.note.warn { background: var(--warn-soft); }
.note.error { background: var(--bad-soft); }
.note.error b { color: var(--bad); }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack:empty { display: none; }

.account { border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--accent-soft); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.account h3 { margin: 0; font-size: 14px; }
.account .row { display: grid; grid-template-columns: 7.5em 1fr auto; align-items: center; gap: 8px; font-size: 14px; }
.account .row span { color: var(--ink-2); white-space: nowrap; }
.account code { font-size: 14px; padding: 2px 8px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); justify-self: start; word-break: break-all; }
.account p { margin: 0; font-size: 12.5px; color: var(--ink-2); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }
details.logs summary { cursor: pointer; font-size: 13.5px; color: var(--ink-2); padding: 2px 0; width: fit-content; }
.log-tools { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.log { margin: 6px 0 0; background: var(--code-bg); color: var(--code-ink); border-radius: 10px; padding: 12px; height: 220px; overflow: auto; font: 12.5px/1.55 var(--mono); white-space: pre-wrap; word-break: break-all; }
.log .err { color: #ff9b91; }
.log .sys { color: #8fd3e6; }
.log .t { color: #6f7f8c; margin-right: 8px; }
.log:empty::before { content: "아직 로그가 없습니다."; color: #6f7f8c; }

/* 안내·비교·질문 */
.panel { margin-top: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 8px; font-size: 18px; }
.panel > p { margin: 0 0 14px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.panel-head h2 { margin: 0; }
.tabs { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: var(--surface-2); gap: 3px; }
.tabs button { border: 0; background: transparent; color: var(--ink-2); padding: 5px 12px; border-radius: 7px; font: inherit; font-size: 13.5px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); font-weight: 600; }

.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 4px; }
.steps > li { counter-increment: step; position: relative; padding: 4px 0 16px 44px; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: 2px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.steps > li:not(:last-child)::after { content: ""; position: absolute; left: 13.5px; top: 34px; bottom: 0; width: 1px; background: var(--line); }
.steps h3 { margin: 0 0 4px; font-size: 15.5px; }
.steps p { margin: 0 0 10px; color: var(--ink-2); }
.choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 12px; }
.choice-item { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; min-width: 0; }
.choice-item p { margin: 0; }
.code-box { position: relative; width: 100%; }
.code-box pre { margin: 0; background: var(--code-bg); color: var(--code-ink); border-radius: 10px; padding: 12px 64px 12px 14px; overflow-x: auto; font-size: 13px; line-height: 1.6; }
.code-box .copy { position: absolute; top: 8px; right: 8px; background: #1e2a35; color: #dbe4ec; border-color: #33424f; }
.code-box .copy.done { color: #7fe0a8; border-color: #7fe0a8; }

.table-wrap { overflow-x: auto; margin-top: 6px; }
.compare { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
.compare th, .compare td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.compare thead th { font-size: 13.5px; color: var(--ink); background: var(--surface-2); }
.compare thead small { font-family: var(--mono); font-weight: 400; color: var(--muted); }
.compare tbody th { color: var(--muted); font-weight: 600; white-space: nowrap; width: 1%; }
.compare tr:last-child > * { border-bottom: 0; }

.faq details { border-top: 1px solid var(--line); }
.faq details:last-of-type { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; list-style: none; padding: 13px 28px 13px 2px; font-weight: 600; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 6px; top: 10px; font-size: 20px; font-weight: 400; color: var(--muted); }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0 2px 12px; color: var(--ink-2); }

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding-top: 22px; padding-bottom: 36px; font-size: 13px; color: var(--muted); }

/* 알림 */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 30; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100% - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; border-radius: 12px; background: var(--ink); color: var(--bg); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); font-size: 14px; animation: rise 0.2s ease-out; }
.toast.error { background: var(--bad); color: #fff; }
.toast span { flex: 1; }
.toast a, .toast button { flex: none; color: inherit; font: inherit; font-weight: 700; background: transparent; border: 1px solid currentColor; border-radius: 8px; padding: 4px 10px; text-decoration: none; cursor: pointer; }
.toast .x { border: 0; padding: 4px 6px; opacity: 0.7; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

@media (max-width: 560px) {
  .hero { padding-top: 24px; }
  .card, .panel { padding: 18px; }
  .actions .btn, .hero-actions .btn { flex: 1 1 auto; }
  .top-right .btn { display: none; }
  .steps > li { padding-left: 38px; }
  .account .row { grid-template-columns: 1fr auto; }
  .account .row span { grid-column: 1 / -1; }
}
