:root {
  --bg: #15171a; --panel: #1d2024; --panel2: #252a2f; --line: #343a41; --text: #e3e6ea; --muted: #8d959e;
  --accent: #e2a03f; --accent2: #f4bd62; --ok: #59c27a; --warn: #e8b84a; --bad: #e0605a; --blue: #5aa6e0; --violet: #a684e8;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 13px/1.4 system-ui, "Segoe UI", sans-serif; overflow: hidden; }
body { display: grid; grid-template-columns: 290px 1fr 300px; grid-template-rows: auto 1fr; grid-template-areas: "top top top" "left view right"; }
.mono { font-family: ui-monospace, Consolas, monospace; }
.muted { color: var(--muted); } .small { font-size: 11.5px; } .big { font-size: 15px; font-weight: 600; }
button, select, input { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 5px; padding: 4px 8px; }
button { cursor: pointer; } button:hover:not(:disabled) { border-color: var(--accent); } button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); color: #1a1205; border-color: var(--accent); font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--accent2); }
button.danger:hover { border-color: var(--bad); color: var(--bad); }
button.wide { width: 100%; margin-top: 8px; padding: 7px; }
input[type=checkbox] { accent-color: var(--accent); vertical-align: -2px; }
input[type=number] { width: 100%; }
#top { grid-area: top; display: flex; align-items: center; gap: 14px; padding: 6px 12px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
#top .brand { font-weight: 700; letter-spacing: .3px; color: var(--accent2); }
#top .grp { display: flex; align-items: center; gap: 8px; }
#top .spacer { flex: 1; }
#levelToggles label { background: var(--panel2); border: 1px solid var(--line); border-radius: 5px; padding: 3px 8px; }
#left, #right { background: var(--panel); border-color: var(--line); border-style: solid; display: flex; flex-direction: column; min-height: 0; }
#left { grid-area: left; border-width: 0 1px 0 0; }
#right { grid-area: right; border-width: 0 0 0 1px; overflow-y: auto; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; border: 0; border-radius: 0; background: transparent; padding: 8px; color: var(--muted); }
.tabs button.on { color: var(--text); box-shadow: inset 0 -2px var(--accent); }
.tab { display: none; flex-direction: column; gap: 6px; padding: 8px; min-height: 0; flex: 1; }
.tab.on { display: flex; }
.list { flex: 1; overflow-y: auto; min-height: 0; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); }
.item { padding: 5px 8px; border-bottom: 1px solid #22262b; cursor: pointer; display: flex; gap: 6px; align-items: baseline; }
.item:hover { background: #20252b; } .item.on { background: #3a2f1c; }
.item .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .c { color: var(--muted); font-size: 11px; white-space: nowrap; }
.cathead { padding: 6px 8px 3px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--accent2); background: var(--panel); position: sticky; top: 0; }
.hint { color: var(--muted); font-size: 12px; }
.tag { font-size: 10.5px; padding: 0 5px; border-radius: 3px; background: #333; color: #ddd; white-space: nowrap; }
.tag.new { background: #23492f; color: #9ef0b5; } .tag.moved { background: #4a3d16; color: #ffd67a; } .tag.deleted { background: #4d2222; color: #ff9d97; }
.tag.save { background: #1f3a4f; color: #9fd2ff; } .tag.level { background: #333; color: #bbb; } .tag.other { background: #392b55; color: #d0b9ff; }
.tag.sp-bed { background: #3d2a4f; color: #e3c4ff; } .tag.sp-debug { background: #1f3a4f; color: #9fd2ff; } .tag.sp-start { background: #23492f; color: #9ef0b5; }
.tag.sp-portal { background: #213f45; color: #8ff0ff; } .tag.sp-tram { background: #4a3d16; color: #ffd67a; } .tag.sp-reaper { background: #4d2222; color: #ff9d97; } .tag.sp-pstart { background: #333; color: #ccc; }
#spawnCopy { margin-left: 6px; padding: 1px 6px; font-size: 11.5px; }
.tag.gone { background: #3a2a2a; color: #c99; } .tag.drop { background: #4a3a12; color: #f2cd76; }
#view { grid-area: view; position: relative; min-width: 0; min-height: 0; }
#c { width: 100%; height: 100%; display: block; outline: none; }
#toolbar { position: absolute; top: 8px; left: 8px; right: 8px; width: fit-content; margin: 0 auto; flex-wrap: wrap; justify-content: center; display: flex; white-space: nowrap; font-size: 12px; gap: 6px; align-items: center; background: rgba(29,32,36,.92); border: 1px solid var(--line); border-radius: 7px; padding: 4px 8px; }
#toolbar label { display: flex; align-items: center; gap: 4px; }
#toolbar select, #toolbar button { padding: 2px 6px; }
#toolbar button.on { border-color: var(--accent); color: var(--accent2); }
#toolbar .sep { width: 1px; height: 18px; background: var(--line); }
#status { position: absolute; left: 8px; bottom: 6px; color: #cfd5db; text-shadow: 0 1px 2px #000; font-size: 11.5px; pointer-events: none; white-space: pre; }
#loading { position: absolute; inset: 0; display: grid; place-content: center; gap: 10px; background: rgba(21,23,26,.85); z-index: 5; }
#loading[hidden] { display: none; }
#loading .bar { width: 320px; height: 6px; background: var(--panel2); border-radius: 3px; overflow: hidden; }
#loadFill { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
#loadText { text-align: center; color: var(--muted); }
#right section { padding: 10px 12px; border-bottom: 1px solid var(--line); }
#right h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.xyz { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 10px 0 4px; }
.xyz label { display: flex; flex-direction: column; font-size: 11px; color: var(--muted); }
.row { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.row button { flex: 1; }
#insTags { margin-top: 6px; display: flex; gap: 4px; flex-wrap: wrap; }
.note { margin-top: 8px; font-size: 12px; color: var(--warn); }
.note:empty { display: none; }
#log { max-height: 260px; overflow: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 5px; padding: 6px; font-size: 11px; white-space: pre-wrap; margin: 8px 0 0; }
#log:empty { display: none; }
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; max-width: 560px; }
dialog td { padding: 3px 12px 3px 0; } dialog td:first-child { color: var(--accent2); white-space: nowrap; }
@media (max-width: 900px) { body { grid-template-columns: 1fr; grid-template-rows: auto 50vh auto auto; grid-template-areas: "top" "view" "left" "right"; overflow: auto; } }
[hidden] { display: none !important; }
