/* Trixie Editor - the colour variables and themes are the same as Trixie Messenger's, so theme files work in both. */
:root {
  --accent: #8b5cf6;
  --accent-soft: color-mix(in srgb, var(--accent) 18%, transparent);
  --accent-strong: color-mix(in srgb, var(--accent) 80%, #fff);
  --danger: #f43f5e;
  --warn: #f59e0b;
  --ok: #22c55e;
  --radius: 10px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", Consolas, ui-monospace, monospace;
  font-size: 14px;
}
:root.fs-small { font-size: 13px; }
:root.fs-large { font-size: 16px; }
[data-theme="dark"] {
  --bg-0: #0f1117; --bg-1: #151821; --bg-2: #1b1f2a; --bg-3: #242938; --bg-hover: #2a3042;
  --line: #2b3142; --text: #e6e8ef; --text-2: #a3a9bb; --text-3: #6f768a; --shadow: 0 12px 40px rgba(0,0,0,.45);
  color-scheme: dark;
}
[data-theme="midnight"] {
  --bg-0: #000; --bg-1: #07080c; --bg-2: #0c0e14; --bg-3: #141722; --bg-hover: #1a1e2b;
  --line: #1c2030; --text: #e9ebf3; --text-2: #9aa1b5; --text-3: #616881; --shadow: 0 12px 40px rgba(0,0,0,.7);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg-0: #e9ebf1; --bg-1: #f2f3f7; --bg-2: #ffffff; --bg-3: #eef0f5; --bg-hover: #e6e8ef;
  --line: #dcdfe8; --text: #1b1e27; --text-2: #4e5568; --text-3: #8a90a2; --shadow: 0 12px 40px rgba(20,24,40,.18);
  color-scheme: light;
}
:root.reduce-motion *, :root.reduce-motion *::before, :root.reduce-motion *::after { animation: none !important; transition: none !important; }

/* ---------- bundled fonts (text tool and video titles) ---------- */
@font-face { font-family: "Comic Neue"; src: local("Comic Neue"), url(/fonts/ComicNeue-Regular.woff) format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Comic Neue"; src: local("Comic Neue Bold"), url(/fonts/ComicNeue-Bold.woff) format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Anton"; src: local("Anton"), url(/fonts/Anton-Regular.woff) format("woff"); font-display: swap; }
@font-face { font-family: "Caveat"; src: local("Caveat"), url(/fonts/Caveat.woff) format("woff"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Chewy"; src: local("Chewy"), url(/fonts/Chewy-Regular.woff) format("woff"); font-display: swap; }
@font-face { font-family: "Dancing Script"; src: local("Dancing Script"), url(/fonts/DancingScript.woff) format("woff"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Lobster"; src: local("Lobster"), url(/fonts/Lobster-Regular.woff) format("woff"); font-display: swap; }
@font-face { font-family: "Merriweather"; src: local("Merriweather"), url(/fonts/Merriweather-Regular.woff) format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Merriweather"; src: local("Merriweather Bold"), url(/fonts/Merriweather-Bold.woff) format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Orbitron"; src: local("Orbitron"), url(/fonts/Orbitron.woff) format("woff"); font-weight: 400 900; font-display: swap; }
@font-face { font-family: "Permanent Marker"; src: local("Permanent Marker"), url(/fonts/PermanentMarker-Regular.woff) format("woff"); font-display: swap; }
@font-face { font-family: "Playfair Display"; src: local("Playfair Display"), url(/fonts/PlayfairDisplay.woff) format("woff"); font-weight: 400 900; font-display: swap; }
@font-face { font-family: "Press Start 2P"; src: local("Press Start 2P"), url(/fonts/PressStart2P-Regular.woff) format("woff"); font-display: swap; }
@font-face { font-family: "Special Elite"; src: local("Special Elite"), url(/fonts/SpecialElite-Regular.woff) format("woff"); font-display: swap; }
@font-face { font-family: "Varela Round"; src: local("Varela Round"), url(/fonts/VarelaRound-Regular.woff) format("woff"); font-display: swap; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body { background: var(--bg-0); color: var(--text); font-family: var(--font); line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-strong); }
::selection { background: var(--accent-soft); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--text-3); text-align: center; }
.hidden { display: none !important; }
.faint { color: var(--text-3); }
.muted { color: var(--text-2); }
.small { font-size: .86em; }
.tiny { font-size: .78em; }
.center { text-align: center; }
.pad { padding: 16px; }
.pre { white-space: pre-line; }
.grow { flex: 1; min-width: 0; }
.rel { position: relative; }
.row { display: flex; gap: .6em; align-items: center; }
.row.end { align-items: flex-end; }
.row.wrap, .wrap { flex-wrap: wrap; }
.gap6 { gap: 6px; } .gap8 { gap: 8px; }
.spacer { flex: 1; }
.ic { flex: none; vertical-align: -3px; }
.danger-text { color: var(--danger) !important; }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.error-text { color: var(--danger); font-size: .9em; min-height: 1.2em; margin: .3em 0; }
code, .mono { font-family: var(--mono); font-size: .92em; }
h2, h3, h4 { margin: 0 0 .6em; }
h4 { margin-top: 1.2em; font-size: 1em; }
h4:first-child { margin-top: 0; }

/* ---------- controls ---------- */
.btn { border: 0; border-radius: 8px; padding: .5em .95em; background: var(--bg-3); cursor: pointer; font-weight: 600; transition: background .12s, transform .05s; white-space: nowrap; display: inline-flex; align-items: center; gap: .35em; justify-content: center; }
.btn:hover { background: var(--bg-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 85%, #000); }
.btn.danger { background: color-mix(in srgb, var(--danger) 85%, #000); color: #fff; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--bg-hover); }
.btn.sm { padding: .28em .65em; font-size: .86em; }
.btn.wide { width: 100%; padding: .7em; }
.icon-btn { border: 0; background: transparent; color: var(--text-2); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; display: inline-grid; place-items: center; flex: none; }
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn.on, .icon-btn.active { color: var(--accent-strong); background: var(--accent-soft); }
.icon-btn:disabled { opacity: .4; cursor: default; background: transparent; }
.icon-btn.sm { width: 24px; height: 24px; border-radius: 6px; }
.input, select.input, textarea.input { width: 100%; padding: .5em .7em; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-1); outline: none; transition: border-color .12s, box-shadow .12s; min-width: 0; }
.input.sm, select.input.sm { padding: .25em .5em; width: auto; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="number"].input { width: 100%; }
label.field, div.field { display: block; margin-bottom: .9em; flex: 1; min-width: 0; }
label.field > span, div.field > span { display: block; font-size: .76em; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); margin-bottom: .35em; }
label.field > small { display: block; margin-top: .3em; }
.check { display: inline-flex; align-items: center; gap: .5em; cursor: pointer; }
.check input, input[type="checkbox"] { accent-color: var(--accent); }
input[type="color"] { width: 34px; height: 28px; border: 1px solid var(--line); border-radius: 6px; padding: 2px; background: var(--bg-1); cursor: pointer; }
input[type="range"] { accent-color: var(--accent); }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .slider { position: absolute; inset: 0; background: var(--bg-3); border-radius: 22px; cursor: pointer; transition: background .15s; border: 1px solid var(--line); }
.switch .slider::before { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: var(--text-2); border-radius: 50%; transition: transform .15s, background .15s; }
.switch input:checked + .slider { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(16px); background: #fff; }
.switch input:disabled + .slider { opacity: .5; cursor: default; }
.seg { display: inline-flex; background: var(--bg-1); border: 1px solid var(--line); border-radius: 9px; padding: 2px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; border-radius: 7px; padding: .3em .75em; cursor: pointer; color: var(--text-2); font-weight: 600; display: inline-flex; gap: .3em; align-items: center; }
.seg button:hover { color: var(--text); background: var(--bg-hover); }
.seg button.on { background: var(--accent); color: #fff; }
.chip { display: inline-flex; align-items: center; gap: .25em; padding: .1em .55em; border-radius: 99px; background: var(--bg-3); font-size: .8em; font-weight: 600; margin-left: .4em; color: var(--text-2); }
.chip.danger { background: color-mix(in srgb, var(--danger) 25%, transparent); color: var(--danger); }
.kbd { font-family: var(--mono); font-size: .78em; color: var(--text-3); margin-left: 18px; }
.range-row { display: grid; grid-template-columns: minmax(90px, auto) 1fr 52px; gap: 10px; align-items: center; margin: 6px 0; }
.range-row .range-label { color: var(--text-2); font-size: .9em; }
.range-row .slider-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); font-size: .88em; }
.progress { height: 6px; border-radius: 6px; background: var(--bg-3); overflow: hidden; margin: 8px 0; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.notice { border: 1px solid var(--line); background: var(--bg-1); padding: 12px 14px; border-radius: 10px; margin: 10px 0; }
.notice .row { margin-top: 8px; }
.fp { display: block; word-break: break-all; background: var(--bg-3); padding: 6px 8px; border-radius: 6px; margin: 6px 0; font-size: .8em; }
.avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; font-size: .8em; flex: none; vertical-align: middle; }
.online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-left: 6px; }

/* ---------- toasts ---------- */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 200; align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; background: var(--bg-3); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 8px 8px 8px 14px; border-radius: 10px; max-width: min(460px, 90vw); animation: toast-in .18s ease-out; }
.toast.ok { border-left: 4px solid var(--ok); }
.toast.err { border-left: 4px solid var(--danger); }
.toast.warn { border-left: 4px solid var(--warn); }
.toast.out { opacity: 0; transform: translateY(8px); transition: .25s; }
.toast-text { flex: 1; word-break: break-word; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------- modals & menus ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); width: min(480px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; animation: pop .16s ease-out; }
.modal.wide { width: min(720px, 100%); }
.modal.xwide { width: min(940px, 100%); height: min(680px, calc(100vh - 32px)); }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.modal-head { display: flex; align-items: center; padding: 14px 14px 6px 20px; }
.modal-head h3 { margin: 0; font-size: 1.12em; }
.modal-body { padding: 8px 20px 16px; overflow: auto; flex: 1; min-height: 0; }
.modal-foot { display: flex; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); align-items: center; }
.menu { position: fixed; z-index: 150; min-width: 200px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 5px; overflow: auto; animation: pop .1s ease-out; }
.menu-item { display: flex; align-items: center; width: 100%; border: 0; background: transparent; padding: 6px 10px 6px 4px; border-radius: 6px; cursor: pointer; text-align: left; gap: 6px; white-space: nowrap; }
.menu-item:hover, .menu-item.open { background: var(--bg-hover); }
.menu-item:disabled { opacity: .45; cursor: default; background: transparent; }
.menu-item.danger { color: var(--danger); }
.menu-check { width: 20px; display: inline-grid; place-items: center; color: var(--text-2); }
.menu-label { flex: 1; }
.menu-sub-ic { color: var(--text-3); margin-left: 10px; }
.menu-sep { height: 1px; background: var(--line); margin: 4px 6px; }
.menu-title { padding: 4px 10px 6px; font-size: .8em; color: var(--text-3); font-weight: 600; }

/* ---------- sign in ---------- */
.auth-wrap { height: 100vh; display: grid; place-items: center; padding: 24px; overflow: auto;
  background: radial-gradient(1200px 600px at 10% -10%, var(--accent-soft), transparent 60%),
              radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%), var(--bg-0); }
.auth-card { width: min(420px, 100%); background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px; padding: 30px; box-shadow: var(--shadow); }
.auth-card h1 { margin: 0; font-size: 1.5em; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.brand img { width: 56px; height: 56px; border-radius: 50%; }

/* ---------- app frame ---------- */
#root { height: 100%; }
.app { height: 100vh; display: flex; flex-direction: column; }
.topbar { height: 48px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 10px 0 12px; background: var(--bg-1); border-bottom: 1px solid var(--line); }
.brand-mini { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-weight: 700; flex: none; }
.brand-mini img { width: 28px; height: 28px; border-radius: 50%; }
.avatar-btn { border: 0; background: transparent; padding: 2px; border-radius: 50%; cursor: pointer; }
.offline-chip { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }

/* ---------- home ---------- */
.home { flex: 1; overflow: auto; padding: 26px clamp(14px, 4vw, 48px) 40px; }
.home-hero h2 { font-size: 1.45em; font-weight: 700; }
.create-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 30px; }
.create-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-2); cursor: pointer; text-align: left; transition: transform .12s, border-color .12s, box-shadow .12s; }
.create-card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 6px 24px var(--accent-soft); }
.create-ic { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; color: #fff; margin-bottom: 8px; }
.c-draw .create-ic { background: linear-gradient(135deg, #a855f7, #ec4899); }
.c-photo .create-ic { background: linear-gradient(135deg, #0ea5e9, #22c55e); }
.c-video .create-ic { background: linear-gradient(135deg, #f97316, #e11d48); }
.c-import .create-ic { background: linear-gradient(135deg, #64748b, #334155); }
.home-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.home-toolbar h3 { margin: 0 8px 0 0; }
.home-toolbar .search { width: 220px; }
.home-toolbar .sort { width: auto; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.proj-card { border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); overflow: hidden; cursor: pointer; transition: border-color .12s, transform .12s; outline: none; }
.proj-card:hover, .proj-card:focus-visible { border-color: var(--accent); transform: translateY(-1px); }
.proj-thumb { position: relative; aspect-ratio: 16 / 10; display: grid; place-items: center; color: var(--text-3); overflow: hidden;
  background: repeating-conic-gradient(var(--bg-3) 0 25%, var(--bg-1) 0 50%) 0 0 / 16px 16px; }
.proj-thumb img { width: 100%; height: 100%; object-fit: contain; }
.kind-badge, .share-badge { position: absolute; top: 8px; display: inline-flex; align-items: center; gap: 3px; font-size: .74em; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: rgba(0,0,0,.6); color: #fff; }
.kind-badge { left: 8px; }
.share-badge { right: 8px; }
.proj-meta { padding: 10px 12px; position: relative; padding-right: 40px; }
.proj-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-more { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.empty { grid-column: 1 / -1; text-align: center; padding: 50px 10px; color: var(--text-3); }
.usage { margin-top: 26px; color: var(--text-3); font-size: .86em; display: flex; align-items: center; gap: 8px; }
.usage-bar { display: inline-block; width: 140px; height: 6px; background: var(--bg-3); border-radius: 6px; overflow: hidden; }
.usage-bar i { display: block; height: 100%; background: var(--accent); }

/* ---------- settings / admin ---------- */
.settings { display: grid; grid-template-columns: 190px 1fr; gap: 18px; height: 100%; min-height: 0; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--line); padding-right: 10px; }
.settings-tab { border: 0; background: transparent; text-align: left; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--text-2); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.settings-tab:hover { background: var(--bg-hover); color: var(--text); }
.settings-tab.on { background: var(--accent-soft); color: var(--text); }
.settings-pane { overflow: auto; padding-right: 6px; min-height: 0; }
.settings-modal .modal-body, .admin-modal .modal-body { overflow: hidden; }
.pref-row { display: flex; align-items: center; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pref-row > .pref-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.pref-row > select.input { width: auto; min-width: 180px; }
.theme-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 10px 0; }
.theme-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; background: var(--bg-1); }
.theme-card.in-use { border-color: var(--accent); }
.theme-card-name { display: flex; justify-content: space-between; align-items: center; }
.theme-swatch { display: flex; height: 26px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.theme-swatch i { flex: 1; }
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.theme-part { display: flex; flex-direction: column; gap: 3px; padding: 6px; border-radius: 8px; background: var(--bg-1); }
.theme-part-main { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.theme-part-text { display: flex; flex-direction: column; min-width: 0; }
.theme-part-hex { display: flex; gap: 6px; flex-wrap: wrap; }
.theme-grad-toggle { display: flex; align-items: center; gap: 4px; margin-left: 2px; cursor: pointer; }
.table-wrap { overflow: auto; max-height: 340px; border: 1px solid var(--line); border-radius: 10px; }
table.grid { width: 100%; border-collapse: collapse; font-size: .92em; }
table.grid th { text-align: left; font-size: .78em; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); padding: 8px 10px; position: sticky; top: 0; background: var(--bg-2); z-index: 2; }
table.grid td { padding: 7px 10px; border-top: 1px solid var(--line); }
table.grid tr.disabled td { opacity: .55; }
.admin-add .input { width: 180px; }
.share-list { display: flex; flex-direction: column; gap: 4px; margin: 10px 0 14px; }
.share-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; background: var(--bg-1); }
.share-row select { width: auto; }
.share-add { margin-bottom: 10px; }
.suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 5; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.suggest:empty { display: none; }
.suggest-item { border: 0; background: transparent; text-align: left; padding: 6px 8px; cursor: pointer; display: flex; align-items: center; gap: 4px; }
.suggest-item:hover { background: var(--bg-hover); }
.invite-out { width: 100%; }
.invite-out .input { flex: 1; }
.share-role { width: auto; }

@media (max-width: 720px) {
  .settings { grid-template-columns: 1fr; }
  .settings-nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 6px; }
  .theme-grid { grid-template-columns: 1fr; }
}

/* ======================================================================= editors (shared) */
.editor-app { overflow: hidden; }
.editor-title { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; margin-left: 10px; }
.title-btn { border: 0; background: transparent; font-weight: 700; font-size: 1.02em; padding: 4px 8px; border-radius: 6px; cursor: pointer; max-width: 32vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title-btn:hover { background: var(--bg-hover); }
.st-save { font-size: .82em; white-space: nowrap; }
.ro-banner { background: color-mix(in srgb, var(--warn) 18%, var(--bg-1)); color: var(--text); padding: 5px 14px; font-size: .88em; border-bottom: 1px solid var(--line); }
.read-only .pe-tools .tool-btn:not([data-tool="zoom"]):not([data-tool="hand"]):not([data-tool="picker"]) { opacity: .35; pointer-events: none; }

/* ======================================================================= drawing & photo editor */
.pe-menubar { display: flex; align-items: center; gap: 2px; padding: 2px 8px; background: var(--bg-1); border-bottom: 1px solid var(--line); flex: none; }
.menubar-item { border: 0; background: transparent; padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: .92em; }
.menubar-item:hover { background: var(--bg-hover); }
.pe-opts { display: flex; align-items: center; gap: 14px; padding: 5px 12px; min-height: 40px; background: var(--bg-2); border-bottom: 1px solid var(--line); flex: none; overflow-x: auto; white-space: nowrap; }
.pe-opts .opt { display: inline-flex; align-items: center; gap: 6px; font-size: .88em; color: var(--text-2); }
.pe-opts .opt-title { display: inline-flex; align-items: center; gap: 4px; font-size: .9em; margin-right: 6px; }
.pe-opts .opt-range { width: 90px; }
.pe-opts input.opt-num { width: 64px; padding: .2em .4em; }
.pe-opts .seg button { padding: .2em .55em; font-size: .9em; }
.pe-opts select.input.sm { max-width: 170px; }
.pe-body { flex: 1; display: grid; grid-template-columns: 48px 1fr 272px; min-height: 0; }
.pe-tools { background: var(--bg-1); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; overflow-y: auto; }
.tool-btn { width: 36px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); cursor: pointer; display: grid; place-items: center; flex: none; }
.tool-btn:hover { background: var(--bg-hover); color: var(--text); }
.tool-btn.on { background: var(--accent); color: #fff; }
.tool-sep { width: 26px; height: 1px; background: var(--line); margin: 6px 0; flex: none; }
.tool-swatches { position: relative; width: 36px; height: 36px; border: 0; background: transparent; cursor: pointer; flex: none; }
.tool-swatches span { position: absolute; width: 22px; height: 22px; border-radius: 5px; border: 2px solid var(--bg-1); box-shadow: 0 0 0 1px var(--line); background: var(--c); }
.ts-primary { left: 2px; top: 2px; z-index: 1; }
.ts-secondary { right: 2px; bottom: 2px; }
.pe-center { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pe-stage { flex: 1; position: relative; overflow: hidden; background: var(--bg-0); outline: none; touch-action: none; cursor: crosshair; }
.pe-stage canvas { position: absolute; left: 0; top: 0; }
.pe-overlay { pointer-events: none; }
.pe-stage[data-tool="hand"], .pe-stage.space { cursor: grab; }
.pe-stage.panning { cursor: grabbing !important; }
.pe-stage[data-tool="zoom"] { cursor: zoom-in; }
.pe-stage[data-tool="text"] { cursor: text; }
.pe-stage[data-tool="move"] { cursor: move; }
.pe-stage[data-tool="brush"], .pe-stage[data-tool="eraser"], .pe-stage[data-tool="clone"] { cursor: none; }
.pe-stage.space[data-tool] { cursor: grab; }
.pe-text-input { position: absolute; z-index: 3; background: transparent; border: 1px dashed var(--accent); outline: none; resize: none; padding: 0; margin: 0; overflow: hidden; white-space: pre; min-width: 20px; caret-color: var(--accent); }
.pe-status { display: flex; align-items: center; gap: 6px; padding: 3px 10px; font-size: .82em; color: var(--text-2); background: var(--bg-1); border-top: 1px solid var(--line); flex: none; }
.pe-status .zoom-range { width: 120px; }
.zoom-label { min-width: 58px; }
.pe-side { background: var(--bg-1); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.panel { border-bottom: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.panel.grow { flex: 1; }
.panel.history { max-height: 30%; }
.panel-head { border: 0; background: transparent; text-align: left; padding: 7px 10px; font-weight: 700; font-size: .78em; letter-spacing: .05em; text-transform: uppercase; color: var(--text-2); cursor: pointer; display: flex; align-items: center; gap: 4px; flex: none; }
.panel.collapsed .panel-body { display: none; }
.panel.collapsed .panel-head .ic { transform: rotate(-90deg); }
.panel-body { padding: 0 10px 10px; overflow: auto; min-height: 0; display: flex; flex-direction: column; flex: 1; }
.pe-colors { gap: 8px; }
.swatch-pair { display: flex; align-items: center; gap: 6px; }
.swatch { width: 20px; height: 20px; border-radius: 5px; border: 1px solid var(--line); cursor: pointer; padding: 0;
  background: linear-gradient(var(--c), var(--c)), repeating-conic-gradient(#ccc 0 25%, #fff 0 50%) 0 0 / 8px 8px; }
.swatch.big { width: 38px; height: 38px; border-radius: 8px; }
.swatch:hover { transform: scale(1.08); }
.hexes { margin-left: 4px; font-family: var(--mono); line-height: 1.5; }
.mini-bw { display: block; width: 12px; height: 12px; border: 1px solid var(--text-3); background: linear-gradient(135deg, #000 50%, #fff 50%); border-radius: 2px; }
.palette { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin-top: 6px; }
.palette .swatch { width: 100%; height: auto; aspect-ratio: 1; }
.pe-layers-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; min-height: 60px; }
.layer-row { display: flex; align-items: center; gap: 6px; padding: 3px 6px 3px 2px; border-radius: 7px; cursor: pointer; border: 1px solid transparent; }
.layer-row:hover { background: var(--bg-hover); }
.layer-row.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.layer-row.hid .lthumb, .layer-row.hid .lname { opacity: .45; }
.layer-row.drop { border-top: 2px solid var(--accent); }
.lthumb { width: 48px; height: 36px; border-radius: 4px; border: 1px solid var(--line); background: var(--bg-3); flex: none; }
.lname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9em; }
.lmeta { font-size: .74em; white-space: nowrap; }
.pe-layer-props { display: flex; align-items: center; gap: 6px; padding: 6px 0 2px; }
.pe-layer-props select { flex: 1; min-width: 0; }
.pe-layer-props input[type="range"] { width: 70px; }
.pe-layer-btns { display: flex; gap: 2px; justify-content: space-between; padding-top: 4px; }
.pe-history-list { display: flex; flex-direction: column; gap: 1px; }
.hist-item { border: 0; background: transparent; text-align: left; padding: 3px 6px; border-radius: 5px; cursor: pointer; font-size: .86em; display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-item:hover { background: var(--bg-hover); }
.hist-item.cur { background: var(--accent-soft); font-weight: 600; }
.hist-item.undone { opacity: .45; }
.pe-people { display: flex; align-items: center; gap: 4px; }
.pe-people .person { border-radius: 50%; box-shadow: 0 0 0 2px var(--pc); }
.live-dot { font-size: .72em; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); display: inline-flex; align-items: center; gap: 4px; margin-right: 4px; }
.live-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.live-dot.on { color: var(--ok); }
.live-dot.on::before { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 30%, transparent); }
.modal-back.fx-back { background: transparent; place-items: start end; padding: 120px 290px 0 0; pointer-events: none; }
.modal-back.fx-back .modal { pointer-events: auto; width: 360px; }
.anchor-grid { display: grid; grid-template-columns: repeat(3, 34px); gap: 4px; }
.anchor-grid button { height: 30px; border: 1px solid var(--line); background: var(--bg-1); border-radius: 6px; cursor: pointer; }
.anchor-grid button.on { background: var(--accent); }
.pick-grid { display: grid; grid-template-columns: 220px 1fr; gap: 14px; margin-bottom: 8px; }
.pick-sv { width: 220px; height: 150px; border-radius: 8px; cursor: crosshair; display: block; touch-action: none; }
.pick-hue { width: 220px; margin-top: 8px; accent-color: var(--text-2); }
.pick-preview { height: 46px; border-radius: 8px; border: 1px solid var(--line); margin-bottom: 10px; background: linear-gradient(var(--c), var(--c)), repeating-conic-gradient(#ccc 0 25%, #fff 0 50%) 0 0 / 10px 10px; }
.pick-native { width: 100%; height: 34px; }

/* ======================================================================= video editor */
.video-editor { overflow: hidden; }
.ve-body { flex: 1; display: grid; grid-template-columns: 290px 1fr 300px; min-height: 0; }
.ve-lib { background: var(--bg-1); border-right: 1px solid var(--line); display: grid; grid-template-columns: 64px 1fr; min-height: 0; }
.ve-lib-tabs { display: flex; flex-direction: column; gap: 4px; padding: 8px 4px; border-right: 1px solid var(--line); }
.ve-lib-tab { border: 0; background: transparent; border-radius: 8px; padding: 8px 2px; cursor: pointer; color: var(--text-2); display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: .68em; font-weight: 600; text-align: center; }
.ve-lib-tab:hover { background: var(--bg-hover); color: var(--text); }
.ve-lib-tab.on { background: var(--accent-soft); color: var(--text); }
.ve-lib-body { padding: 10px; overflow-y: auto; min-width: 0; }
.ve-lib-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.ve-lib-head h4 { margin: 0; }
.ve-drop { border: 1px dashed var(--line); border-radius: 8px; padding: 8px; text-align: center; margin-bottom: 10px; }
.ve-assets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ve-asset { border-radius: 8px; background: var(--bg-2); border: 1px solid var(--line); overflow: hidden; cursor: grab; }
.ve-asset:hover { border-color: var(--accent); }
.ve-asset-thumb { position: relative; aspect-ratio: 16 / 10; background: var(--bg-3); display: grid; place-items: center; color: var(--text-3); }
.ve-asset-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ve-asset.k-audio .ve-asset-thumb { background: linear-gradient(135deg, #0ea5e9, #6366f1); color: #fff; }
.ve-dur { position: absolute; left: 4px; bottom: 4px; background: rgba(0,0,0,.65); color: #fff; font-size: .7em; padding: 0 5px; border-radius: 4px; }
.ve-add { position: absolute; right: 4px; top: 4px; background: rgba(0,0,0,.6); color: #fff; opacity: 0; }
.ve-asset:hover .ve-add { opacity: 1; }
.ve-asset-name { font-size: .78em; padding: 4px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ve-uploads { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.ve-text-presets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ve-text-preset { border: 1px solid var(--line); border-radius: 8px; padding: 14px 6px; cursor: pointer; font-size: 1.05em; background: #1f2230; text-shadow: 0 1px 3px rgba(0,0,0,.5); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ve-text-preset:hover { border-color: var(--accent); }
.ve-bgs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ve-bg { aspect-ratio: 16 / 10; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; }
.ve-bg:hover { outline: 2px solid var(--accent); }
.ve-rec-btns { display: flex; flex-direction: column; gap: 8px; }
.ve-rec-btns .btn { justify-content: flex-start; }
.ve-rec-preview { width: 100%; border-radius: 8px; background: #000; max-height: 50vh; margin-bottom: 10px; }
.ve-rec-voice-ic { display: grid; place-items: center; height: 140px; color: var(--accent); }
.ve-rec-time { font-variant-numeric: tabular-nums; font-size: 1.2em; }
.ve-center { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg-0); }
.ve-preview-box { flex: 1; position: relative; display: grid; place-items: center; min-height: 0; overflow: hidden; }
.ve-canvas { background: #000; box-shadow: var(--shadow); display: block; }
.ve-selbox { position: absolute; border: 2px solid var(--accent); cursor: move; box-sizing: border-box; transform-origin: center; touch-action: none; }
.ve-handle { position: absolute; right: -7px; bottom: -7px; width: 13px; height: 13px; background: #fff; border: 2px solid var(--accent); border-radius: 3px; cursor: nwse-resize; }
.ve-transport { display: flex; align-items: center; gap: 4px; padding: 4px 10px; border-top: 1px solid var(--line); background: var(--bg-1); flex: none; }
.ve-play { width: 40px; height: 40px; background: var(--accent); color: #fff; border-radius: 50%; }
.ve-play:hover { background: color-mix(in srgb, var(--accent) 85%, #000); color: #fff; }
.ve-time { font-variant-numeric: tabular-nums; margin-left: 8px; color: var(--text-2); font-size: .9em; }
.ve-props { background: var(--bg-1); border-left: 1px solid var(--line); overflow-y: auto; min-height: 0; }
.ve-props-body { padding: 12px; }
.ve-props-head { margin-bottom: 8px; }
.ve-sec { border-top: 1px solid var(--line); padding: 10px 0; }
.ve-sec h5 { margin: 0 0 6px; font-size: .74em; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.ve-sec .range-row { grid-template-columns: 82px 1fr 46px; margin: 3px 0; }
.ve-sec .check { margin: 4px 0; font-size: .9em; }
.ve-sec textarea { resize: vertical; margin-bottom: 8px; }
.ve-looks .btn { font-size: .78em; }
.ve-clip-actions { border-top: 1px solid var(--line); padding-top: 10px; }
.ve-timeline { height: 36vh; min-height: 190px; display: flex; flex-direction: column; background: var(--bg-1); border-top: 1px solid var(--line); flex: none; }
.ve-tl-bar { display: flex; align-items: center; gap: 4px; padding: 4px 8px; border-bottom: 1px solid var(--line); flex: none; }
.ve-tl-bar .ve-zoom { width: 120px; }
.tl-sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.ve-tl-main { flex: 1; display: grid; grid-template-columns: 150px 1fr; min-height: 0; }
.ve-heads-col { border-right: 1px solid var(--line); overflow: hidden; }
.ve-heads-pad { height: 24px; border-bottom: 1px solid var(--line); }
.ve-head { height: 56px; display: flex; align-items: center; gap: 2px; padding: 0 4px 0 10px; border-bottom: 1px solid var(--line); }
.ve-head-name { flex: 1; min-width: 0; font-size: .82em; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: default; }
.ve-head.hid .ve-head-name { opacity: .5; }
.ve-tl-scroll { overflow: auto; position: relative; min-width: 0; }
.ve-tl-inner { position: relative; min-height: 100%; }
.ve-ruler-wrap { height: 24px; position: sticky; top: 0; z-index: 4; background: var(--bg-1); border-bottom: 1px solid var(--line); cursor: ew-resize; }
.ve-ruler { display: block; }
.ve-lane { position: relative; height: 56px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg-0) 60%, var(--bg-1)); }
.ve-lane.drop { background: var(--accent-soft); }
.ve-lane.hid { opacity: .5; }
.ve-clip { position: absolute; top: 4px; bottom: 4px; border-radius: 6px; overflow: hidden; cursor: grab; border: 2px solid transparent; background: #3b4256; color: #fff; user-select: none; touch-action: none; }
.ve-clip.t-video { background: #2c3e66; }
.ve-clip.t-image { background: #2f5a4a; }
.ve-clip.t-audio { background: #1e4b6e; }
.ve-clip.t-text { background: #6b3fa0; }
.ve-clip.sel { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); z-index: 2; }
.ve-clip.missing { background: repeating-linear-gradient(45deg, #7f1d1d, #7f1d1d 8px, #991b1b 8px, #991b1b 16px); }
.ve-strip { position: absolute; inset: 0; display: flex; opacity: .75; pointer-events: none; }
.ve-strip img { height: 100%; flex: 1; min-width: 0; object-fit: cover; }
.ve-wave { position: absolute; left: 0; right: 0; bottom: 2px; height: 28px; width: 100%; pointer-events: none; }
.ve-clip-label { position: absolute; left: 6px; top: 3px; right: 6px; font-size: .74em; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px rgba(0,0,0,.8); pointer-events: none; display: flex; align-items: center; gap: 3px; }
.ve-fade { position: absolute; top: 0; bottom: 0; pointer-events: none; }
.ve-fade.in { left: 0; background: linear-gradient(90deg, rgba(0,0,0,.55), transparent); }
.ve-fade.out { right: 0; background: linear-gradient(270deg, rgba(0,0,0,.55), transparent); }
.ve-tr-badge { position: absolute; left: 2px; bottom: 2px; font-size: .7em; color: #fde68a; pointer-events: none; }
.ve-trim { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; z-index: 1; }
.ve-trim.l { left: 0; }
.ve-trim.r { right: 0; }
.ve-clip.sel .ve-trim { background: rgba(255,255,255,.35); }
.ve-playhead { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: #ef4444; z-index: 5; pointer-events: none; }
.ve-playhead span { position: absolute; top: 0; left: -6px; width: 14px; height: 14px; background: #ef4444; border-radius: 3px 3px 50% 50%; }
.exporting .ve-timeline, .exporting .ve-lib, .exporting .ve-props { pointer-events: none; opacity: .6; }
.read-only .ve-clip { cursor: default; }

@media (max-width: 1100px) {
  .ve-body { grid-template-columns: 240px 1fr 250px; }
  .pe-body { grid-template-columns: 48px 1fr 230px; }
}

/* ---------- v1.1.0: Trixie Messenger accounts and guests ---------- */
.messenger-note { display: flex; align-items: center; gap: 6px; margin: 0 0 14px; }
.guest-box { margin-top: 14px; }
.or-line { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: .8em; margin: 6px 0 12px; }
.or-line::before, .or-line::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.otp-input { font-size: 1.3em; letter-spacing: .3em; text-align: center; }
.choose-stage .btn { margin-bottom: 6px; justify-content: flex-start; }
.guest-banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; margin: -6px 0 24px;
  background: color-mix(in srgb, var(--warn) 14%, var(--bg-2)); border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--line)); }
.expiry-chip { display: inline-flex; align-items: center; gap: 3px; font-size: .74em; font-weight: 600; color: var(--warn); margin-top: 2px; }
.claim-cols { display: grid; gap: 22px; }
.claim-cols.two { grid-template-columns: 1fr 1fr; }
.chip.src-messenger { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent-strong); }
.chip.src-guest { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.m-result { margin: 8px 0; }
@media (max-width: 720px) { .claim-cols.two { grid-template-columns: 1fr; } }
.pref-row > input.input.sm, .pref-row > select.input.sm { width: 130px; flex: none; }
.pref-row > select.input.sm { width: auto; max-width: 320px; }
