:root {
  --bg: #171a21; --panel: #1f232c; --panel2: #262b36; --line: #333a48; --text: #e8ebf2; --muted: #9aa3b5;
  --accent: #6c8cff; --accent2: #5ef0c0; --warn: #ffcf5a; --danger: #ff6b6b; --radius: 10px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.55 system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Noto Sans KR", "Apple SD Gothic Neo", sans-serif; display: flex; flex-direction: column; }
button, select, input, textarea { font: inherit; color: inherit; }
button, .btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; min-height: 36px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
button:hover:not(:disabled), .btn:hover { border-color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #0d1020; font-weight: 600; }
button.danger { color: var(--danger); }
button.icon { width: 38px; justify-content: center; font-size: 18px; padding: 0; }
button.block { width: 100%; justify-content: center; margin: 8px 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
select, input[type=number], input[type=search], textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; min-height: 34px; }
textarea { width: 100%; resize: vertical; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 16px; margin: 0; }
.brand small { color: var(--muted); font-size: 12px; }
.actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 250px 1fr 360px; }
.panel { background: var(--panel); overflow: auto; min-height: 0; }
.panel h2 { font-size: 13px; color: var(--muted); margin: 12px 12px 6px; letter-spacing: .04em; }
.tree { border-right: 1px solid var(--line); }
.tree input { margin: 0 12px 8px; width: calc(100% - 24px); }
#tree { list-style: none; margin: 0; padding: 0 6px 12px; }
#tree li { display: flex; align-items: center; gap: 4px; border-radius: 6px; min-height: 30px; }
#tree li.sel { background: rgba(108,140,255,.22); }
#tree li.hidden-part .nm { opacity: .45; text-decoration: line-through; }
#tree .eye { width: 30px; min-height: 28px; padding: 0; justify-content: center; border: 0; background: none; font-size: 14px; }
#tree .nm { flex: 1; text-align: left; border: 0; background: none; padding: 4px 2px; min-height: 28px; overflow: hidden; text-overflow: ellipsis; }
#tree .tg { color: var(--muted); font-size: 11px; }
#tree .more { color: var(--muted); padding: 6px; font-size: 12px; }
.stage { position: relative; min-height: 0; overflow: hidden; }
#view { position: absolute; inset: 0; }
#view canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.stats { position: absolute; left: 10px; top: 10px; background: rgba(20,23,30,.82); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; font-size: 12px; display: grid; grid-template-columns: auto auto; gap: 2px 12px; pointer-events: none; }
.stats b { font-variant-numeric: tabular-nums; text-align: right; }
.toolbar { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 4px; background: rgba(20,23,30,.85); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.toolbar button.on { background: var(--accent); color: #0d1020; border-color: var(--accent); }
.empty, .drop { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; }
.empty > div { border: 2px dashed var(--line); border-radius: 16px; padding: 28px; max-width: 460px; background: rgba(23,26,33,.7); }
.empty small, .drop small { color: var(--muted); display: block; }
.drop { background: rgba(108,140,255,.18); border: 3px dashed var(--accent); font-size: 18px; }
.busy { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(15,17,22,.6); font-size: 16px; }
[hidden] { display: none !important; }
.side { border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.tabs { display: flex; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 1; }
.tabs button { flex: 1; border: 0; border-radius: 0; background: none; padding: 10px 4px; min-height: 44px; justify-content: center; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.pane { padding: 12px 14px 24px; }
.pane h3 { font-size: 13px; margin: 16px 0 6px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 6px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.check { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; cursor: pointer; }
.selname { font-weight: 600; font-size: 15px; margin-bottom: 8px; word-break: break-all; }
.vec { display: grid; grid-template-columns: 80px repeat(3, 1fr); gap: 4px; align-items: center; margin-bottom: 4px; }
.vec input { width: 100%; min-width: 0; }
.field { display: grid; grid-template-columns: 80px 1fr auto; gap: 8px; align-items: center; margin-bottom: 6px; }
.field.col { grid-template-columns: 1fr; gap: 4px; }
.field input[type=color] { width: 56px; height: 32px; border: 1px solid var(--line); border-radius: 6px; background: none; padding: 2px; }
.field output { font-variant-numeric: tabular-nums; width: 3em; text-align: right; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chips button { min-height: 32px; padding: 4px 10px; border-radius: 999px; font-size: 12px; }
.notes p { margin: 6px 0; color: var(--warn); font-size: 13px; }
.banner { background: rgba(94,240,192,.12); border: 1px solid var(--accent2); border-radius: var(--radius); padding: 8px 10px; }
.oplist { padding-left: 20px; }
.oplist li { margin: 4px 0; }
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(255,255,255,.35); vertical-align: -2px; margin: 0 2px; }
.was { color: var(--muted); font-size: 12px; }
.verlist { list-style: none; padding: 0; margin: 8px 0; }
.verlist li { display: grid; grid-template-columns: auto auto 1fr auto; gap: 6px; align-items: center; padding: 6px; border-bottom: 1px solid var(--line); }
.verlist li.cur { background: rgba(108,140,255,.12); border-radius: 6px; }
.verlist .ab { display: flex; gap: 2px; }
.verlist .ab button { min-width: 30px; min-height: 30px; padding: 0 6px; font-size: 11px; justify-content: center; }
.verlist .ab button.on { background: var(--accent); color: #0d1020; border-color: var(--accent); }
.verlist .vn { font-weight: 700; font-variant-numeric: tabular-nums; }
.verlist .vl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.verlist .vl small { display: block; color: var(--muted); font-size: 11px; }
.verlist .rw { min-height: 30px; padding: 2px 8px; font-size: 12px; }
.compare { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; margin: 8px 0; }
.compare .imgs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.compare figure { margin: 0; }
.compare img { width: 100%; border-radius: 6px; background: #262b36; aspect-ratio: 4/3; object-fit: cover; }
.compare figcaption { font-size: 12px; text-align: center; color: var(--muted); }
.compare table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 8px 0; }
.compare td, .compare th { border-bottom: 1px solid var(--line); padding: 3px 4px; text-align: right; }
.compare td:first-child, .compare th:first-child { text-align: left; }
.compare .diff { color: var(--warn); }
.hum-ok { color: var(--accent2); font-weight: 700; font-size: 15px; }
.hum-ng { color: var(--warn); font-weight: 700; font-size: 15px; }
.humgrid { display: grid; grid-template-columns: auto auto 1fr; gap: 4px 10px; margin: 10px 0; font-size: 13px; align-items: start; }
.humgrid .ok { color: var(--accent2); }
.humgrid .ng { color: var(--danger); }
.humgrid small { color: var(--muted); word-break: break-all; }
.warn { color: var(--warn); }
.gen { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin: 8px 0; }
.gen .st { float: right; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #3a2f22; color: var(--warn); }
.gen .st.on { background: #1f3a33; color: var(--accent2); }
.genNote { background: rgba(255,207,90,.1); border: 1px solid var(--warn); border-radius: var(--radius); padding: 8px 10px; font-size: 13px; margin: 0 0 10px; }
.genPhs { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.genPh { background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.genPh button { min-height: 22px; padding: 0 6px; border: 0; background: none; }
.genBtns { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.genCmp { background: rgba(94,240,192,.12); border: 1px solid var(--accent2); border-radius: var(--radius); padding: 8px 10px; margin: 8px 0; font-size: 13px; }
.genJobs { list-style: none; padding: 0; margin: 4px 0; }
.genJobs li { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; margin: 6px 0; font-size: 13px; }
.genJobs .acts, .genCmp .acts { display: flex; gap: 6px; margin-top: 6px; }
.genJobs .st { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--panel2); color: var(--muted); }
.genJobs .st.working { background: #3a2f22; color: var(--warn); }
.genJobs .st.done { background: #1f3a33; color: var(--accent2); }
.genJobs .st.failed { background: #3a2224; color: var(--danger); }
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; width: min(480px, 92vw); }
dialog::backdrop { background: rgba(0,0,0,.55); }
dialog h2 { margin: 0 0 12px; font-size: 17px; }
dialog .field { grid-template-columns: 80px 120px auto; }
.result { background: var(--bg); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: #0f1117; border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; z-index: 10; }
#toast.show { opacity: 1; }
#toast.err { border-color: var(--danger); }
@media (max-width: 960px) {
  body { height: auto; min-height: 100%; }
  .layout { grid-template-columns: 1fr; grid-template-rows: 58vh auto auto; }
  .stage { grid-row: 1; }
  .side { grid-row: 2; border-left: 0; border-top: 1px solid var(--line); }
  .tree { grid-row: 3; border-right: 0; border-top: 1px solid var(--line); max-height: 50vh; }
  .brand small { display: none; }
}
