:root { --bg: #f6f5f2; --panel: #ffffff; --ink: #1d1d1f; --muted: #6b6b70; --line: #e2e0db; --accent: #1f6feb; --accent-ink: #fff; --warn: #b3261e; }
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
body { display: flex; overflow: hidden; }
#panel { width: 340px; flex: none; height: 100%; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); padding: 14px 16px 40px; }
#view { position: relative; flex: 1; height: 100%; overflow: hidden; background: #2b2b2e; }
#c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#photo { position: absolute; left: 0; top: 0; transform-origin: 0 0; user-select: none; pointer-events: none; max-width: none; }
#cursor { position: absolute; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.6); border-radius: 50%; pointer-events: none; transform: translate(-50%, -50%); }
#cursor.erase { border-style: dashed; }
#toast { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); background: rgba(20,20,22,.9); color: #fff; padding: 8px 14px; border-radius: 6px; max-width: 70%; }
#toast.err { background: var(--warn); }
#loading { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 16px; background: rgba(0,0,0,.35); }
h1 { font-size: 17px; margin: 0 0 12px; }
h2 { font-size: 15px; margin: 4px 0 10px; }
h3 { font-size: 13px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
section { border-top: 1px solid var(--line); padding: 12px 0; }
section:first-of-type { border-top: 0; padding-top: 0; }
.row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.row > select, .row > input[type=range] { flex: 1; min-width: 0; }
.col { display: flex; flex-direction: column; gap: 4px; margin: 10px 0 6px; }
.chk { display: flex; align-items: center; gap: 6px; margin: 6px 0; }
.muted { color: var(--muted); font-size: 12.5px; }
.btns { display: flex; gap: 8px; margin: 10px 0 0; align-items: center; }
.btns > button { flex: 1; }
button { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fafaf8; color: var(--ink); cursor: pointer; }
button:hover:not(:disabled) { border-color: #bdbab3; }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); width: 100%; }
button.danger { color: var(--warn); }
select, textarea { font: inherit; padding: 5px 6px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
textarea { resize: vertical; }
kbd { font: 11px ui-monospace, monospace; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; color: var(--muted); }
.seg { display: flex; gap: 14px; margin-bottom: 4px; }
#wf > div { display: none; }
#wf > div.on { display: block; }
.types { display: grid; gap: 2px; max-height: 330px; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; padding: 6px; }
.types label { display: flex; align-items: center; gap: 7px; padding: 3px 4px; border-radius: 4px; cursor: pointer; }
.types label:hover { background: #f2f1ed; }
.types label.dim { color: var(--muted); }
.sw { width: 12px; height: 12px; border-radius: 3px; flex: none; border: 1px solid rgba(0,0,0,.2); }
#degList { list-style: none; margin: 6px 0 10px; padding: 0; }
#degList li { display: grid; grid-template-columns: 12px 1fr auto; gap: 4px 8px; align-items: center; padding: 6px 4px; border-bottom: 1px solid var(--line); }
#degList li.sel { background: #eef4ff; }
#degList .t { cursor: pointer; }
#degList .d { grid-column: 2 / 4; }
#degList .acts button { padding: 2px 7px; font-size: 12px; }
progress { width: 100%; }
#previewBox img { width: 100%; cursor: zoom-in; border-radius: 4px; margin-top: 8px; background: #000; }
#previewBox .btns span { flex: 2; text-align: center; font-size: 12px; }
.keys td { vertical-align: top; padding: 3px 6px 3px 0; font-size: 12.5px; }
.keys td:first-child { white-space: nowrap; color: var(--muted); }
details summary { cursor: pointer; color: var(--muted); }
.def { margin: 6px 0 0; }

#login { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: var(--bg); }
#login[hidden] { display: none; }
#loginForm { width: 300px; padding: 22px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
#loginForm input { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; }
#loginForm .err { color: var(--warn); margin: 8px 0; font-size: 13px; }
#whoami { margin: -6px 0 10px; }
.pending { margin: 0 0 10px; padding: 7px 9px; border-radius: 6px; background: #fff4d6; border: 1px solid #e8c766; font-size: 12.5px; }
.types label .rid { font: 11px ui-monospace, monospace; color: var(--muted); min-width: 2.6em; }
.def .defhead { font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.def .defimg { display: block; width: 100%; max-width: 260px; margin: 4px 0 6px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
