:root {
  --bg: #15171b; --panel: #1d2025; --panel-2: #252931; --panel-3: #2d323b; --line: #343a44;
  --text: #e6e8eb; --muted: #9aa3ae; --accent: #e2b13c; --accent-ink: #1b1608;
  --good: #6cc38a; --bad: #e66a5f; --info: #6aa8e6; --violet: #c98be0; --hover: rgba(226, 177, 60, .14);
  --left: 260px; --right: 340px;
  font: 13px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
button, select, input, textarea { font: inherit; color: inherit; }
h2 { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; font-weight: 600; }
h3 { font-size: 14px; margin: 0 0 6px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); } .spacer { flex: 1; } .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 11px; }
.hidden { display: none !important; }
button { cursor: pointer; border-radius: 5px; border: 1px solid var(--line); background: var(--panel-2); padding: 5px 10px; }
button:hover:not(:disabled) { border-color: #4a525e; } button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.danger { color: var(--bad); }
button.ghost { background: transparent; } button.small { padding: 2px 8px; font-size: 12px; }
button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
select, input, textarea { background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 4px 6px; min-width: 0; }
input[type=checkbox] { accent-color: var(--accent); }
textarea { width: 100%; resize: vertical; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
a { color: var(--info); }

/* top bar */
.top { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.brand i { width: 14px; height: 14px; background: var(--accent); border-radius: 3px; display: inline-block; box-shadow: 4px 4px 0 #8a6a2a; }
.top select { max-width: 220px; }
.people { display: flex; gap: 3px; }
.avatar { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: #111; border: 2px solid transparent; }
.avatar.away { opacity: .45; }
.me { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.role { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; padding: 1px 6px; border-radius: 8px; border: 1px solid var(--line); }
.status { color: var(--muted); font-size: 12px; max-width: 360px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status.err { color: var(--bad); }

/* layout */
.shell { display: grid; height: calc(100% - 44px); grid-template-columns: var(--left) minmax(0, 1fr) var(--right); }
.panel { background: var(--panel); overflow: auto; min-height: 0; }
.panel.left { border-right: 1px solid var(--line); } .panel.right { border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.panel section { padding: 12px; border-bottom: 1px solid var(--line); }
.center { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.tabs { display: flex; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 2; flex: none; }
.tabs button { border: 0; border-radius: 0; background: transparent; padding: 8px 14px; color: var(--muted); }
.tabs button.on { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.tabbody { flex: 1; overflow: auto; }
.count { font-size: 10px; background: var(--panel-3); border-radius: 8px; padding: 0 6px; margin-left: 4px; }

/* toolbar and viewport */
.toolbar { display: flex; align-items: center; gap: 5px; padding: 6px 10px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.toolbar label { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; }
.toolbar .tool { min-width: 30px; }
.viewport { flex: 1; position: relative; overflow: hidden; background: #0e1013; cursor: crosshair; touch-action: none; }
.viewport.pan { cursor: grab; } .viewport.panning { cursor: grabbing; } .viewport.readonly { cursor: default; }
.viewport #canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hud { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.6); padding: 3px 8px; border-radius: 4px; font-size: 11px; pointer-events: none; font-variant-numeric: tabular-nums; }
.hud.right { left: auto; right: 8px; }
.banner { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); background: rgba(29,32,37,.95); border: 1px solid var(--line); padding: 6px 12px; border-radius: 6px; font-size: 12px; pointer-events: none; }
.compare { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); display: flex; gap: 6px; align-items: center; background: rgba(29,32,37,.97); border: 1px solid var(--accent); padding: 6px 10px; border-radius: 6px; }
.compare b { color: var(--accent); }
.floatbar { position: absolute; display: flex; gap: 4px; background: rgba(29,32,37,.97); border: 1px solid var(--line); padding: 4px; border-radius: 6px; z-index: 3; }
.viewport .minimap { position: absolute; right: 8px; top: 8px; width: 180px; height: 140px; background: rgba(0,0,0,.55); border: 1px solid var(--line); border-radius: 4px; cursor: pointer; }
.empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 10px; color: var(--muted); text-align: center; padding: 20px; }
.loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(14,16,19,.6); color: var(--muted); }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 4px 8px; display: flex; gap: 6px; align-items: center; cursor: pointer; border-radius: 4px; white-space: nowrap; overflow: hidden; }
.list li:hover { background: var(--hover); } .list li.on { background: var(--accent); color: var(--accent-ink); }
.list li .k { font-size: 10px; color: var(--muted); width: 58px; flex: none; overflow: hidden; text-overflow: ellipsis; }
.list li.on .k, .list li.on .muted { color: var(--accent-ink); }
.list li .n { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.layers li { justify-content: space-between; cursor: default; }
.eye { border: 0; background: transparent; padding: 0 4px; color: var(--muted); font-size: 11px; }
.eye.off { opacity: .35; }
.filter { width: 100%; margin-bottom: 8px; }
.field { display: grid; grid-template-columns: 86px 1fr; gap: 4px 8px; align-items: center; margin-bottom: 6px; }
.field > span { color: var(--muted); font-size: 12px; }
.field .pair { display: flex; gap: 4px; } .field .pair input { width: 100%; }
.row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0 0 10px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.note { color: var(--muted); font-size: 12px; }
.warn { color: var(--bad); font-size: 12px; margin: 3px 0; }
.ok { color: var(--good); font-size: 12px; margin: 3px 0; }
.thumb { max-width: 100%; max-height: 120px; image-rendering: pixelated; background: #0e1013; border-radius: 4px; display: block; margin: 6px 0; }
.pill { display: inline-block; font-size: 10px; padding: 0 7px; border-radius: 8px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill.open { color: var(--info); border-color: var(--info); } .pill.queued, .pill.working { color: var(--violet); border-color: var(--violet); }
.pill.proposed, .pill.pending { color: var(--accent); border-color: var(--accent); }
.pill.resolved, .pill.accepted, .pill.staged { color: var(--good); border-color: var(--good); }
.pill.closed, .pill.rejected, .pill.stale { color: var(--muted); } .pill.failed { color: var(--bad); border-color: var(--bad); }

/* issues */
.issue { padding: 8px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.issue:hover { background: var(--hover); } .issue.on { background: var(--panel-3); box-shadow: inset 3px 0 0 var(--accent); }
.issue .t { display: flex; gap: 6px; align-items: baseline; } .issue .t b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.issue .m { color: var(--muted); font-size: 11px; margin-top: 2px; }
.comment { border-left: 2px solid var(--line); padding: 2px 8px; margin: 6px 0; }
.comment.rejection { border-color: var(--bad); }
.comment .who { color: var(--muted); font-size: 11px; }
.proposal { border: 1px solid var(--line); border-radius: 6px; padding: 8px; margin: 8px 0; background: var(--panel-2); }
.shots { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 6px 0; }
.shots figure { margin: 0; } .shots img { width: 100%; image-rendering: pixelated; border-radius: 4px; background: #0e1013; cursor: zoom-in; }
.shots figcaption { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.version { border-bottom: 1px solid var(--line); padding: 8px 12px; }
.histline { font-size: 11px; padding: 2px 12px; color: var(--muted); display: flex; gap: 8px; }
.histline b { color: var(--text); font-weight: 500; }

/* sign-in, modal, toast */
.signin { height: 100%; display: flex; align-items: center; justify-content: center; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; width: min(420px, 92vw); }
.card h1 { font-size: 20px; margin: 0 0 4px; }
.card input { width: 100%; margin: 8px 0; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; z-index: 20; }
.modal-body { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px; max-width: min(720px, 94vw); max-height: 90vh; overflow: auto; min-width: min(420px, 94vw); position: relative; }
.modal-body .close { position: absolute; right: 10px; top: 10px; }
.modal-body img.big { max-width: 100%; image-rendering: pixelated; }
.choices { display: flex; gap: 6px; margin: 4px 0 10px; }
.choices label { flex: 1; border: 1px solid var(--line); border-radius: 6px; padding: 8px; cursor: pointer; }
.choices label:has(input:checked) { border-color: var(--accent); background: var(--hover); }
.choices input { margin-right: 6px; }
.checks label { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0; font-size: 12px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--panel-3); border: 1px solid var(--line); padding: 8px 14px; border-radius: 6px; z-index: 30; max-width: 80vw; }
.toast.err { border-color: var(--bad); }
.keys { columns: 2; font-size: 12px; } .keys kbd { background: var(--panel-3); border-radius: 3px; padding: 0 5px; font-family: inherit; font-size: 11px; }

@media (max-width: 900px) {
  :root { --left: 0px; --right: 300px; }
  .panel.left { display: none; }
}
@media (max-width: 640px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: 1fr 45%; }
  .panel.right { border-left: 0; border-top: 1px solid var(--line); }
  .top select { max-width: 120px; }
  .status, .me .name { display: none; }
}
/* Export to Roblox */
#exportBtn { margin-right: 10px; }
.export h3, .modal h3 { font-size: 13px; margin: 14px 0 6px; }
.export-list { margin: 0 0 6px; padding-left: 18px; font-size: 12px; max-height: 240px; overflow: auto; }
.export-list li { margin: 3px 0; }
.export-list button { margin-left: 6px; }
.export-blocked { border-left: 3px solid var(--bad); padding-left: 10px; margin: 10px 0; }
.export-steps { font-size: 12px; padding-left: 18px; }
.export-steps li { margin: 4px 0; }
.export-done a.button { display: inline-block; text-decoration: none; padding: 6px 12px; border-radius: 6px; }
.export-done a.button.primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; border: 1px solid var(--accent); }
