@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Geist+Mono:wght@400;500&family=Unbounded:wght@600;700&display=swap");

:root {
  /* Dark with a purple cast; hot pink to violet for main actions, electric cyan for highlights */
  --bg: #0b0a12;
  --deep: #07060c;
  --soft: #14121f;
  --raise: #1c1929;
  --fg: #f2effb;
  --muted: rgba(242, 239, 251, .62);
  --dim: rgba(242, 239, 251, .4);
  --line: rgba(190, 170, 255, .09);
  --line-strong: rgba(190, 170, 255, .2);
  --hot: #ff2bd6;
  --violet: #8b5cf6;
  --cyan: #22d3ee;
  --grad: linear-gradient(135deg, #ff2bd6, #8b5cf6);
  --glow: 0 0 0 1px rgba(255, 43, 214, .35), 0 4px 22px rgba(255, 43, 214, .35);
  --focus: #c084fc;
  --pill: rgba(168, 85, 247, .24);
  --pill-text: #f3e8ff;
  --danger: #ff5c7a;
  --r: 8px;
  --r-card: 12px;
  --sans: "Inter", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --display: "Unbounded", "Inter", sans-serif;
  --code: "Geist Mono", ui-monospace, Menlo, Consolas, monospace;
  --top: 52px;
  --tools: 56px;
  --panel: 316px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font: 14px/1.45 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--cyan); }
::selection { background: var(--hot); color: #fff; }
input[type=checkbox], input[type=range] { accent-color: var(--hot); }
:focus-visible { outline: 1px solid var(--fg); outline-offset: 2px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--r); background: transparent; color: var(--fg); font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: rgba(232, 236, 234, .4); background: rgba(232, 236, 234, .04); }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; font-weight: 600; box-shadow: var(--glow); }
.btn.primary:hover { filter: brightness(1.12); background: var(--grad); border-color: transparent; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { color: var(--fg); background: rgba(232, 236, 234, .06); }
.icon-btn:disabled { opacity: .3; cursor: default; background: none; }
.icon-btn svg, .btn svg { width: 16px; height: 16px; }
.icon-btn.on { color: var(--hot); }
.icon-btn.done { color: var(--cyan); }

.seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--r); background: var(--soft); }
.seg button { height: 28px; padding: 0 11px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 12.5px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--fg); }
.seg button[aria-pressed="true"] { background: var(--pill); color: var(--pill-text); box-shadow: inset 0 0 0 1px rgba(192, 132, 252, .35); }
.seg.full { display: flex; }
.seg.full button { flex: 1; padding: 0 6px; }
.seg.icons button { display: grid; place-items: center; padding: 0; width: 32px; }
.seg.icons button svg { width: 15px; height: 15px; }

/* ---------- Top bar ---------- */
.top { position: fixed; inset: 0 0 auto; height: var(--top); display: flex; align-items: center; gap: 10px; padding: 0 12px 0 14px; border-bottom: 1px solid var(--line); background: var(--bg); z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--fg); font: 700 15px var(--display); text-decoration: none; letter-spacing: -.01em; white-space: nowrap; }
.brand i { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--grad); box-shadow: 0 0 16px rgba(255, 43, 214, .55); }
.brand i svg { width: 14px; height: 14px; }
.top .sep { width: 1px; height: 22px; background: var(--line-strong); }
.top .name { width: 220px; height: 32px; padding: 0 8px; border: 1px solid transparent; border-radius: 6px; background: none; font-weight: 500; }
.top .name:hover { border-color: var(--line); }
.top .name:focus { border-color: var(--line-strong); background: var(--deep); outline: none; }
.top .status { color: var(--dim); font-size: 12px; white-space: nowrap; }
.top .status.err { color: var(--danger); }
.top .spacer { flex: 1; }
.zoom { display: flex; align-items: center; gap: 2px; }
.zoom button.z { min-width: 50px; height: 28px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 12.5px; cursor: pointer; font-variant-numeric: tabular-nums; }
.zoom button.z:hover { color: var(--fg); background: rgba(232, 236, 234, .06); }

/* ---------- People editing together ---------- */
.peers { display: flex; align-items: center; }
.peers span { display: grid; place-items: center; width: 28px; height: 28px; margin-left: -6px; border-radius: 50%; border: 2px solid var(--bg); color: #0b0a12; font: 700 11px var(--sans); box-shadow: 0 0 10px var(--c); background: var(--c); cursor: default; }
.peers span.me { opacity: .55; box-shadow: none; }
.cursors { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 3; }
.cursor { position: absolute; left: 0; top: 0; transition: transform .09s linear; will-change: transform; }
.cursor svg { width: 18px; height: 18px; display: block; filter: drop-shadow(0 0 6px var(--c)); }
.cursor b { position: absolute; left: 14px; top: 16px; padding: 2px 7px; border-radius: 6px; background: var(--c); color: #0b0a12; font: 600 11px var(--sans); white-space: nowrap; }

/* ---------- Editor layout ---------- */
.editor { position: fixed; inset: var(--top) 0 0; display: grid; grid-template-columns: var(--tools) 1fr var(--panel); }
.editor.preview { grid-template-columns: 0 1fr 0; }
.editor.readonly:not(.preview) { grid-template-columns: 0 1fr var(--panel); }
.editor.readonly .tools { visibility: hidden; }
.editor.preview .tools, .editor.preview .panel { visibility: hidden; }

.tools { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 0; border-right: 1px solid var(--line); background: var(--bg); overflow-y: auto; scrollbar-width: none; }
.tools button { position: relative; display: grid; place-items: center; flex: none; width: 40px; height: 38px; border: 0; border-radius: var(--r); background: none; color: var(--muted); cursor: pointer; }
.tools button:hover { color: var(--fg); background: rgba(232, 236, 234, .06); }
.tools button svg { width: 19px; height: 19px; }
.tools hr { width: 26px; margin: 6px 0; border: 0; border-top: 1px solid var(--line); }
.tip { position: fixed; z-index: 50; padding: 5px 9px; border-radius: 6px; background: #000; color: #fff; font-size: 12px; pointer-events: none; white-space: nowrap; box-shadow: 0 4px 16px rgba(0,0,0,.4); }
.tip kbd { margin-left: 6px; color: var(--dim); font: 11px var(--code); }

.stage { position: relative; overflow: auto; background: var(--deep); }
.stage-inner { display: grid; place-items: center; min-width: 100%; min-height: 100%; padding: 28px; width: max-content; height: max-content; }
.board { position: relative; box-shadow: 0 0 0 1px var(--line-strong), 0 20px 60px rgba(0, 0, 0, .45); }
.board .bgfill { position: absolute; inset: 0; background-size: cover; background-position: center; }
.board.checker .bgfill { background: repeating-conic-gradient(#1d1a29 0% 25%, #171522 0% 50%) 0 0 / 24px 24px; }
.board .canvas-container { position: relative; }
.stage .dropping { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255, 43, 214, .12); border: 2px dashed var(--hot); color: var(--fg); font-weight: 600; font-size: 16px; pointer-events: none; z-index: 5; }
.stage .busy { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 999px; background: rgba(0, 0, 0, .8); color: var(--fg); font-size: 13px; z-index: 6; }
.spin { width: 15px; height: 15px; border: 2px solid rgba(232, 236, 234, .25); border-top-color: var(--hot); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.exit-preview { position: absolute; top: 14px; right: 14px; z-index: 6; }

/* Floating text toolbar while typing on the canvas */
.textbar { position: fixed; z-index: 8; display: flex; align-items: center; gap: 2px; padding: 4px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--raise); box-shadow: 0 10px 30px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 43, 214, .15); }
.textbar i { width: 1px; height: 18px; margin: 0 3px; background: var(--line-strong); }
.textbar .icon-btn.on { color: var(--hot); background: var(--pill); }
.textbar .swatch { position: relative; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 6px; cursor: pointer; }
.textbar .swatch:hover { background: rgba(242, 239, 251, .06); }
.textbar .swatch::after { content: ""; width: 16px; height: 16px; border-radius: 4px; background: var(--sw, #fff); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3); }
.textbar .swatch.hl::after { border-radius: 3px; box-shadow: inset 0 0 0 2px var(--raise), 0 0 0 1px rgba(255,255,255,.3); }
.textbar .swatch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.tools button.on { color: var(--hot); background: var(--pill); }
.selnote { margin: 0 0 10px; padding: 7px 10px; border-radius: 8px; background: var(--pill); color: var(--pill-text); font-size: 12px; }

/* ---------- Right panel ---------- */
.panel { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); background: var(--bg); }
.tabs { display: flex; gap: 2px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; height: 30px; border: 0; border-radius: 6px; background: none; color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer; }
.tabs button:hover { color: var(--fg); }
.tabs button[aria-selected="true"] { background: var(--soft); color: var(--fg); }
.pane { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.pane.chat { display: flex; flex-direction: column; overflow: hidden; }

.props section { padding: 12px 14px 14px; border-bottom: 1px solid var(--line); }
.props section > h3 { display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; font-size: 12.5px; font-weight: 600; color: var(--fg); cursor: pointer; user-select: none; }
.props section > h3::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--dim); border-bottom: 1.5px solid var(--dim); transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s; }
.props section.closed > h3 { margin: 0; }
.props section.closed > h3::after { transform: rotate(-45deg); }
.props section.closed > :not(h3) { display: none; }
.props .head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.props .head .kind { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--pill); color: var(--hot); flex: none; }
.props .head .kind svg { width: 15px; height: 15px; }
.props .head input { flex: 1; min-width: 0; height: 30px; padding: 0 8px; border: 1px solid transparent; border-radius: 6px; background: none; font-weight: 600; }
.props .head input:hover { border-color: var(--line); }
.props .head input:focus { border-color: var(--line-strong); background: var(--deep); outline: none; }
.props .empty { padding: 28px 18px; color: var(--dim); text-align: center; }

.f { display: grid; gap: 5px; margin-top: 10px; min-width: 0; }
.f:first-of-type, h3 + .f, h3 + .row > .f { margin-top: 0; }
.f > label, .f > .lbl { color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; gap: 8px; }
.f > label b { color: var(--fg); font-weight: 500; font-variant-numeric: tabular-nums; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; align-items: end; }
.row.three { grid-template-columns: 1fr 1fr 1fr; }
.row.four { grid-template-columns: repeat(4, 1fr); }
.row > .f { margin-top: 0; }
.row.tight { margin-top: 6px; }
.inp, .props select, .props textarea, #actionsPane select, #actionsPane textarea, .dlg input[type=text], .dlg input[type=number], .dlg select {
  width: 100%; min-width: 0; height: 30px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--deep); color: var(--fg); font-size: 13px; }
.props textarea { height: auto; min-height: 64px; padding: 6px 8px; resize: vertical; line-height: 1.4; }
.inp:focus, .props select:focus, .props textarea:focus, #actionsPane select:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px rgba(192, 132, 252, .15); }
.num { position: relative; }
.num .inp { padding-right: 22px; font-variant-numeric: tabular-nums; }
.num i { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); color: var(--dim); font: normal 11px var(--sans); pointer-events: none; }
.num.drag > span { position: absolute; left: 0; top: 0; bottom: 0; width: 22px; cursor: ew-resize; display: grid; place-items: center; color: var(--dim); font-size: 11px; }
.num.drag .inp { padding-left: 22px; }
.color { display: flex; gap: 6px; align-items: center; }
.color input[type=color] { flex: none; width: 30px; height: 30px; padding: 0; border: 1px solid var(--line-strong); border-radius: 6px; background: none; cursor: pointer; }
.color input[type=color]::-webkit-color-swatch-wrapper { padding: 3px; }
.color input[type=color]::-webkit-color-swatch { border: 0; border-radius: 3px; }
.color .inp { font: 12px var(--code); }
.color input[type=range] { flex: 1; margin: 0; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--fg); font-size: 13px; cursor: pointer; }
.check input { margin: 0; }
.note { margin: 8px 0 0; color: var(--dim); font-size: 12px; line-height: 1.45; }
.note code, .dlg code { font: 11.5px var(--code); color: var(--muted); }
.btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.btns .btn { flex: 1; }
.stepper { display: grid; grid-template-columns: 30px 1fr 30px; gap: 4px; }
.stepper .btn { padding: 0; height: 30px; }
.stepper .inp { text-align: center; font-variant-numeric: tabular-nums; }
.iconrow { display: flex; justify-content: space-between; gap: 2px; margin-top: 10px; }
.iconrow:first-of-type { margin-top: 0; }

/* Layers */
.layers { list-style: none; margin: 0; padding: 6px; }
.layers li { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 4px 0 8px; border-radius: 6px; cursor: pointer; user-select: none; }
.layers li:hover { background: rgba(232, 236, 234, .04); }
.layers li.sel { background: var(--pill); box-shadow: inset 2px 0 0 var(--hot); }
.layers li.sel .nm { color: var(--pill-text); }
.layers li.hidden .nm, .layers li.hidden .ic { opacity: .4; }
.layers li.drop-above { box-shadow: inset 0 2px 0 var(--cyan); }
.layers li.drop-below { box-shadow: inset 0 -2px 0 var(--cyan); }
.layers li.child { padding-left: 26px; }
.layers .ic { display: grid; place-items: center; width: 20px; color: var(--muted); flex: none; }
.layers .ic svg { width: 14px; height: 14px; }
.layers .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layers .nm input { width: 100%; height: 26px; padding: 0 6px; border: 1px solid var(--focus); border-radius: 5px; background: var(--deep); }
.layers .icon-btn { width: 26px; height: 26px; opacity: 0; }
.layers li:hover .icon-btn, .layers .icon-btn.on { opacity: 1; }
.layers .icon-btn svg { width: 14px; height: 14px; }
.layers-empty { padding: 28px 18px; color: var(--dim); text-align: center; }

/* Chat tab */
.pane.chat iframe { flex: 1; width: 100%; border: 0; background: #18181b; }
.pane.chat { position: relative; }
.pane.chat .empty { padding: 28px 18px; color: var(--dim); text-align: center; }
.pane.chat .empty p { margin: 0 0 12px; }
.chatsrc { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.chatchip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 24px; padding: 0 9px; border: 1px solid color-mix(in srgb, var(--pc) 40%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--pc) 12%, transparent); color: var(--fg); font: inherit; font-size: 11.5px; cursor: pointer; }
.chatchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatchip i { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--dim); }
.chatchip i.on { background: var(--pc); box-shadow: 0 0 6px var(--pc); }
.chatchip.off { opacity: .4; text-decoration: line-through; }
.chatlist { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 0 10px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.cm { position: relative; padding: 3px 12px 3px 18px; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.cm:hover { background: rgba(242, 239, 251, .03); }
.cm > i { position: absolute; left: 8px; top: 9px; width: 4px; height: 4px; border-radius: 50%; background: var(--pc); }
.cm b { margin-right: 6px; font-weight: 650; }
.cm span.act { font-style: italic; }
.cm img { height: 22px; margin: -3px 1px; vertical-align: middle; }
.cm em { display: block; color: var(--muted); font-size: 11.5px; font-style: normal; }
.cm.notice, .cm.ev { margin: 4px 8px; padding: 6px 10px 6px 14px; border-radius: 8px; background: color-mix(in srgb, var(--pc) 12%, var(--soft)); border-left: 2px solid var(--pc); }
.cm.ev span { font-weight: 600; }
.cm.ev > i, .cm.notice > i { display: none; }
.chatnew { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); height: 28px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--grad); color: #fff; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; box-shadow: 0 6px 20px rgba(0, 0, 0, .4); }

/* ---------- Sign in ---------- */
.login { position: fixed; inset: var(--top) 0 0; display: grid; place-items: center; }
.login-card { display: grid; gap: 12px; width: min(340px, calc(100vw - 32px)); padding: 28px; border: 1px solid var(--line); border-radius: 14px; background: var(--soft); }
.login-card h1 { margin: 0 0 4px; font: 700 20px var(--display); }
.login-card .inp { height: 38px; font-size: 14px; }
.login-card .btn { height: 38px; }
.note.err { margin: 0; color: var(--danger); min-height: 0; }
.note.err:empty { display: none; }

/* ---------- Home ---------- */
.home { position: fixed; inset: var(--top) 0 0; overflow-y: auto; background: radial-gradient(900px 420px at 12% -10%, rgba(255, 43, 214, .14), transparent 60%), radial-gradient(800px 420px at 95% 0%, rgba(139, 92, 246, .16), transparent 60%), var(--bg); }
.home-inner { max-width: 1180px; margin: 0 auto; padding: 36px 32px 60px; }
.home h1 { margin: 0 0 8px; font: 700 34px/1.1 var(--display); letter-spacing: -.02em; }
.home h2 { margin: 36px 0 14px; font-size: 15px; font-weight: 600; }
.home .lead { margin: 0; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--soft); overflow: hidden; cursor: pointer; text-align: left; padding: 0; transition: border-color .15s; }
.card:hover { border-color: rgba(255, 43, 214, .45); box-shadow: 0 0 26px rgba(255, 43, 214, .12); }
.card .thumb { position: relative; aspect-ratio: 16 / 9; background: repeating-conic-gradient(#1d1a29 0% 25%, #171522 0% 50%) 0 0 / 16px 16px; display: grid; place-items: center; overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.card .thumb .plus { color: var(--hot); filter: drop-shadow(0 0 10px rgba(255, 43, 214, .6)); }
.card .thumb .plus svg { width: 30px; height: 30px; }
.card .meta { display: flex; align-items: center; gap: 6px; padding: 10px 8px 10px 12px; }
.card .meta div { flex: 1; min-width: 0; }
.card .meta b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta span { color: var(--dim); font-size: 12px; }
.card.tpl .thumb { background: var(--deep); }
.tplgroup { grid-column: 1 / -1; margin-top: 4px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.card.tpl.vert .thumb { aspect-ratio: 9 / 16; }
.props .lbl { display: block; margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.card.tpl .meta span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home .bar { display: flex; align-items: center; gap: 10px; margin-top: 36px; }
.home .bar h2 { margin: 0; flex: 1; }
.home .none { color: var(--dim); padding: 18px 0; }

/* ---------- Menus and dialogs ---------- */
.menu { position: fixed; z-index: 60; min-width: 200px; padding: 5px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--raise); box-shadow: 0 12px 40px rgba(0, 0, 0, .5); }
.menu button { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; height: 32px; padding: 0 10px; border: 0; border-radius: 6px; background: none; color: var(--fg); font-size: 13px; text-align: left; cursor: pointer; }
.menu button:hover { background: rgba(232, 236, 234, .07); }
.menu button.danger { color: var(--danger); }
.menu button kbd { color: var(--dim); font: 11px var(--code); }
.menu hr { margin: 4px 0; border: 0; border-top: 1px solid var(--line); }

dialog.dlg { width: min(560px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--bg); color: var(--fg); box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
dialog.dlg::backdrop { background: rgba(0, 0, 0, .55); }
.dlg form, .dlg .body { padding: 22px 24px 20px; }
.dlg h2 { margin: 0 0 4px; font-size: 18px; font-weight: 650; }
.dlg p { margin: 6px 0 0; color: var(--muted); }
.dlg .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.dlg .linkrow { display: flex; align-items: center; gap: 6px; margin-top: 8px; padding: 4px 4px 4px 10px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--deep); }
.dlg .linkrow code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg); font-size: 12.5px; }
.dlg h3 { margin: 20px 0 0; font-size: 13.5px; font-weight: 600; }
.dlg ol { margin: 8px 0 0; padding-left: 1.2rem; color: var(--muted); }
.dlg ol li { margin: 3px 0; }
.dlg ol b { color: var(--fg); font-weight: 500; }
.sizes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.sizes .sizegroup { grid-column: 1 / -1; margin: 6px 0 -2px; color: var(--muted); font-size: 12px; font-weight: 600; }
.sizes .sizegroup:first-child { margin-top: 0; }
.sizes button { display: grid; gap: 2px; padding: 12px 10px; border: 1px solid var(--line-strong); border-radius: var(--r); background: none; cursor: pointer; text-align: left; }
.sizes button b { font-weight: 600; font-size: 13px; }
.sizes button span { color: var(--dim); font-size: 12px; }
.sizes button[aria-pressed="true"] { border-color: var(--hot); background: rgba(255, 43, 214, .1); box-shadow: 0 0 18px rgba(255, 43, 214, .18); }
.dlg .custom { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.dlg label.lbl { display: block; margin: 16px 0 6px; color: var(--muted); font-size: 12px; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 70; padding: 9px 16px; border-radius: 999px; background: #000; color: #fff; font-size: 13px; box-shadow: 0 6px 24px rgba(0,0,0,.5); }

/* Shortcuts dialog */
.keys { display: grid; grid-template-columns: 1fr auto; gap: 6px 18px; margin-top: 14px; font-size: 13px; }
.keys span { color: var(--muted); }
.keys kbd { font: 12px var(--code); color: var(--fg); }

/* ---------- Control dock (narrow, for an OBS custom dock) ---------- */
body.dock { height: auto; min-height: 100%; }
.dock-top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--bg); }
.dock-top b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.dock-top a.icon-btn { text-decoration: none; font-size: 15px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: none; }
.dot.on { background: #39ff88; box-shadow: 0 0 8px #39ff88; }
.dot.off { background: var(--danger); }
.dock main { padding: 4px 10px 20px; }
.dock h2 { margin: 16px 2px 8px; color: var(--muted); font-size: 12px; font-weight: 600; }
.dcard { padding: 10px 12px; margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.dname { font-weight: 600; font-size: 13px; margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dcard .big { font: 600 28px/1.1 var(--sans); font-variant-numeric: tabular-nums; color: var(--muted); }
.dcard .big.running { color: var(--fg); text-shadow: 0 0 14px rgba(34, 211, 238, .55); }
.dbtns { display: flex; gap: 6px; margin-top: 8px; }
.dbtns .btn { flex: 1; padding: 0 6px; }
.big-stepper { grid-template-columns: 40px 1fr 40px; }
.big-stepper .btn, .big-stepper .inp { height: 38px; }
.big-stepper .inp { font-size: 18px; font-weight: 600; }
.goalline { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12.5px; }
.goalline b { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }
.meter { height: 6px; margin: 6px 0 8px; border-radius: 3px; background: var(--deep); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--grad); box-shadow: 0 0 10px rgba(255, 43, 214, .5); transition: width .3s; }
.dtext { width: 100%; min-height: 54px; height: auto; padding: 6px 8px; resize: vertical; }
.dcard.vis { padding: 4px 6px; }
.visrow { display: flex; align-items: center; gap: 4px; height: 34px; padding-left: 6px; }
.visrow span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.visrow.off span { color: var(--dim); }
.dock-empty { padding: 24px 8px; color: var(--dim); text-align: center; }

/* ---------- Accounts and team ---------- */
.account { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px 0 4px; border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--fg); cursor: pointer; }
.account:hover { border-color: var(--line-strong); }
.account span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--grad); color: #fff; font: 700 11px var(--sans); }
.account b { font-weight: 500; font-size: 13px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people { display: grid; gap: 10px; margin-top: 14px; }
.person { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--soft); }
.person .av { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--c, var(--violet)); color: #0b0a12; font: 700 14px var(--sans); }
.person h3 { margin: 0; font-size: 15px; font-weight: 600; }
.person h3 small { margin-left: 8px; color: var(--dim); font-weight: 500; font-size: 12px; }
.person .meta { color: var(--dim); font-size: 12px; margin-top: 2px; }
.person .ctrls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.person select { height: 30px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--deep); color: var(--fg); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { height: 28px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 999px; background: none; color: var(--muted); font-size: 12.5px; cursor: pointer; }
.chip[aria-pressed="true"] { border-color: transparent; background: var(--pill); color: var(--pill-text); box-shadow: inset 0 0 0 1px rgba(192, 132, 252, .4); }
.chip:disabled { cursor: default; opacity: .7; }
.person .side { display: flex; gap: 6px; }
.permgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.permgrid .check { margin-top: 6px; }
.overlaypick { display: grid; gap: 2px; max-height: 260px; overflow-y: auto; margin-top: 10px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--deep); }
.overlaypick .check { margin-top: 4px; }
.linkbtn { padding: 0; border: 0; background: none; color: var(--cyan); font: inherit; text-decoration: underline; cursor: pointer; }
.dlg select { width: 100%; height: 34px; }
.dlg .lbl { display: block; margin: 16px 0 6px; color: var(--muted); font-size: 12px; }
.readonly-note { margin: 12px 14px; padding: 10px 12px; border-radius: 10px; background: var(--pill); color: var(--pill-text); font-size: 13px; line-height: 1.45; }
.dock.embed .dock-top { display: none; }
.dock.embed main { padding-top: 0; }
.chanstate { display: inline-flex; align-items: center; gap: 5px; color: var(--dim); font-size: 11.5px; font-weight: 500; }
.chanstate:not(:empty)::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.chanstate.on { color: #39ff88; } .chanstate.on::before { background: #39ff88; box-shadow: 0 0 6px #39ff88; }
.chanstate.wait::before { background: #facc15; }
.chanstate.off::before { background: var(--danger); }

/* ---------- Actions ---------- */
.acthead { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.acthead b { font-size: 12.5px; font-weight: 600; }
#rules { padding: 8px; display: grid; gap: 8px; }
#rules .empty { padding: 20px 10px; color: var(--dim); text-align: center; font-size: 13px; }
.rule { border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.rule.open { border-color: rgba(255, 43, 214, .4); box-shadow: 0 0 18px rgba(255, 43, 214, .08); }
.rule.off .rulehead div { opacity: .45; }
.rulehead { display: flex; align-items: center; gap: 8px; padding: 9px 8px 9px 10px; cursor: pointer; }
.rulehead input { margin: 0; }
.rulehead div { flex: 1; min-width: 0; }
.rulehead b { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rulehead span { display: block; color: var(--dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ruleedit { padding: 2px 12px 12px; border-top: 1px solid var(--line); }
.ruleedit > .lbl { margin-top: 14px; font-weight: 600; color: var(--fg); }
.ruleedit > select { width: 100%; margin-top: 6px; }
.platrow { display: flex; gap: 14px; }
.step { margin-top: 8px; padding: 8px 10px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--deep); }
.steptop { display: flex; align-items: center; gap: 2px; }
.steptop b { flex: 1; font-size: 12.5px; font-weight: 600; }
.step .f:first-of-type { margin-top: 6px; }
.activity { padding: 6px 14px 16px; border-top: 1px solid var(--line); }
.activity h4 { margin: 8px 0 6px; font-size: 12.5px; font-weight: 600; }
.activity ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.activity li { display: grid; grid-template-columns: auto 1fr; gap: 0 8px; font-size: 12px; }
.activity li time { grid-row: span 2; color: var(--dim); font-variant-numeric: tabular-nums; }
.activity li span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity li.none { display: block; color: var(--dim); }
.tabs button { font-size: 12.5px; }
#actionsPane { overflow-x: hidden; }
#rules { grid-template-columns: minmax(0, 1fr); }
.ruleedit, .step { min-width: 0; }
.ruleedit .row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.soundboard { padding: 6px 14px 12px; border-top: 1px solid var(--line); }
.sbhead { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 6px; font-size: 12.5px; }
.sbrow { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.sbrow .inp { flex: 1; height: 28px; }
.sbgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sbgrid .btn { justify-content: flex-start; overflow: hidden; }

/* ---------- Phones: canvas on top, toolbar strip, panels below ---------- */
@media (max-width: 760px) {
  .top { gap: 6px; padding: 0 8px; }
  .brand { font-size: 0; gap: 0; }
  .top .sep, .top .status, .top .zoom, #modes, .peers { display: none !important; }
  .top .name { flex: 1; width: auto; min-width: 0; }
  #obs { font-size: 0; gap: 0; padding: 0 10px; }
  .account { padding: 0 3px; border: 0; }
  .account b { display: none; }
  .editor { display: flex; flex-direction: column; }
  .stage { flex: none; height: 44vh; min-height: 220px; }
  .stage-inner { padding: 12px; }
  .tools { flex: none; flex-direction: row; height: 52px; padding: 0 6px; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: 1px solid var(--line); }
  .tools button { width: 42px; height: 42px; }
  .tools hr { width: 1px; height: 24px; margin: 0 6px; border: 0; border-left: 1px solid var(--line); }
  .panel { flex: 1; min-height: 0; border-left: 0; border-top: 1px solid var(--line); }
  .tabs { overflow-x: auto; }
  .tabs button { flex: none; padding: 0 12px; }
  .editor.readonly .tools { display: none; }
  .editor.preview .stage { flex: 1; height: auto; }
  .editor.preview .tools, .editor.preview .panel { display: none; }
  .tip { display: none; }
  .textbar { flex-wrap: wrap; max-width: calc(100vw - 16px); }
  .home-inner { padding: 24px 16px 48px; }
  .home h1 { font-size: 28px; }
  .home .bar { flex-wrap: wrap; }
  .person { grid-template-columns: auto 1fr; }
  .person .side { grid-column: 2; }
  .sizes { grid-template-columns: 1fr 1fr; }
}
.login-card .forgot { justify-self: center; font-size: 13px; }

/* ---------- Dashboard ---------- */
.hero { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: center; padding: 30px 32px; border: 1px solid rgba(255, 43, 214, .22); border-radius: 22px; background: linear-gradient(135deg, rgba(255, 43, 214, .08), rgba(139, 92, 246, .06) 50%, rgba(34, 211, 238, .05)); overflow: hidden; isolation: isolate; }
.hero-glow { position: absolute; inset: -40%; z-index: -1; background: conic-gradient(from 0deg, rgba(255,43,214,.22), rgba(139,92,246,.18), rgba(34,211,238,.16), rgba(255,43,214,.22)); filter: blur(70px); animation: heroSpin 18s linear infinite; opacity: .55; }
@keyframes heroSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .hero-glow { animation: none; } }
.eyebrow { margin: 0 0 8px; color: var(--cyan); font: 600 12px var(--sans); letter-spacing: .08em; text-transform: uppercase; }
.hero h1 { margin: 0 0 8px; font: 700 clamp(28px, 4vw, 40px)/1.08 var(--display); letter-spacing: -.02em; }
.hero .lead { margin: 0; color: var(--muted); font-size: 15.5px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.btn.ghost { border-color: transparent; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(2, minmax(118px, 1fr)); gap: 10px; }
.stat { padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(11, 10, 18, .55); backdrop-filter: blur(6px); }
.stat b { display: flex; align-items: center; gap: 8px; font: 700 26px/1 var(--display); }
.stat span { display: block; margin-top: 6px; color: var(--dim); font-size: 12px; }
.stat.hot b { color: var(--hot); text-shadow: 0 0 18px rgba(255, 43, 214, .6); }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--hot); box-shadow: 0 0 0 0 rgba(255, 43, 214, .7); animation: pulse 1.6s infinite; flex: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(255, 43, 214, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 43, 214, 0); } }
.card .thumb .badges { position: absolute; inset: 8px 8px auto; display: flex; justify-content: space-between; gap: 6px; pointer-events: none; }
.onair { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 7px; border-radius: 999px; background: rgba(11, 10, 18, .85); color: #fff; font: 700 10.5px var(--sans); letter-spacing: .06em; }
.tag { padding: 3px 8px; border-radius: 999px; background: rgba(11, 10, 18, .8); color: var(--muted); font-size: 11px; }
.card .meta .sub { display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.plats { display: inline-flex; gap: 3px; }
.plats i { width: 16px; height: 16px; border-radius: 4px; display: grid; place-items: center; font: 800 9px var(--sans); font-style: normal; }
.card.newcard .thumb { background: radial-gradient(circle at 50% 45%, rgba(255, 43, 214, .16), transparent 60%), repeating-conic-gradient(#1d1a29 0% 25%, #171522 0% 50%) 0 0 / 16px 16px; }
.cards .emptybox { grid-column: 1 / -1; padding: 26px; border: 1px dashed var(--line-strong); border-radius: 14px; color: var(--muted); text-align: center; }
.home-cols { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; margin-top: 36px; }
.box { padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--soft); min-width: 0; }
.box h2 { margin: 0 0 12px; font-size: 15px; }
.boxhead { display: flex; align-items: center; justify-content: space-between; }
.boxhead h2 { margin-bottom: 12px; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 300px; overflow-y: auto; }
.feed li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 6px; border-radius: 8px; font-size: 13px; }
.feed li:hover { background: rgba(242, 239, 251, .03); }
.feed li .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--violet); }
.feed li.ev .dot { background: var(--hot); box-shadow: 0 0 8px var(--hot); }
.feed li b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed li span { color: var(--dim); font-size: 12px; white-space: nowrap; }
.feed li small { display: block; color: var(--dim); font-size: 11.5px; }
.feed .none { display: block; color: var(--dim); padding: 6px; }
.crewlist { display: grid; gap: 8px; }
.crewlist .mate { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.crewlist .mate i { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: #0b0a12; font: 700 12px var(--sans); font-style: normal; }
.crewlist .mate span { color: var(--dim); font-size: 12px; margin-left: auto; }
.tplstrip { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 12px; margin-top: 12px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.tplstrip .card.tpl { flex: none; width: 200px; }
.tplstrip .card.tpl.vert { width: 132px; }
.tplstrip .card.tpl .meta { padding: 8px 10px; }
.tplstrip .card.tpl .meta b { font-size: 13px; }
.tplstrip .card.tpl .meta span { font-size: 11.5px; }
.tplstrip .tplgroup { display: none; }
.tplstrip.show-land .card.tpl.vert, .tplstrip.show-vert .card.tpl:not(.vert) { display: none; }
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; gap: 16px; padding: 18px 16px; border-radius: 18px; }
  .hero h1 { font-size: 24px; }
  .hero .lead { font-size: 14px; }
  .hero-actions { margin-top: 14px; gap: 6px; }
  .hero-actions .btn { height: 32px; padding: 0 11px; font-size: 12.5px; }
  #import { display: none; }
  .stats { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .stat { padding: 9px 8px; border-radius: 10px; }
  .stat b { font-size: 18px; gap: 5px; }
  .stat span { font-size: 10.5px; line-height: 1.25; margin-top: 4px; }
  .pulse { width: 7px; height: 7px; }
  .home .cards#list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  #list .card .meta { padding: 8px 6px 8px 10px; }
  #list .card .meta b { font-size: 13px; }
  #list .card .meta .sub { font-size: 11px; }
  .home .bar { gap: 8px; }
  .home-cols { grid-template-columns: 1fr; margin-top: 24px; }
}

/* Toolbar: each group has its own neon color */
.tools button { --tc: var(--muted); }
.tools button[data-cat="text"] { --tc: #22d3ee; }
.tools button[data-cat="live"] { --tc: #ff2bd6; }
.tools button[data-cat="audience"] { --tc: #c084fc; }
.tools button[data-cat="shape"] { --tc: #a3e635; }
.tools button[data-cat="media"] { --tc: #facc15; }
.tools button[data-cat="draw"] { --tc: #fb923c; }
.tools button svg { color: var(--tc); opacity: .78; transition: opacity .15s, filter .15s, transform .15s; }
.tools button:hover { background: color-mix(in srgb, var(--tc) 14%, transparent); }
.tools button:hover svg { opacity: 1; filter: drop-shadow(0 0 6px var(--tc)); transform: scale(1.08); }
.tools button.on { background: color-mix(in srgb, var(--tc) 22%, transparent); }
.tools button.on svg { opacity: 1; filter: drop-shadow(0 0 6px var(--tc)); }

/* Dashboard templates: a compact, contained strip */
.tplstrip { padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: rgba(11, 10, 18, .35); }
.tplstrip .card.tpl { width: 156px; }
.tplstrip .card.tpl.vert { width: 88px; }
.tplstrip .card.tpl .meta { padding: 6px 8px; }
.tplstrip .card.tpl .meta b { font-size: 12px; }
.tplstrip .card.tpl .meta span { display: none; }

/* GIF library */
dialog.gifdlg { width: min(720px, calc(100vw - 32px)); }
.gifdlg #gifQ { width: 100%; height: 38px; margin-top: 12px; }
.gifgrid { columns: 4 140px; column-gap: 8px; height: min(56vh, 520px); overflow-y: auto; margin-top: 12px; padding-right: 4px; }
.gifgrid button { display: block; width: 100%; margin: 0 0 8px; padding: 0; border: 0; border-radius: var(--r); overflow: hidden; background: var(--raise); cursor: pointer; break-inside: avoid; }
.gifgrid button img { display: block; width: 100%; height: auto; }
.gifgrid button:hover, .gifgrid button:focus-visible { outline: 2px solid var(--hot); outline-offset: 0; }
.gifgrid button.busy { opacity: .45; pointer-events: none; }
.gifgrid .empty { column-span: all; padding: 40px 0; text-align: center; color: var(--muted); }
.gifdlg .actions { align-items: center; }
.gifdlg .giphy { margin: 0 auto 0 0; font-size: 11.5px; color: var(--dim); letter-spacing: .02em; }
.gifdlg .giphy b { color: var(--fg); font-weight: 800; letter-spacing: .06em; }

/* Drawing bar (shown while the brush is on) */
.drawbar { position: fixed; z-index: 8; display: flex; align-items: center; gap: 4px; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--raise); box-shadow: 0 14px 40px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 43, 214, .18); transform: translateX(-50%); }
.drawbar i { width: 1px; height: 22px; margin: 0 4px; background: var(--line-strong); }
.dswatches, .dsizes { display: flex; align-items: center; gap: 2px; }
.dswatch { position: relative; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.dswatch::after { content: ""; width: 18px; height: 18px; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); transition: transform .12s; }
.dswatch:hover::after { transform: scale(1.12); }
.dswatch.on { box-shadow: 0 0 0 2px var(--fg); }
.dswatch.custom::after { background: conic-gradient(#ff2bd6, #ffd60a, #a3ff12, #22d3ee, #8b5cf6, #ff2bd6); }
.dswatch.custom.on::after { background: var(--sw); }
.dswatch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dsize { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 8px; background: none; cursor: pointer; }
.dsize span { display: block; border-radius: 50%; background: var(--fg); opacity: .7; }
.dsize:hover { background: rgba(242, 239, 251, .06); }
.dsize.on { background: var(--pill); }
.dsize.on span { opacity: 1; background: var(--pill-text); }
.drawbar .icon-btn.on { color: var(--hot); background: var(--pill); }
.drawbar #dClear.confirm { width: auto; padding: 0 8px; color: var(--danger); font-size: 12px; font-weight: 600; }
.drawbar .btn.small { height: 30px; margin-left: 4px; padding: 0 12px; }
@media (max-width: 760px) { .drawbar { flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 16px); } }

/* Soundboard */
dialog.sounddlg { width: min(760px, calc(100vw - 32px)); }
.sounddlg .body { position: relative; }
.sdhead { display: flex; align-items: center; gap: 12px; }
.sdhead h2 { margin: 0; }
.sdhint { flex: 1; color: var(--dim); font-size: 12.5px; }
.sdpads { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; margin-top: 14px; max-height: 36vh; overflow-y: auto; }
.sdpad { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; min-height: 76px; padding: 10px 10px 8px 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: linear-gradient(160deg, color-mix(in srgb, var(--pc) 30%, var(--soft)), var(--soft) 70%); color: var(--fg); text-align: left; cursor: pointer; transition: transform .08s, box-shadow .15s; }
.sdpad:hover { box-shadow: 0 0 0 1px var(--pc), 0 6px 22px color-mix(in srgb, var(--pc) 35%, transparent); }
.sdpad:active, .sdpad.hit { transform: scale(.97); }
.sdpad.hit { box-shadow: 0 0 0 2px var(--pc), 0 0 28px var(--pc); }
.sdpad b { font-size: 13.5px; font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
.sdpad .row { display: flex; align-items: center; gap: 4px; }
.sdpad .row .icon-btn { width: 26px; height: 26px; }
.sdpad .row small { flex: 1; color: var(--dim); font-size: 11px; }
.sdpad input.inp { width: 100%; height: 26px; font-size: 12.5px; }
.sdpad input[type=range] { flex: 1; min-width: 0; accent-color: var(--pc); }
.sdpad.add { align-items: center; justify-content: center; border-style: dashed; background: none; color: var(--muted); font-size: 12.5px; text-align: center; }
.sdpad.add:hover { color: var(--fg); box-shadow: none; border-color: var(--hot); }
.sdpad.add svg { width: 18px; height: 18px; }
.sdempty { grid-column: 1 / -1; padding: 6px 0 2px; color: var(--muted); font-size: 12.5px; }
.sdlib { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.sdlibhead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sdlibhead h3 { margin: 0 !important; }
.sdcats { display: flex; gap: 4px; flex-wrap: wrap; }
.sdcats button { height: 26px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 999px; background: none; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; }
.sdcats button.on { border-color: transparent; background: var(--pill); color: var(--pill-text); }
.sdlibgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin-top: 10px; max-height: 24vh; overflow-y: auto; }
.sdlibitem { display: flex; align-items: center; gap: 2px; padding: 3px 3px 3px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.sdlibitem span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.sdlibitem .icon-btn { width: 26px; height: 26px; flex: none; }
.sdlibitem.have { opacity: .55; }
.sdcredit { margin: 0 auto 0 0 !important; font-size: 11.5px; color: var(--dim) !important; }
.sounddlg .actions { align-items: center; }
.sddrop { position: absolute; inset: 8px; display: grid; place-items: center; border: 2px dashed var(--hot); border-radius: 12px; background: rgba(255, 43, 214, .12); color: var(--fg); font-weight: 600; pointer-events: none; }
.sbopen { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0 4px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--soft); }
.sbopen b { font-size: 12.5px; }
.sbopen small { display: block; color: var(--dim); font-size: 11.5px; }

/* toolbar flyout and short screens */
.flyout { position: fixed; z-index: 9; display: flex; gap: 2px; padding: 4px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--raise); box-shadow: 0 12px 34px rgba(0, 0, 0, .5); }
.flyout button { display: grid; place-items: center; width: 38px; height: 36px; border: 0; border-radius: var(--r); background: none; cursor: pointer; --tc: #a3e635; }
.flyout button svg { width: 19px; height: 19px; color: var(--tc); }
.flyout button:hover { background: color-mix(in srgb, var(--tc) 14%, transparent); }
@media (max-height: 940px) and (min-width: 761px) {
  .tools { padding: 6px 0; gap: 1px; }
  .tools button { height: 33px; }
  .tools hr { margin: 4px 0; }
}

/* Files */
dialog.filesdlg { width: min(820px, calc(100vw - 32px)); }
.fhead { display: flex; align-items: center; gap: 16px; }
.fhead h2 { margin: 0; }
.fmeter { display: flex; align-items: center; gap: 10px; margin-left: auto; color: var(--muted); font-size: 12px; }
.fmeter > div { width: 140px; height: 6px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.fmeter i { display: block; height: 100%; border-radius: 99px; background: var(--grad); }
.fmeter.full i { background: var(--danger); }
.ftools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.fall { display: flex; align-items: center; gap: 6px; margin-left: auto; color: var(--muted); font-size: 12.5px; cursor: pointer; }
.fgrid { height: min(52vh, 480px); overflow-y: auto; margin-top: 12px; padding-right: 4px; }
.fgrid h4 { margin: 14px 0 8px; color: var(--muted); font-size: 12px; font-weight: 600; }
.fgrid h4:first-child { margin-top: 0; }
.fcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.fcard { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); overflow: hidden; cursor: pointer; }
.fcard:hover { border-color: var(--hot); }
.fcard .th { display: grid; place-items: center; height: 92px; background: repeating-conic-gradient(#1a1726 0 25%, #12101c 0 50%) 0 0 / 14px 14px; }
.fcard .th img, .fcard .th video { max-width: 100%; max-height: 92px; object-fit: contain; }
.fcard .th svg { width: 28px; height: 28px; color: var(--cyan); }
.fcard .meta { padding: 6px 8px 7px; }
.fcard .meta b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
.fcard .meta small { display: block; color: var(--dim); font-size: 11px; }
.fcard .meta small.used { color: #a3e635; }
.fcard .del { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; background: rgba(0, 0, 0, .65); opacity: 0; }
.fcard:hover .del, .fcard .del:focus-visible { opacity: 1; }
.fcard.busy { opacity: .45; pointer-events: none; }
.fempty { padding: 40px 0; text-align: center; color: var(--muted); }
.filesdlg .actions { align-items: center; }
.fnote { margin: 0 auto 0 0 !important; font-size: 11.5px; color: var(--dim) !important; }

/* Report a problem */
.mpreport { position: fixed; right: 14px; bottom: 14px; z-index: 7; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--raise); color: var(--muted); opacity: .55; cursor: pointer; transition: opacity .15s, color .15s, box-shadow .15s; }
.mpreport svg { width: 17px; height: 17px; }
.mpreport:hover, .mpreport:focus-visible { opacity: 1; color: var(--fg); box-shadow: 0 0 0 1px rgba(255, 43, 214, .4), 0 6px 20px rgba(255, 43, 214, .25); }
body:has(#editor:not([hidden])) .mpreport { right: calc(var(--panel) + 14px); }
.mpreportdlg #mprKind { margin-top: 14px; }
.mpreportdlg textarea { width: 100%; margin-top: 10px; padding: 9px 10px; resize: vertical; font: inherit; line-height: 1.45; }
.mpreportdlg input[type=email] { width: 100%; height: 34px; margin-top: 8px; }
.mprpic { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; font-size: 12.5px; }
.mprpic .check { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.mprpic #mprPicName { color: var(--muted); }
.mprnote { font-size: 11.5px; color: var(--dim) !important; }
.mpreportdlg .err { min-height: 0; margin: 8px 0 0; color: var(--danger) !important; font-size: 12.5px; }
.mpreportdlg .err:empty { display: none; }
.mpthanks { position: fixed; right: 14px; bottom: 56px; z-index: 20; padding: 9px 14px; border-radius: 10px; background: var(--raise); border: 1px solid var(--line-strong); color: var(--fg); font-size: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
@media (max-width: 760px) { body:has(#editor:not([hidden])) .mpreport { right: 10px; bottom: 10px; } }
.reports { display: grid; gap: 10px; }
.report { padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: var(--r-card); background: var(--soft); }
.report.done { opacity: .6; }
.report header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.report header small { color: var(--dim); font-size: 12px; }
.report .ra { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.report .rk { padding: 2px 8px; border-radius: 999px; background: rgba(255, 92, 122, .16); color: #ff9db0; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.report .rk[data-k="idea"] { background: rgba(34, 211, 238, .14); color: #8ae9f7; }
.report .rk[data-k="other"] { background: var(--pill); color: var(--pill-text); }
.report .rt { margin: 10px 0 0; white-space: pre-wrap; line-height: 1.5; }
.report .rimg img { display: block; max-width: min(420px, 100%); max-height: 240px; margin-top: 10px; border-radius: 8px; border: 1px solid var(--line); }
.report details { margin-top: 10px; }
.report summary { color: var(--muted); font-size: 12px; cursor: pointer; }
.report pre { margin: 8px 0 0; padding: 10px; overflow-x: auto; border-radius: 8px; background: var(--deep); color: var(--muted); font: 11.5px/1.5 var(--code); white-space: pre-wrap; word-break: break-word; }

/* pinned sounds, always at the bottom of the sidebar */
.pinned { flex: none; padding: 8px 12px 10px; border-top: 1px solid var(--line); background: var(--bg); }
.pinhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-size: 12px; color: var(--muted); }
.pinhead b { font-weight: 600; }
.pinhead .icon-btn { width: 26px; height: 26px; }
.pingrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; max-height: 120px; overflow-y: auto; }
.pinpad { height: 34px; padding: 0 8px; overflow: hidden; border: 1px solid color-mix(in srgb, var(--pc) 45%, transparent); border-radius: 8px; background: color-mix(in srgb, var(--pc) 16%, var(--soft)); color: var(--fg); font: inherit; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; transition: transform .08s, box-shadow .15s; }
.pinpad:hover { box-shadow: 0 0 0 1px var(--pc), 0 0 16px color-mix(in srgb, var(--pc) 40%, transparent); }
.pinpad:active, .pinpad.hit { transform: scale(.96); }
.pinpad.hit { box-shadow: 0 0 0 2px var(--pc), 0 0 22px var(--pc); }
.sdpad .pin { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; opacity: .35; }
.sdpad:hover .pin { opacity: .8; }
.sdpad .pin.on { opacity: 1; color: var(--pc); }
.sdpad b { padding-right: 22px; }
.board .bgfill.still { clip-path: inset(0); }
.board .bgfill.still::before { content: ""; position: absolute; inset: -40px; background: var(--still) center / cover; filter: blur(22px) brightness(.65) saturate(1.25); }

/* first-time tips */
.tourshade { position: fixed; z-index: 30; border-radius: 12px; box-shadow: 0 0 0 2px var(--hot), 0 0 24px rgba(255, 43, 214, .45), 0 0 0 100vmax rgba(5, 4, 10, .62); pointer-events: none; transition: all .25s ease; }
.tourcard { position: fixed; z-index: 31; width: min(300px, calc(100vw - 16px)); padding: 14px 16px 12px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--raise); box-shadow: 0 20px 50px rgba(0, 0, 0, .6); transition: left .25s ease, top .25s ease; }
.tourcard small { color: var(--hot); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.tourcard b { display: block; margin-top: 4px; font-size: 15px; }
.tourcard p { margin: 6px 0 12px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.tourcard div { display: flex; align-items: center; gap: 6px; }
.tourcard div span { flex: 1; }
.tourcard .ghost { padding: 0 6px; border-color: transparent; background: none; color: var(--dim); }
