:root {
  --bg: #1e1f24; --bg-2: #25262c; --bg-3: #2d2f36; --line: #3a3c44; --text: #e4e6eb; --muted: #9aa0ab;
  --blue: #3d9bff; --green: #3fbf5f; --purple: #8a6bff; --red: #ff5f6d; --bar: 52px; --status: 24px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: var(--bg); color: var(--text); font: 13px/1.45 "Segoe UI", system-ui, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); } .small { font-size: 12px; }

/* top bar */
.bar { height: var(--bar); display: flex; align-items: center; gap: 14px; padding: 0 12px; background: #16171b; border-bottom: 1px solid #000; }
body.in-app .bar { -webkit-app-region: drag; padding-right: 150px; }
body.in-app .bar button, body.in-app .bar a { -webkit-app-region: no-drag; }
.brand { display: flex; align-items: center; gap: 8px; letter-spacing: .12em; flex-shrink: 0; }
.brand img { width: 26px; height: 26px; border-radius: 6px; }
.brand span { color: var(--purple); font-weight: 800; }
.tools { display: flex; align-items: center; gap: 2px; flex: 1; overflow-x: auto; }
.tools button { display: flex; flex-direction: column; align-items: center; gap: 1px; background: none; border: 0; padding: 4px 10px;
  border-radius: 6px; cursor: pointer; font-size: 11px; color: #cfd3da; min-width: 54px; }
.tools button i { font-style: normal; line-height: 1; display: grid; place-items: center; height: 20px; }
.tools button:hover { background: #ffffff12; }
.tools button.play i { color: var(--green); }
.tools button.publish { background: linear-gradient(90deg, #7c5cff, #3d9bff); color: #fff; }
.tools .sep { width: 1px; height: 30px; background: var(--line); margin: 0 6px; }
.who { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font-size: 15px; }

/* layout */
.layout { display: grid; grid-template-columns: 230px 1fr 400px; height: calc(100vh - var(--bar) - var(--status)); }
.pane-title { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--muted); padding: 7px 10px; background: var(--bg-2);
  border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.pane-title button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 11px; }
.explorer { background: var(--bg-2); border-right: 1px solid var(--line); overflow-y: auto; }
.tree { padding: 6px 4px; }
.tree .group { padding: 8px 8px 4px; font-weight: 700; color: var(--muted); font-size: 11px; letter-spacing: .05em; }
.tree .item { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 4px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree .item:hover { background: #ffffff0d; }
.tree .item.sel { background: #3d9bff33; color: #fff; }
.tree .item .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.center { display: grid; grid-template-rows: auto minmax(0, 1fr) auto 170px; min-width: 0; min-height: 0; overflow: hidden; border-right: 1px solid var(--line); }
.tabs { display: flex; align-items: center; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.tab { padding: 7px 16px; background: var(--bg); border-right: 1px solid var(--line); border-top: 2px solid var(--blue); }
.dirty { margin-left: 8px; color: var(--muted); }
.editor { position: relative; min-height: 0; overflow: hidden; }
.editor .CodeMirror { position: absolute; inset: 0; height: auto; }
.output { background: #17181c; overflow-y: auto; font: 12.5px/1.5 Consolas, "Cascadia Code", monospace; padding: 6px 10px; }
.output .line { white-space: pre-wrap; }
.output .err { color: #ff8a95; cursor: pointer; }
.output .warn { color: #ffcf6a; }
.output .info { color: var(--muted); }
.output .time { color: #5d6370; margin-right: 8px; }
.right { display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; background: var(--bg-2); }
.viewport { position: relative; height: 260px; background: #000; flex-shrink: 0; }
.viewport iframe { width: 100%; height: 100%; border: 0; display: block; }
.vp-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); background: #111216; text-align: center; padding: 20px; }
#run-state { font-weight: 600; text-transform: none; letter-spacing: 0; }
#run-state.on { color: var(--green); }
.props { padding: 10px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.props label { display: block; color: var(--muted); font-size: 11.5px; font-weight: 600; }
.props input, .props select, .props textarea { display: block; width: 100%; margin-top: 3px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 5px; padding: 6px 8px; outline: none; resize: vertical; }
.props input:focus, .props textarea:focus, .props select:focus { border-color: var(--blue); }
.props input[type=color] { height: 32px; padding: 2px; }
.props .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.props .check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; }
.props .check input { width: auto; margin: 0; }
.thumb { aspect-ratio: 16/10; border: 1px dashed var(--line); border-radius: 6px; display: grid; place-items: center; color: var(--muted); background: var(--bg) center/cover; }
button.wide, .modal button { background: var(--bg-3); border: 1px solid var(--line); border-radius: 6px; padding: 7px 12px; cursor: pointer; }
button.wide:hover, .modal button:hover { filter: brightness(1.2); }
.status { height: var(--status); display: flex; gap: 22px; align-items: center; padding: 0 12px; background: #7c5cff; color: #fff; font-size: 12px; }
.status span:first-child { flex: 1; }
.status .bad { background: #b3263a; padding: 0 8px; border-radius: 3px; }

/* drawer + modal */
.drawer { position: fixed; top: var(--bar); right: 0; bottom: var(--status); width: min(560px, 100vw); background: #1a1b20; border-left: 1px solid var(--line);
  transform: translateX(100%); transition: transform .2s; z-index: 20; display: flex; flex-direction: column; box-shadow: -10px 0 30px #0008; }
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.drawer-head button { background: none; border: 0; cursor: pointer; font-size: 16px; color: var(--muted); }
.drawer-body { overflow-y: auto; padding: 4px 18px 30px; font-size: 13.5px; }
.drawer-body h3 { margin: 20px 0 6px; color: #b9a8ff; }
.drawer-body pre { background: #111216; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; font: 12.5px/1.5 Consolas, monospace; overflow-x: auto; margin: 6px 0; }
.drawer-body code { background: #111216; padding: 1px 5px; border-radius: 4px; font-family: Consolas, monospace; }
.modal { position: fixed; inset: 0; background: #000a; display: none; place-items: center; z-index: 40; }
.modal.open { display: grid; }
.modal-box { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 24px; width: min(560px, 92vw); box-shadow: 0 20px 60px #000a; }
.modal-box h2 { margin: 0 0 12px; }
.modal-box input { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; margin-bottom: 10px; }
.modal .primary { background: linear-gradient(90deg, #7c5cff, #3d9bff); border: 0; color: #fff; font-weight: 700; padding: 9px 18px; }
.templates { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin: 10px 0 16px; }
.template { background: var(--bg); border: 2px solid var(--line); border-radius: 8px; padding: 12px; cursor: pointer; text-align: center; }
.template.sel { border-color: var(--blue); }
.template div { font-size: 28px; }
#toast { position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%) translateY(100px); background: var(--bg-3); border: 1px solid var(--line);
  padding: 10px 18px; border-radius: 8px; transition: transform .25s; z-index: 60; font-weight: 600; }
#toast.show { transform: translateX(-50%); }
#toast.error { border-color: var(--red); color: #ff9aa4; }
.gate { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 80; text-align: center; padding: 20px; }
.gate .box { max-width: 460px; }
.gate a.btn, .gate button.btn { display: inline-block; background: linear-gradient(90deg, #7c5cff, #3d9bff); color: #fff; border: 0; border-radius: 8px; padding: 11px 22px; font-weight: 700; text-decoration: none; cursor: pointer; }

/* Axio syntax colours */
.cm-s-axio.CodeMirror { background: #1b1c21; color: #dfe3ea; font: 14px/1.55 "Cascadia Code", Consolas, monospace; }
.cm-s-axio .CodeMirror-gutters { background: #1b1c21; border-right: 1px solid #2a2c33; }
.cm-s-axio .CodeMirror-linenumber { color: #5b606c; }
.cm-s-axio .CodeMirror-cursor { border-left: 2px solid #9b8cff; }
.cm-s-axio .CodeMirror-activeline-background { background: #ffffff08; }
.cm-s-axio .CodeMirror-selected, .cm-s-axio .CodeMirror-focused .CodeMirror-selected { background: #3d9bff40; }
.cm-s-axio .CodeMirror-matchingbracket { color: #fff !important; background: #ffffff1c; }
.cm-s-axio .cm-keyword { color: #c792ea; font-weight: 600; }
.cm-s-axio .cm-def { color: #82aaff; font-weight: 600; }
.cm-s-axio .cm-builtin { color: #4fd6be; }
.cm-s-axio .cm-atom { color: #ff9e64; }
.cm-s-axio .cm-number { color: #ff9e64; }
.cm-s-axio .cm-string { color: #c3e88d; }
.cm-s-axio .cm-comment { color: #6b7385; font-style: italic; }
.cm-s-axio .cm-operator { color: #89ddff; }
.cm-s-axio .cm-variable-2 { color: #82aaff; }
.cm-s-axio .cm-property { color: #f0c674; }
.cm-error-line { background: #ff5f6d22 !important; }
.err-gutter { color: var(--red); font-size: 12px; padding-left: 3px; cursor: default; }
@media (max-width: 1100px) { .layout { grid-template-columns: 190px 1fr 330px; } }

.shots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.shot { position: relative; aspect-ratio: 16/9; border-radius: 4px; background: #000 center/cover; }
.shot button { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: #000b; color: #fff; cursor: pointer; line-height: 1; }
button.wide:disabled { opacity: .5; cursor: default; }

button svg, .item svg { vertical-align: -3px; }
.tpl-ic { color: #9b8cff; height: 34px; display: grid; place-items: center; }
#who img.avatar { object-fit: cover; }
.err-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ff5c7a; }
