[hidden] { display: none !important; }
:root {
  --bg: #0e1116; --panel: #161b22; --panel2: #1c232c; --line: #2a333e; --text: #e6e9ee; --muted: #8b96a3;
  --accent: #22b8e6; --accent-ink: #04161d; --good: #3fb950; --warn: #d29922; --bad: #f85149;
  --radius: 8px; font-size: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: "Segoe UI", system-ui, -apple-system, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
header.top { display: flex; align-items: center; gap: 24px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; }
header.top .brand { font-weight: 700; font-size: 17px; letter-spacing: .2px; }
header.top .brand span { color: var(--accent); }
header.top nav { display: flex; gap: 4px; }
header.top nav a { color: var(--muted); padding: 6px 12px; border-radius: 6px; }
header.top nav a.on, header.top nav a:hover { color: var(--text); background: var(--panel2); text-decoration: none; }
header.top .right { margin-left: auto; display: flex; gap: 12px; align-items: center; color: var(--muted); }
main { padding: 20px; max-width: 1400px; margin: 0 auto; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card .n { font-size: 26px; font-weight: 700; }
.card .l { color: var(--muted); margin-top: 2px; }
section.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 20px; }
section.panel > h2 { margin: 0; padding: 14px 16px; font-size: 15px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
/* Collapsible panels: click the heading to expand/collapse. */
section.panel.collapsible > h2 { cursor: pointer; user-select: none; }
section.panel.collapsible > h2::before { content: '▾'; color: var(--muted); font-size: 12px; transition: transform .15s; }
section.panel.collapsible.collapsed > h2 { border-bottom: none; }
section.panel.collapsible.collapsed > h2::before { transform: rotate(-90deg); }
section.panel.collapsible.collapsed > :not(h2) { display: none; }
section.panel > h2 .grow { flex: 1; }
section.panel .body { padding: 16px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
tr:last-child td { border-bottom: 0; }
td.url { font-family: Consolas, monospace; font-size: 12px; color: var(--muted); word-break: break-all; max-width: 360px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; background: var(--panel2); border: 1px solid var(--line); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.pill.recording::before { background: var(--good); }
.pill.starting::before { background: var(--warn); }
.pill.problem::before { background: var(--bad); }
.btn { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; cursor: pointer; font: inherit; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 3px 9px; font-size: 12px; }
.grid, form.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px 16px; }
label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 12px; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
input, select, textarea { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; font: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { width: 100%; min-height: 120px; font-family: Consolas, monospace; font-size: 12px; }
.actions { display: flex; gap: 8px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.err { color: var(--bad); font-size: 12px; margin-top: 3px; }
.msg { margin-left: 8px; color: var(--muted); }
.keybox { position: fixed; inset: 0; background: rgba(0,0,0,.75); display: grid; place-items: center; z-index: 50; }
.keybox form { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; width: min(360px, 92vw); display: flex; flex-direction: column; gap: 12px; }
.keybox h2 { margin: 0; color: var(--accent); }
.keybox p { margin: 0; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.5; }
code { font-family: Consolas, monospace; font-size: 12px; background: var(--bg); padding: 1px 5px; border-radius: 4px; }
.tilegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.pick { max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: 8px; }
.pick label.check { padding: 3px 0; font-size: 13px; }
.pick h4 { margin: 8px 0 4px; color: var(--muted); font-size: 12px; text-transform: uppercase; }
.log { font-family: Consolas, monospace; font-size: 12px; white-space: pre-wrap; max-height: 320px; overflow: auto; color: var(--muted); }
@media (max-width: 700px) { header.top { flex-wrap: wrap; gap: 10px; } main { padding: 12px; } td.url { display: none; } }

.seg { display: inline-flex; }
.seg .btn { border-radius: 0; }
.seg .btn:first-child { border-radius: 6px 0 0 6px; }
.seg .btn:last-child { border-radius: 0 6px 6px 0; border-left: 0; }
.seg .btn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.bulk { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 16px; background: var(--panel2); border-bottom: 1px solid var(--line); }
img.thumb { width: 112px; height: 63px; object-fit: cover; border-radius: 4px; background: #000; display: block; }
img.thumb.none { visibility: hidden; }
.tree { padding: 8px 16px 16px; }
.tree details { margin: 2px 0; }
.tree summary { cursor: pointer; padding: 6px 4px; border-radius: 6px; }
.tree summary:hover { background: var(--panel2); }
.tree .lvl { margin-left: 22px; }
.trow { display: grid; grid-template-columns: 24px 120px minmax(160px, 1fr) 160px 110px 150px; gap: 12px; align-items: center; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.trow .tname { font-weight: 600; }
@media (max-width: 900px) { .trow { grid-template-columns: 24px 96px 1fr; } .trow > :nth-child(n+5) { display: none; } img.thumb { width: 90px; height: 51px; } }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: -4px 0 14px; }
.tab { background: none; border: 0; color: var(--muted); padding: 8px 14px; cursor: pointer; font: inherit; border-bottom: 2px solid transparent; }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
h4.sub { margin: 18px 0 8px; font-size: 13px; }
.brushes { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.brush { display: inline-flex; gap: 6px; align-items: center; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 5px 10px; cursor: pointer; font: inherit; font-size: 13px; }
.brush.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.sw { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.sw.A, .sched .c.A { background: #2ea043; }
.sw.M, .sched .c.M { background: #e5534b; }
.sw.N, .sched .c.N { background: #161b22; border: 1px solid var(--line); }
.sched { display: grid; grid-template-columns: 40px repeat(24, 1fr); gap: 2px; user-select: none; max-width: 900px; }
.sched .c { height: 26px; border-radius: 2px; cursor: crosshair; }
.sched .hh, .sched .dd { font-size: 11px; color: var(--muted); text-align: center; cursor: pointer; padding: 2px 0; }
.sched .dd { text-align: left; line-height: 26px; }
.sens { display: flex; gap: 6px; }
.sv { width: 36px; height: 32px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); cursor: pointer; font: inherit; }
.sv.on { outline: 2px solid var(--accent); }
.sv.s1 { color: #3fb9b0; } .sv.s2, .sv.s3 { color: #3fb950; } .sv.s4, .sv.s5 { color: #c9d14f; } .sv.s6, .sv.s7 { color: #e3a33b; } .sv.s8, .sv.s9 { color: #f85149; }

/* Camera editor as a pop-up window */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 39; }
section.panel.modal { position: fixed; top: 4vh; left: 50%; transform: translateX(-50%); width: min(1000px, 96vw); max-height: 92vh; overflow: auto; z-index: 40; margin: 0; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
section.panel.modal > h2 { position: sticky; top: 0; background: var(--panel); z-index: 1; }

.mzbrush { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.mzwrap { position: relative; max-width: 440px; aspect-ratio: 11 / 8; background: #000; border-radius: 6px; overflow: hidden; }
.mzwrap img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mzwrap img { width: 100%; display: block; }
.mzwrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.mznote { position: absolute; inset: 0; pointer-events: none; display: grid; place-items: center; color: var(--muted); font-size: 13px; padding: 20px; text-align: center; }
/* Zoom views: the draw surface, the rubber-band box and saved-view boxes */
#zv-wrap { cursor: crosshair; }
#zv-img { -webkit-user-drag: none; user-select: none; }
#zv-layer { position: absolute; inset: 0; pointer-events: none; }
.zvbox { position: absolute; border: 2px solid #3b82f6; background: rgba(59, 130, 246, 0.18); box-sizing: border-box; pointer-events: none; }
.zvbox b { position: absolute; left: 0; top: 0; font-size: 11px; font-weight: 600; background: rgba(0, 0, 0, 0.65); color: #fff; padding: 1px 5px; white-space: nowrap; border-bottom-right-radius: 4px; }
.pweye { position: relative; }
.pweye input { padding-right: 32px !important; }
.pweye-btn { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 6px; line-height: 0; }
.pweye-btn:hover { color: var(--text); }

#hs-layer { position: absolute; inset: 0; }
.hsmark { position: absolute; transform: translate(-50%, -50%); width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; color: #012; font-weight: 700; font-size: 13px; display: grid; place-items: center; cursor: grab; box-shadow: 0 1px 4px rgba(0,0,0,.6); user-select: none; }
.hs-swatch { display: inline-flex; gap: 4px; }
.hs-swatch button { width: 18px; height: 18px; border-radius: 4px; border: 2px solid transparent; cursor: pointer; padding: 0; }
.hs-swatch button.on { border-color: #fff; }
