/* 값은 ops/html-inspector/src/styles.css 에서 그대로 복사했다 */
:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-2: #fafbfc;
  --ink: #1b1f26;
  --ink-soft: #5a6472;
  --line: #e3e7ec;
  --brand: #2e6df0;
  --brand-soft: #eaf1ff;
  --good: #1a9e5f;
  --good-soft: #e6f6ee;
  --warn: #c98a00;
  --warn-soft: #fdf3dd;
  --bad: #d83a3a;
  --bad-soft: #fbe7e7;
  --shadow: 0 1px 3px rgba(20, 30, 50, .08), 0 6px 20px rgba(20, 30, 50, .06);
  --radius: 12px;
  --hd-bg: var(--panel);
  --hd-ink: var(--ink);
  --hd-soft: var(--ink-soft);
  --hd-line: var(--line);
}
html[data-theme="black"] {
  --bg: #14171c;
  --panel: #1c2027;
  --panel-2: #22272f;
  --ink: #eef1f5;
  --ink-soft: #9aa5b3;
  --line: #2e343d;
  --brand: #5b93ff;
  --brand-soft: #1f2a3f;
  --good: #45c98a;
  --good-soft: #17301f;
  --warn: #e9b64a;
  --warn-soft: #322a12;
  --bad: #ff6b6b;
  --bad-soft: #351c1c;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
#app { height: 100%; display: flex; flex-direction: column; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5;
}

.topbar {
  display: flex; align-items: center; gap: 16px; padding: 10px 18px;
  background: var(--hd-bg); color: var(--hd-ink); border-bottom: 1px solid var(--hd-line); flex-wrap: wrap;
}
.topbar .btn { background: var(--hd-btn-bg, var(--panel)); color: var(--hd-btn-ink, var(--ink)); border-color: var(--hd-btn-line, var(--line)); }
.brand h1 { font-size: 16px; margin: 0; letter-spacing: -.2px; }
.brand-sub { margin: 2px 0 0; font-size: 12px; color: var(--hd-soft); }
.topbar-actions { display: flex; align-items: flex-end; gap: 12px; margin-left: auto; flex-wrap: wrap; }

.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.field input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); font-size: 13px; }
.field input:focus { outline: none; border-color: var(--brand); }
.field select { border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); font-size: 13px; font-weight: 600; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.field select:hover { border-color: var(--brand); }
.field-url { min-width: 260px; }

.btn-primary { background: var(--brand); color: #fff; font-weight: 700; font-size: 13px; padding: 9px 15px; border: 0; border-radius: 10px; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn { border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-weight: 700; font-size: 13px; padding: 9px 14px; border-radius: 9px; cursor: pointer; }
.btn:hover { border-color: var(--brand); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.back-to-stage { align-self: flex-start; margin: 10px 18px 0; }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.view[hidden] { display: none; }
.live-bar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--line); }

.survey-bar .field-url { flex: 1 1 360px; max-width: 640px; }

.view-toggle .btn.is-on { background: var(--brand); border-color: var(--brand); color: #fff; }
.env-thumb.is-error { color: var(--bad); word-break: break-all; }
.issue { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.detail { width: min(920px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.detail-head .src { margin: 4px 0 0; }
.detail-body .render-diff { margin-top: 0; padding-top: 0; border-top: 0; }
.detail-body .render-shots { grid-template-columns: repeat(2, minmax(0, 360px)); justify-content: center; }

.stage-main { flex: 1; min-height: 0; display: flex; }
.split { flex: 1; min-height: 0; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) 500px; }
@media (max-width: 960px) { .split { grid-template-columns: 1fr; } }

.pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.pane-preview { background: var(--bg); }
.pane-inspector { background: var(--panel); border-left: 1px solid var(--line); }
.pane-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.pane-title { font-weight: 700; font-size: 13.5px; }
.chip { font-size: 12px; color: var(--ink-soft); background: var(--panel-2); border: 1px solid var(--line); padding: 3px 9px; border-radius: 999px; }
.chip:empty { display: none; }
.chip.is-error { width: 100%; margin: 0; padding: 8px 10px; border-radius: 8px; font-size: 12px; font-weight: 600; white-space: pre-wrap; word-break: break-all; color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; }
.nav-row { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.nav-row[hidden] { display: none; }
.mini-toggle { font-size: 12px; color: var(--ink-soft); display: flex; align-items: center; gap: 5px; cursor: pointer; }
.preview-stage canvas { touch-action: none; }
.nav-row form { display: flex; gap: 8px; flex: 1; min-width: 240px; }
.nav-row input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); font-size: 13px; }
.nav-row input:focus { outline: none; border-color: var(--brand); }

.preview-stage { flex: 1; position: relative; overflow: auto; scrollbar-gutter: stable; padding: 20px; display: flex; align-items: flex-start; justify-content: center; }
.preview-stage svg { background: #fff; box-shadow: var(--shadow); display: block; max-width: 100%; height: auto; color: var(--line); }
.preview-stage textarea { position: absolute; opacity: 0; width: 1px; height: 1px; }

.inspector-body { flex: 1; overflow: auto; padding: 16px; }
.empty-state { color: var(--ink-soft); font-size: 13.5px; padding: 8px; }

.card { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-head h3 { margin: 0; font-size: 14px; word-break: break-all; flex: 1 1 auto; min-width: 0; }
.card-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 0 1 auto; justify-content: flex-end; }
.card-foldable > summary { cursor: pointer; list-style: none; user-select: none; margin: -4px -4px 6px; padding: 4px; border-radius: 8px; }
.card-foldable > summary::-webkit-details-marker { display: none; }
.card-foldable > summary:hover { background: var(--panel-2); }
.card-foldable:not([open]) > summary { margin-bottom: -4px; }
.fold-btn { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; margin-left: 8px; padding: 7px 14px; min-height: 34px; border-radius: 999px; background: var(--brand-soft); border: 1px solid var(--brand); color: var(--brand); font-size: 13px; font-weight: 700; line-height: 1; white-space: nowrap; }
.fold-btn::after { content: '접기'; }
.card-foldable:not([open]) .fold-btn::after { content: '펼치기'; }
.fold-arrow { display: block; flex: 0 0 auto; transition: transform .15s; }
.card-foldable:not([open]) .fold-arrow { transform: rotate(-90deg); }
.card-foldable > summary:hover .fold-btn { background: var(--brand); color: #fff; }

.tbl-wrap { overflow-x: auto; margin-top: 4px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th, .tbl td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--ink-soft); font-weight: 600; font-size: 11.5px; word-break: keep-all; }
.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl td small { color: var(--ink-soft); font-size: 10.5px; font-weight: 400; }
.tag { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.tag.good { color: var(--good); background: var(--good-soft); }
.tag.warn { color: var(--warn); background: var(--warn-soft); }
.tag.bad { color: var(--bad); background: var(--bad-soft); }
.tag.muted { color: var(--ink-soft); background: var(--panel); border: 1px solid var(--line); }
.finding { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.finding:last-of-type { border-bottom: 0; }
.finding-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.finding-head .src { min-width: 0; flex: 1 1 auto; }
.finding-msg { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.finding-msg summary { cursor: pointer; }
.finding-full { margin-top: 6px; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.src { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; word-break: break-all; color: var(--ink-soft); }
.why { font-size: 12px; color: var(--ink-soft); margin: 8px 0 0; padding: 8px 10px; background: var(--panel); border-radius: 8px; border: 1px solid var(--line); }
.why b { color: var(--ink); }
.row { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.render-diff { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.render-diff h4 { margin: 0 0 8px; font-size: 13px; color: var(--ink); }
.render-shots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.render-shots figure { margin: 0; min-width: 0; }
.render-shots img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; }
.render-shots figcaption { margin-top: 4px; font-size: 12px; color: var(--ink-soft); text-align: center; }

/* 기기 화면: 기기 틀 안에 실제 브라우저를 나란히 띄운다 */

/* 기기 화면 색: 흰색 바탕, 검은 기기 틀, 파란 강조. 어두운 화면 설정에서는 이전의 어두운 값을 쓴다 */
:root {
  --st-bg: #eaf0f8;
  --st-bar: #ffffff;
  --st-btn: #f3f6fb;
  --st-field: #ffffff;
  --st-line: #d5dce8;
  --st-dot: #cbd5e4;
  --st-ink: #1b1f26;
  --st-soft: #5a6472;
  --st-brand: #2e6df0;
  --st-warn: #a86400;
  --st-good: #16874f;
  --st-bad: #d83a3a;
}
html[data-theme="black"] {
  --st-bg: #0d0f13;
  --st-bar: #14171c;
  --st-btn: #1c2027;
  --st-field: #0d0f13;
  --st-line: #2e343d;
  --st-dot: #262b33;
  --st-ink: #dfe4ea;
  --st-soft: #9aa5b3;
  --st-brand: #5b93ff;
  --st-warn: #f0c36a;
  --st-good: #7ee0a0;
  --st-bad: #ff8a8a;
}

#view-stage { background: var(--st-bg); color: var(--st-ink); }
.stage-bar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--st-bar); border-bottom: 1px solid var(--st-line); flex-wrap: wrap; }
.stage-bar input[type="text"] { flex: 1 1 320px; min-width: 200px; padding: 8px 12px; border: 1px solid var(--st-line); border-radius: 8px; background: var(--st-field); color: var(--st-ink); font-size: 13px; }
.stage-bar .btn, .stage-bar select { background: var(--st-btn); color: var(--st-ink); border: 1px solid var(--st-line); border-radius: 8px; padding: 7px 12px; font-size: 13px; cursor: pointer; }
.stage-bar .btn-primary { padding: 8px 16px; }
.stage-bar .mini-toggle { color: var(--st-soft); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.stage-area { flex: 1; min-height: 0; overflow: auto; background-color: var(--st-bg); background-image: radial-gradient(var(--st-dot) 1px, transparent 1px); background-size: 20px 20px; }
.stage-row { display: flex; gap: 16px; align-items: flex-start; padding: 12px; width: max-content; min-width: 100%; }
.pane-card { flex: none; display: flex; flex-direction: column; gap: 6px; }
.pane-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pane-bar select { max-width: 100%; background: var(--st-btn); color: var(--st-ink); border: 1px solid var(--st-line); border-radius: 8px; padding: 5px 8px; font-size: 12px; font-weight: 600; cursor: pointer; }
.pane-bar .pane-device { flex: 1 1 120px; min-width: 0; }
.pane-bar .pane-version { flex: 1 1 110px; min-width: 0; }
.pane-bar .pane-role { flex: 0 0 auto; }
.stage-bar .mini-toggle.is-error { color: var(--st-bad); }
.pane-btn { padding: 3px 9px; font-size: 12px; background: var(--st-btn); color: var(--st-ink); border: 1px solid var(--st-line); border-radius: 8px; cursor: pointer; }
.pane-chips { display: inline-flex; gap: 4px; }
.pane-note { font-size: 11px; color: var(--st-soft); min-height: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pane-note.is-error { color: var(--st-bad); white-space: normal; }
.device-frame { position: relative; background: #07080b; border: 2px solid #4b5360; box-shadow: 0 6px 18px rgba(20, 30, 50, .28); width: fit-content; }
.pane-home { position: absolute; left: 50%; transform: translateX(-50%); border: 2px solid #3a404a; border-radius: 50%; background: transparent; }
.pane-camera { position: absolute; left: 50%; transform: translateX(-50%); border-radius: 50%; background: #1a1e26; border: 1px solid #2f3540; }
.pane-screen { position: relative; background: #fff; overflow: hidden; }
.pane-cutout { position: absolute; background: #000; z-index: 2; pointer-events: none; }
.pane-cutout.is-top { border-radius: 0 0 40% 40% / 0 0 100% 100%; }
.pane-cutout.is-left { border-radius: 0 40% 40% 0 / 0 100% 100% 0; }
.pane-cutout.is-right { border-radius: 40% 0 0 40% / 100% 0 0 100%; }
.pane-screen svg { display: block; color: transparent; }
.pane-placeholder { display: grid; place-items: center; height: 100%; min-height: 120px; color: var(--st-soft); font-size: 13px; background: var(--st-bar); }
.pane-ime { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; padding: 0; border: 0; resize: none; }

.pane-error-chip { cursor: pointer; border: 0; font: inherit; }
.pane-errors { flex: none; max-height: 260px; overflow: auto; background: var(--st-bar); border: 1px solid var(--st-line); border-radius: 8px; padding: 8px; font-size: 12px; color: var(--st-ink); }
.pane-errors .finding { margin-bottom: 8px; }

.stage-row.is-wrap { flex-wrap: wrap; width: auto; min-width: 0; }
.stage-row.is-single { width: auto; min-width: 100%; justify-content: center; }
.pane-card[hidden] { display: none; }
.stage-bar select[hidden] { display: none; }

.pane-inspect { background: var(--panel); color: var(--ink); border-radius: 10px; padding: 10px; max-height: 420px; overflow: auto; font-size: 12px; }
.pane-inspect[hidden] { display: none; }

.stage-diff { background: var(--st-bar); border-bottom: 1px solid var(--st-line); color: var(--st-ink); }
.stage-diff > summary { cursor: pointer; padding: 8px 16px; display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; list-style: none; }
.stage-diff > summary::-webkit-details-marker { display: none; }
.stage-diff-bar { display: flex; align-items: center; gap: 10px; padding: 0 16px 8px; flex-wrap: wrap; }
.stage-diff-body { max-height: 260px; overflow: auto; padding: 0 16px 12px; display: grid; gap: 10px; }
.diff-card { border: 1px solid var(--st-line); border-radius: 10px; padding: 10px 12px; background: var(--st-field); }
.diff-card h4 { margin: 0 0 6px; font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.diff-row { display: grid; grid-template-columns: auto 1fr; gap: 8px; padding: 4px 0; border-top: 1px solid var(--st-btn); font-size: 12px; }
.diff-row:first-of-type { border-top: 0; }
.diff-detail { color: var(--st-soft); word-break: break-all; }
.diff-advice { color: var(--st-warn); }
.diff-empty { color: var(--st-good); font-size: 12px; }
.diff-row .tag { align-self: start; white-space: nowrap; border-radius: 999px; padding: 2px 8px; }
.stage-diff-body { display: grid; gap: 10px; align-items: start; }
.diff-subtitle { margin: 8px 0 2px; font-size: 11.5px; font-weight: 700; color: var(--st-soft); }
.diff-env { margin-top: 8px; border-top: 1px dashed var(--st-line); padding-top: 6px; color: var(--st-soft); font-size: 12px; }
.diff-env > summary { cursor: pointer; }

/* 위쪽 줄: 주소와 이동만 두고 나머지는 구역별 메뉴로 모은다 */
.topbar-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.stage-bar { gap: 8px; padding: 8px 16px; }
.nav-group { display: inline-flex; gap: 4px; }
.menu, .pane-more { position: relative; }
.menu > summary, .pane-more > summary { list-style: none; cursor: pointer; user-select: none; background: var(--st-btn); color: var(--st-ink); border: 1px solid var(--st-line); border-radius: 8px; padding: 7px 12px; font-size: 13px; font-weight: 700; }
.menu > summary::-webkit-details-marker, .pane-more > summary::-webkit-details-marker, .stage-diff > summary::-webkit-details-marker { display: none; }
.menu[open] > summary, .pane-more[open] > summary { border-color: var(--st-brand); }
.menu-panel { position: absolute; z-index: 40; top: calc(100% + 6px); right: 0; min-width: 250px; display: grid; gap: 10px; padding: 12px; background: var(--st-btn); border: 1px solid var(--st-line); border-radius: 10px; box-shadow: 0 10px 30px rgba(20, 30, 50, .22); }
.menu-panel label { display: grid; gap: 4px; font-size: 12px; color: var(--st-soft); }
.menu-panel label.mini-toggle { display: flex; align-items: center; gap: 6px; }
.menu-panel select[hidden] { display: none; }
.menu-panel label:has(select[hidden]) { display: none; }
.menu-note { color: var(--st-soft); font-size: 12px; font-weight: 400; margin-left: 6px; }
.status-note { color: var(--st-soft); font-size: 12px; margin-left: auto; }
.status-note.is-error { color: var(--st-bad); }
.pane-more > summary { padding: 4px 10px; font-size: 14px; line-height: 1; }
.pane-more .menu-panel { right: 0; min-width: 130px; gap: 6px; padding: 8px; }
.pane-more .menu-panel .btn { text-align: left; }
.stage-diff > summary { display: flex; align-items: center; gap: 10px; }
.stage-diff > summary .btn { margin-left: auto; padding: 4px 10px; font-size: 12px; }
.device-dialog { border: 1px solid var(--st-line); border-radius: 12px; background: var(--st-bar); color: var(--st-ink); padding: 0; width: min(560px, 94vw); }
.device-dialog::backdrop { background: rgba(20, 30, 50, .45); }
.device-form { display: grid; gap: 10px; padding: 16px; }
.device-form h2 { margin: 0; font-size: 16px; }
.device-form label { display: grid; gap: 4px; font-size: 12px; color: var(--st-soft); }
.device-form label.inline { display: flex; align-items: center; gap: 6px; }
.device-form input[type="text"], .device-form input[type="number"], .device-form select { background: var(--st-field); color: var(--st-ink); border: 1px solid var(--st-line); border-radius: 8px; padding: 7px 10px; font-size: 13px; }
.device-form fieldset { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; border: 1px solid var(--st-line); border-radius: 8px; padding: 10px; margin: 0; }
.device-form legend { color: var(--st-soft); font-size: 12px; padding: 0 6px; }
.device-form #device-token-row { grid-column: 1 / -1; }
.device-actions { display: flex; gap: 8px; }
.device-form #preset-fields { display: grid; gap: 10px; }
.preset-box { border: 1px solid var(--st-line); border-radius: 8px; padding: 8px 10px; font-size: 12px; color: var(--st-soft); }
.preset-box strong { color: var(--st-ink); font-size: 12px; }
.preset-box ul, .preset-box ol { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; line-height: 1.5; }
.preset-box summary { cursor: pointer; color: var(--st-ink); }
.preset-box ol { max-height: 220px; overflow: auto; }
.device-form input[type="text"]:focus-visible { outline: 2px solid var(--st-brand); outline-offset: 0; }
.device-error { margin: 0; min-height: 1em; font-size: 12px; color: var(--st-warn); }
.device-saved ul { margin: 6px 0 0; padding-left: 16px; display: grid; gap: 4px; font-size: 12px; }

/* 기기 차이 패널은 열어도 아래 기기 영역을 줄이지 않고 그 위로 겹쳐 펼친다. 요약줄은 한 줄로 고정한다 */
.stage-diff { position: relative; }
.stage-diff > summary { min-height: 40px; }
.stage-diff-body { position: absolute; left: 0; right: 0; bottom: 100%; z-index: 30; max-height: 300px; padding: 12px 16px; background: var(--st-bar); border-top: 1px solid var(--st-line); box-shadow: 0 -8px 24px rgba(20, 30, 50, .18); }
.stage-diff-body:empty { display: none; }
#stage-diff-note { flex: 1; min-width: 0; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#stage-diff-chip { flex: none; white-space: nowrap; }

/* 테마: 화이트(기본), 블랙(기존의 어두운 값), 블루. 위쪽 단추로 고르고 브라우저에 기억한다 */
html[data-theme="blue"] {
  --bg: #eaf1ff; --panel: #ffffff; --panel-2: #f3f7ff; --line: #c9d8f5; --brand: #1f5fe0; --brand-soft: #dbe8ff;
  --hd-bg: #1f5fe0; --hd-ink: #ffffff; --hd-soft: #d4e3ff; --hd-line: #1a4fc0;
  --hd-btn-bg: rgba(255, 255, 255, .16); --hd-btn-ink: #ffffff; --hd-btn-line: rgba(255, 255, 255, .4);
  --st-bg: #d9e6ff; --st-bar: #eaf1ff; --st-btn: #ffffff; --st-field: #ffffff; --st-line: #b8cdf3; --st-dot: #bcd0f5;
  --st-ink: #0f2a5c; --st-soft: #4a6494; --st-brand: #1f5fe0;
}
.theme-switch { display: inline-flex; border: 1px solid var(--hd-btn-line, var(--line)); border-radius: 9px; overflow: hidden; }
.theme-switch button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--hd-ink); padding: 8px 11px; font-size: 12px; font-weight: 700; cursor: pointer; }
.theme-switch button + button { border-left: 1px solid var(--hd-btn-line, var(--line)); }
.theme-switch button::before { content: ""; width: 10px; height: 10px; border-radius: 50%; border: 1px solid currentColor; background: var(--swatch); }
.theme-switch button[data-theme-choice="white"] { --swatch: #ffffff; }
.theme-switch button[data-theme-choice="black"] { --swatch: #14171c; }
.theme-switch button[data-theme-choice="blue"] { --swatch: #2e6df0; }
.theme-switch button[aria-pressed="true"] { background: var(--brand); color: #ffffff; }
html[data-theme="blue"] .theme-switch button[aria-pressed="true"] { background: #ffffff; color: #1f5fe0; }

/* 3분할 배치: 칸 사이의 경계선을 끌어 폭을 바꾼다. 세로가 넘치면 그 칸 안에서 스크롤한다 */
.stage-area { overflow-x: auto; overflow-y: hidden; }
.stage-row, .stage-row.is-single { display: flex; align-items: stretch; gap: 0; padding: 8px 12px; width: auto; min-width: 0; height: 100%; justify-content: flex-start; }
.pane-card { flex: none; min-width: 0; display: flex; flex-direction: column; gap: 6px; overflow-x: hidden; overflow-y: auto; align-self: stretch; }
.pane-card .device-frame { margin: 0 auto; }
.pane-bar { display: flex; flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 6px; position: sticky; top: 0; z-index: 5; background: var(--st-bg); padding-bottom: 2px; }
.pane-bar-top, .pane-bar-bottom { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pane-bar .pane-device, .pane-bar .pane-version { flex: 1 1 0; min-width: 0; }
.pane-bar .pane-role, .pane-bar .pane-more { flex: 0 0 auto; }
.pane-bar-bottom .pane-chips { flex: 0 0 auto; }
.splitter { flex: none; width: 10px; cursor: col-resize; position: relative; touch-action: none; }
.splitter::after { content: ""; position: absolute; top: 40px; bottom: 8px; left: 4px; width: 2px; border-radius: 2px; background: var(--st-line); transition: background .12s; }
.splitter:hover::after, .splitter:focus-visible::after, .splitter.is-dragging::after { background: var(--st-brand); width: 4px; left: 3px; }
.splitter:focus-visible { outline: none; }

.stage-diff-toggle { flex: none; font-size: 12px; font-weight: 700; color: var(--st-soft); white-space: nowrap; }
.stage-diff > summary .btn { margin-left: auto; }

.stage-wrap { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
.stage-wrap > .stage-area { flex: 1; min-height: 0; }
.stage-busy { position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(10, 14, 20, .35); }
.stage-busy[hidden] { display: none; }
.stage-busy-box { min-width: 280px; max-width: 70%; padding: 18px 22px; border-radius: 12px; background: var(--st-bar); color: var(--st-ink); border: 1px solid var(--st-line); box-shadow: 0 12px 32px rgba(20, 30, 50, .3); display: grid; gap: 8px; justify-items: center; text-align: center; }
.stage-busy-spinner { width: 34px; height: 34px; border-radius: 50%; border: 4px solid var(--st-line); border-top-color: var(--st-ink); animation: stage-spin .8s linear infinite; }
.stage-busy-title { font-size: 14px; font-weight: 700; }
.stage-busy-step { font-size: 12.5px; color: var(--st-soft); overflow-wrap: anywhere; }
.stage-busy-track { width: 100%; height: 6px; border-radius: 999px; background: var(--st-line); overflow: hidden; }
.stage-busy-bar { height: 100%; width: 0; background: var(--st-ink); transition: width .3s ease; }
@keyframes stage-spin { to { transform: rotate(360deg); } }
.stage-busy-step { white-space: pre-line; }
.stage-busy-hint { font-size: 12px; color: var(--st-warn); overflow-wrap: anywhere; }
.stage-busy-hint:empty { display: none; }
.stage-busy-close { display: none; }
.stage-busy.is-error .stage-busy-close { display: inline-block; }
.stage-busy.is-error .stage-busy-spinner, .stage-busy.is-error .stage-busy-track { display: none; }
.stage-busy.is-error .stage-busy-title { color: var(--st-bad); }
.stage-busy.is-error .stage-busy-box { max-width: min(720px, 80%); }
.stage-diff .when-open { display: none; }
.stage-diff[open] .when-open { display: inline; }
.stage-diff[open] .when-closed { display: none; }
