/* Layout: app chrome (top bar, tool ribbon, text format strip) over a three-column workspace: slide list, stage with notes, format panel. */
:root {
  --bg: #eceeed; --panel: #fbfcfb; --panel-2: #f3f5f4; --line: #d6dcd9; --line-2: #c3cbc7;
  --fg: #17201c; --muted: #5b6863; --accent: #1d6b58; --accent-2: #e2efea; --accent-fg: #ffffff;
  --canvas: #dfe3e1; --danger: #b3261e; --danger-2: #fbe9e7; --sel: #1d7f68; --warn: #9a6400;
  --shadow: 0 1px 2px rgba(20,32,27,.08), 0 4px 16px rgba(20,32,27,.06);
  --page-shadow: 0 1px 3px rgba(20,32,27,.18), 0 8px 26px rgba(20,32,27,.10);
  --f-ui: "Instrument Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-brand: "Instrument Serif", Georgia, "Times New Roman", serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r: 8px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #111614; --panel: #181e1c; --panel-2: #1e2523; --line: #2b3431; --line-2: #3a4541;
  --fg: #e4ebe8; --muted: #93a19b; --accent: #5cc0a3; --accent-2: #1d3530; --accent-fg: #0b1512;
  --canvas: #0c100f; --danger: #f2867c; --danger-2: #3a1d1a; --sel: #5cc0a3; --warn: #e2b350;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3); --page-shadow: 0 1px 3px rgba(0,0,0,.5), 0 8px 26px rgba(0,0,0,.45);
  color-scheme: dark;
} }
:root[data-theme="dark"] {
  --bg: #111614; --panel: #181e1c; --panel-2: #1e2523; --line: #2b3431; --line-2: #3a4541;
  --fg: #e4ebe8; --muted: #93a19b; --accent: #5cc0a3; --accent-2: #1d3530; --accent-fg: #0b1512;
  --canvas: #0c100f; --danger: #f2867c; --danger-2: #3a1d1a; --sel: #5cc0a3; --warn: #e2b350;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3); --page-shadow: 0 1px 3px rgba(0,0,0,.5), 0 8px 26px rgba(0,0,0,.45);
  color-scheme: dark;
}
html, body { height: 100%; }
body { background: var(--bg); color: var(--fg); font-family: var(--f-ui); font-size: 14px; overflow: hidden; }
* { box-sizing: border-box; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
[data-i] { display: inline-flex; width: 18px; height: 18px; flex: none; }
[data-i] svg, .ib svg, .rb svg, .icon-btn > svg, .menu svg, .btn > svg { width: 18px; height: 18px; flex: none; }

.app { height: 100%; display: grid; grid-template-rows: auto auto auto minmax(0,1fr) auto; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line); min-width: 0; overflow: hidden; }
.brand { display: flex; align-items: center; gap: 7px; color: var(--accent); flex: none; }
.brand svg { width: 26px; height: 26px; }
.wordmark { font-family: var(--f-brand); font-size: 25px; line-height: 1; color: var(--fg); white-space: nowrap; }
.product { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); background: var(--accent-2); border-radius: 5px; padding: 3px 7px; }
.filebox { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.filename { border: 1px solid transparent; background: transparent; padding: 5px 8px; border-radius: 6px; font-weight: 600; min-width: 60px; width: 100%; max-width: 340px; text-overflow: ellipsis; }
.filename:hover { border-color: var(--line); }
.filename:focus { border-color: var(--accent); background: var(--panel-2); outline: none; }
.saved { font-size: 12px; color: var(--muted); white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.sep { width: 1px; height: 22px; background: var(--line); margin: 0 2px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--panel-2); border-color: var(--line-2); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-2); }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
.btn:disabled, .icon-btn:disabled { opacity: .45; cursor: default; }
.split { display: inline-flex; }
.split .btn:first-child { border-radius: var(--r) 0 0 var(--r); }
.split .caret-btn { border-radius: 0 var(--r) var(--r) 0; padding: 0 6px; border-left: 1px solid rgba(255,255,255,.3); }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: var(--r); border: 0; background: transparent; cursor: pointer; color: var(--fg); flex: none; }
.icon-btn:hover { background: var(--panel-2); }
.icon-btn.sm { width: 28px; height: 28px; }
.zoom { display: flex; align-items: center; gap: 2px; }
.zoom select { height: 30px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); padding: 0 6px; font-family: var(--f-mono); font-size: 12px; }

/* ---------- ribbon ---------- */
.ribbon { display: flex; align-items: stretch; gap: 0; padding: 4px 8px 0; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; }
.rgroup { position: relative; display: flex; gap: 1px; padding: 0 8px 15px; border-right: 1px solid var(--line); flex: none; }
.rgroup:last-child { border-right: 0; }
.rlabel { position: absolute; left: 0; right: 0; bottom: 2px; text-align: center; font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.rb { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 50px; height: 50px; padding: 3px 6px; border: 0; border-radius: var(--r); background: transparent; cursor: pointer; color: var(--fg); }
.rb svg { width: 20px; height: 20px; }
.rb span { font-size: 11.5px; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 3px; }
.rb:hover { background: var(--panel-2); }
.rb.on { background: var(--accent-2); color: var(--accent); }
.rb.on span { color: var(--accent); }
.caret { width: 0; height: 0; border-left: 3.5px solid transparent; border-right: 3.5px solid transparent; border-top: 4px solid currentColor; opacity: .7; }

/* ---------- format bar ---------- */
.fmtbar { display: flex; align-items: center; gap: 4px; min-height: 44px; padding: 5px 12px; background: var(--panel-2); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; }
.fmtbar .hint { color: var(--muted); font-size: 13px; white-space: nowrap; }
.fmtbar .hint.ed { margin-left: 8px; color: var(--accent); font-weight: 600; }
.fsel { height: 32px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); padding: 0 6px; max-width: 200px; flex: none; }
.fsel.small { width: 70px; }
.fsize { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); flex: none; }
.fsize input { width: 46px; height: 30px; border: 0; background: transparent; text-align: center; font-family: var(--f-mono); font-size: 13px; -moz-appearance: textfield; }
.fsize input::-webkit-inner-spin-button { display: none; }
.fsize .ib { width: 26px; height: 30px; }
.ib { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 0; border-radius: 6px; background: transparent; cursor: pointer; color: var(--fg); flex: none; font-size: 15px; }
.ib:hover { background: var(--panel); }
.ib.on { background: var(--accent-2); color: var(--accent); }
.ib.sm { width: 24px; height: 24px; } .ib.sm svg { width: 14px; height: 14px; }
.vsep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; flex: none; }
.colorbtn { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.colorbtn .clabel { font-weight: 700; font-size: 14px; line-height: 1; display: grid; place-items: center; height: 16px; }
.colorbtn .clabel svg { width: 15px; height: 15px; }
.colorbtn .cbar { width: 18px; height: 4px; border-radius: 2px; border: 1px solid rgba(0,0,0,.15); }

/* ---------- workspace ---------- */
.work { position: relative; display: grid; grid-template-columns: 220px minmax(0,1fr) 296px; min-height: 0; }
.app.no-side .work { grid-template-columns: 0 minmax(0,1fr) 296px; }
.app.no-insp .work { grid-template-columns: 220px minmax(0,1fr) 0; }
.app.no-side.no-insp .work { grid-template-columns: 0 minmax(0,1fr) 0; }
.app.no-side .slides-panel, .app.no-insp .inspector { display: none; }
.slides-panel { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--line); }
.slide-list { position: relative; flex: 1; overflow-y: auto; padding: 12px 10px 12px 6px; display: flex; flex-direction: column; gap: 10px; }
.slides-foot { display: flex; gap: 6px; align-items: center; padding: 8px 10px; border-top: 1px solid var(--line); }
.slides-foot .btn { flex: 1; }
.th { flex: none; position: relative; display: grid; grid-template-columns: 22px auto; align-items: start; gap: 4px; cursor: pointer; padding: 4px; border-radius: 8px; user-select: none; touch-action: none; }
.th:hover .thv { box-shadow: 0 0 0 2px var(--line-2); }
.thn { font-family: var(--f-mono); font-size: 11px; color: var(--muted); text-align: right; padding-top: 2px; }
.thv { position: relative; overflow: hidden; border-radius: 4px; box-shadow: 0 0 0 1px var(--line); background: #fff; pointer-events: none; }
.th.cur .thv { box-shadow: 0 0 0 2.5px var(--accent); }
.th.sel:not(.cur) .thv { box-shadow: 0 0 0 2px var(--accent); opacity: .9; }
.th.cur .thn { color: var(--accent); font-weight: 700; }
.th.hid .thv { opacity: .45; }
.thb { position: absolute; left: 4px; top: 22px; display: flex; flex-direction: column; gap: 2px; color: var(--muted); }
.thb i { width: 15px; height: 15px; display: grid; } .thb svg { width: 14px; height: 14px; }
.drop-marker { position: absolute; left: 30px; right: 10px; height: 3px; background: var(--accent); border-radius: 2px; pointer-events: none; }
.th-ghost { position: fixed; z-index: 80; pointer-events: none; opacity: .85; transform: rotate(-2deg) scale(.9); }

.center { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--canvas); }
.stage-wrap { position: relative; flex: 1; overflow: auto; display: grid; place-items: center; padding: 20px; min-height: 0; }
.stage { position: relative; flex: none; box-shadow: var(--page-shadow); background: #fff; }
.slide-host { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.stage.show-grid::after { content: ""; position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(to right, rgba(29,127,104,.16) 1px, transparent 1px), linear-gradient(to bottom, rgba(29,127,104,.16) 1px, transparent 1px); background-size: var(--grid) var(--grid); z-index: 2; }
.ovl { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.notes-bar { display: flex; flex-direction: column; gap: 4px; padding: 8px 14px 10px; background: var(--panel); border-top: 1px solid var(--line); }
.notes-bar label { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.notes-bar label [data-i] { width: 14px; height: 14px; }
.notes-bar textarea { width: 100%; height: 64px; resize: vertical; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); padding: 7px 9px; line-height: 1.45; }
.app.no-notes .notes-bar { display: none; }

/* ---------- slide content (shared by editor, thumbnails, slideshow) ---------- */
.sl { position: relative; overflow: hidden; flex: none; color: #000; font-family: Arial, sans-serif; line-height: normal; text-align: left; -webkit-font-smoothing: antialiased; }
.sl .o { position: absolute; box-sizing: border-box; }
.sl svg.oline { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.sl .oline .hit { pointer-events: stroke; stroke: transparent; fill: none; cursor: move; }
.o-shape .shp { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; }
.txw { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: flex-start; }
.txw.v-middle { justify-content: center; } .txw.v-bottom { justify-content: flex-end; }
.tx { position: relative; white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; outline: none; min-height: 1em; width: 100%; counter-reset: n; }
.tx .p { position: relative; margin: 0; }
.tx .p + .p { margin-top: var(--ps); }
.tx .p.lb, .tx .p.ln { padding-left: calc((var(--lvl, 0) + 1) * 1.1em); }
.tx .p.lb::before { content: "\2022"; position: absolute; left: calc(var(--lvl, 0) * 1.1em); font-weight: 400; font-style: normal; }
.tx .p:not(.ln) { counter-reset: n; }
.tx .p.ln { counter-increment: n; }
.tx .p.ln::before { content: counter(n) "."; position: absolute; left: calc(var(--lvl, 0) * 1.1em); font-weight: 400; font-style: normal; }
.tx.empty::before { content: attr(data-ph); position: absolute; left: 0; top: 0; right: 0; padding: inherit; opacity: .4; pointer-events: none; white-space: pre-wrap; }
.tx.empty .p::before { visibility: hidden; }
.tx a.lk { color: inherit; text-decoration: underline; }
.o-image img { width: 100%; height: 100%; display: block; user-select: none; -webkit-user-drag: none; }
.o-image.img-ph { background: repeating-linear-gradient(135deg, rgba(0,0,0,.04) 0 10px, rgba(0,0,0,.08) 10px 20px); border: 1.5px dashed rgba(0,0,0,.25); display: grid; place-items: center; color: rgba(0,0,0,.55); text-align: center; }
.o-image.img-ph div { display: flex; flex-direction: column; align-items: center; gap: 8px; font: 500 15px/1.3 Arial, sans-serif; padding: 12px; }
.o-image.img-ph svg { width: 40px; height: 40px; }
.o-icon svg, .o-chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.tbl { width: 100%; border-collapse: collapse; table-layout: fixed; }
.tbl td { padding: .4em .6em; line-height: 1.25; border: 1px solid var(--tline, rgba(0,0,0,.2)); vertical-align: top; overflow-wrap: anywhere; white-space: pre-wrap; outline: none; }
.tbl td[contenteditable="true"]:focus { box-shadow: inset 0 0 0 2px #1d7f68; }
.sl-foot { position: absolute; left: 4%; right: 4%; bottom: 10px; height: 24px; display: flex; justify-content: space-between; align-items: center; font-size: 14px; pointer-events: none; }
#slideHost .o { cursor: move; }
#slideHost .o.is-editing, #slideHost .o.is-editing * { cursor: text; }
#slideHost .tx[contenteditable="true"] { cursor: text; }
#slideHost .o.is-editing { z-index: 2; }

/* ---------- selection overlay ---------- */
.selbox { position: absolute; border: 1.5px solid var(--sel); pointer-events: none; transform-origin: center; }
.selbox.multi { border-style: solid; border-width: 1px; }
.selbox.group { border: 1px dashed var(--sel); }
.selbox.editing { border: 1.5px dashed var(--sel); }
.selline { position: absolute; height: 0; border-top: 1.5px dashed var(--sel); transform-origin: 0 0; pointer-events: none; }
.hd { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; background: #fff; border: 2px solid var(--sel); border-radius: 3px; pointer-events: auto; touch-action: none; z-index: 2; }
.hd-nw { left: 0; top: 0; cursor: nwse-resize; } .hd-n { left: 50%; top: 0; cursor: ns-resize; } .hd-ne { left: 100%; top: 0; cursor: nesw-resize; }
.hd-e { left: 100%; top: 50%; cursor: ew-resize; } .hd-se { left: 100%; top: 100%; cursor: nwse-resize; } .hd-s { left: 50%; top: 100%; cursor: ns-resize; }
.hd-sw { left: 0; top: 100%; cursor: nesw-resize; } .hd-w { left: 0; top: 50%; cursor: ew-resize; }
.hd-n, .hd-s { width: 16px; height: 8px; margin: -4px 0 0 -8px; border-radius: 4px; }
.hd-e, .hd-w { width: 8px; height: 16px; margin: -8px 0 0 -4px; border-radius: 4px; }
.hd-rot { left: 50%; top: -28px; border-radius: 50%; cursor: grab; }
.hd-rot::after { content: ""; position: absolute; left: 50%; top: 10px; height: 16px; border-left: 1.5px solid var(--sel); }
.hd-pt { border-radius: 50%; cursor: move; }
.guide { position: absolute; background: #e5487d; pointer-events: none; }
.guide.v { width: 1px; } .guide.h { height: 1px; }
.marquee { position: absolute; border: 1px dashed var(--sel); background: rgba(29,127,104,.08); }
.sizetag { position: absolute; transform: translateX(-50%); background: var(--fg); color: var(--bg); font: 600 11px/1 var(--f-mono); padding: 4px 6px; border-radius: 4px; white-space: nowrap; }

/* ---------- inspector ---------- */
.inspector { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-left: 1px solid var(--line); }
.insp-head { display: flex; align-items: center; gap: 4px; padding: 8px 8px 0 10px; border-bottom: 1px solid var(--line); }
.insp-tabs { display: flex; flex: 1; gap: 2px; }
.insp-tabs button { flex: 1; border: 0; background: transparent; padding: 8px 4px 9px; font-size: 13px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.insp-tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.insp-body { flex: 1; overflow-y: auto; padding: 4px 14px 30px; }
.insp-body section { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.insp-body section:last-child { border-bottom: 0; }
.insp-body h4 { margin: 0 0 2px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.irow { display: grid; grid-template-columns: 112px minmax(0,1fr); align-items: center; gap: 8px; min-height: 32px; }
.irow > label { font-size: 13px; color: var(--muted); }
.ictl { min-width: 0; display: flex; align-items: center; gap: 6px; }
.ictl select, .ictl input[type=text] { width: 100%; height: 32px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); padding: 0 8px; min-width: 0; }
.inum { width: 100%; height: 32px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); padding: 0 8px; font-family: var(--f-mono); font-size: 13px; min-width: 0; }
.igrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.igrid > label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.ibtns { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.ibtns.wide .btn { flex: 1; }
.ihint { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.iempty { padding: 18px 2px; color: var(--muted); line-height: 1.55; font-size: 13.5px; }
.iempty p { margin: 0 0 10px; }
.cbtn { display: inline-flex; align-items: center; gap: 8px; width: 100%; height: 32px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); padding: 0 8px; cursor: pointer; font-size: 13px; text-align: left; min-width: 0; }
.cbtn span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swatch { width: 18px; height: 18px; border-radius: 4px; border: 1px solid rgba(0,0,0,.18); flex: none; }
.swatch.none { background: linear-gradient(135deg, #fff 45%, #d33 45%, #d33 55%, #fff 55%); }
.sw-toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.sw-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sw-toggle span { width: 34px; height: 20px; border-radius: 10px; background: var(--line-2); position: relative; transition: background .15s; flex: none; }
.sw-toggle span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.sw-toggle input:checked + span { background: var(--accent); }
.sw-toggle input:checked + span::after { transform: translateX(14px); }
.sw-toggle input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.sw-toggle em { font-style: normal; font-size: 13px; }
.irange { display: flex; align-items: center; gap: 8px; width: 100%; }
.irange input { flex: 1; accent-color: var(--accent); min-width: 0; }
.irange span { font-family: var(--f-mono); font-size: 12px; color: var(--muted); width: 38px; text-align: right; }
.alist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.alist li { display: grid; grid-template-columns: 22px minmax(0,1fr) auto auto auto; align-items: center; gap: 4px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; font-size: 13px; }
.alist li.on { border-color: var(--accent); background: var(--accent-2); }
.alist .an { font-family: var(--f-mono); font-size: 11px; color: var(--accent); font-weight: 700; }
.alist .at { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alist em { font-style: normal; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.theme-card { position: relative; height: 64px; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; padding: 7px 8px; text-align: left; overflow: hidden; }
.theme-card b { font-size: 20px; line-height: 1; font-weight: 600; }
.theme-card em { font-style: normal; font-size: 11px; }
.theme-card .tdots { position: absolute; right: 7px; top: 9px; display: flex; gap: 2px; }
.theme-card .tdots i { width: 8px; height: 8px; border-radius: 50%; }
.theme-card.on { outline: 2.5px solid var(--accent); outline-offset: 1px; }
.tcustom summary { cursor: pointer; font-size: 13px; color: var(--accent); font-weight: 600; padding: 4px 0; }
.tcolors { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 8px 0; }
.tcolors label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.tcolors input { width: 28px; height: 24px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; cursor: pointer; flex: none; }

/* ---------- popovers & menus ---------- */
.pop { position: fixed; z-index: 60; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 36px rgba(0,0,0,.18); padding: 10px; display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 20px); overflow: auto; }
.pop-title { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.pop-label { font-size: 11px; color: var(--muted); margin-top: 2px; }
.pop-row { display: flex; gap: 6px; flex-wrap: wrap; }
.swrow { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.swrow:nth-of-type(n) { grid-template-columns: repeat(auto-fill, 22px); }
.swc { width: 22px; height: 22px; border-radius: 5px; border: 1px solid rgba(0,0,0,.18); cursor: pointer; padding: 0; }
.swc:hover { transform: scale(1.12); }
.custom { position: relative; overflow: hidden; }
.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.menu { display: flex; flex-direction: column; gap: 2px; margin: -4px; }
.menu button { display: grid; grid-template-columns: 22px 1fr; align-items: center; column-gap: 8px; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.menu button small { grid-column: 2; color: var(--muted); font-size: 12px; line-height: 1.35; }
.menu button:hover { background: var(--panel-2); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.menu .sp { width: 18px; }
.shape-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.shape-grid button { height: 42px; border: 1px solid transparent; border-radius: 6px; background: transparent; cursor: pointer; color: var(--accent); padding: 4px; }
.shape-grid button:hover { border-color: var(--line); background: var(--panel-2); }
.shape-grid svg { width: 100%; height: 100%; overflow: visible; }
.tgrid { display: grid; grid-template-columns: repeat(8, 22px); gap: 3px; }
.tgrid i { width: 22px; height: 22px; border: 1px solid var(--line-2); border-radius: 3px; cursor: pointer; display: block; }
.tgrid i.on { background: var(--accent-2); border-color: var(--accent); }
.layout-grid { display: grid; grid-template-columns: repeat(3, auto); gap: 10px; }
.layout-grid button { display: flex; flex-direction: column; gap: 5px; align-items: center; border: 0; background: transparent; cursor: pointer; padding: 3px; border-radius: 8px; }
.layout-grid button:hover { background: var(--panel-2); }
.layout-grid .lv { position: relative; overflow: hidden; border-radius: 4px; box-shadow: 0 0 0 1px var(--line); pointer-events: none; }
.layout-grid span { font-size: 12px; color: var(--muted); }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; max-height: 50vh; overflow: auto; }
.icon-grid button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; color: #333; }
.icon-grid button:hover { border-color: var(--accent); }
.icon-grid svg { width: 32px; height: 32px; }
.icon-grid span { font-size: 11px; color: #666; }
.search-in { height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); padding: 0 10px; width: 100%; }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(10,16,14,.45); display: grid; place-items: center; padding: 16px; }
.modal { width: min(560px, 100%); max-height: calc(100% - 24px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.3); min-height: 0; }
.modal.wide { width: min(780px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 12px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 17px; text-wrap: balance; }
.modal-body { padding: 16px 20px; overflow: auto; display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.modal-body p { margin: 0; line-height: 1.5; color: var(--muted); max-width: 68ch; }
.modal-body textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); padding: 10px 12px; line-height: 1.5; resize: vertical; font-family: var(--f-mono); font-size: 13px; }
.modal-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 12px 16px 14px; border-top: 1px solid var(--line); }
.frow { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fld > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.fld input[type=text], .fld select { height: 36px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel-2); padding: 0 10px; width: 100%; min-width: 0; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.chk input { accent-color: var(--accent); width: 16px; height: 16px; }
.seg { display: flex; flex-wrap: wrap; gap: 3px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; }
.seg button { flex: 1; min-width: max-content; height: 28px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; font-weight: 500; padding: 0 8px; font-size: 13px; }
.seg button.on { background: var(--panel); box-shadow: var(--shadow); color: var(--accent); font-weight: 600; }
.fmt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.fmt-grid button { display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); cursor: pointer; }
.fmt-grid button b { font-size: 14px; }
.fmt-grid button span { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.fmt-grid button.on { border-color: var(--accent); background: var(--accent-2); box-shadow: 0 0 0 1px var(--accent); }
.cdwrap { overflow: auto; max-height: 46vh; border: 1px solid var(--line); border-radius: 8px; }
.cdata { border-collapse: collapse; width: 100%; }
.cdata th, .cdata td { border: 1px solid var(--line); padding: 0; }
.cdata input { width: 100%; min-width: 80px; height: 32px; border: 0; background: transparent; padding: 0 8px; font-family: var(--f-mono); font-size: 13px; }
.cdata th input { font-weight: 700; font-family: var(--f-ui); }
.cdata tr:first-child th { background: var(--panel-2); }
.cdfmt { margin-top: 12px; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }

/* ---------- status bar ---------- */
.statusbar { display: flex; align-items: center; gap: 10px; padding: 3px 10px; background: var(--panel); border-top: 1px solid var(--line); font-size: 12.5px; min-width: 0; }
.status-msg { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#slideNum { font-variant-numeric: tabular-nums; white-space: nowrap; }
.privacy { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); font-weight: 500; white-space: nowrap; }
.privacy [data-i] { width: 14px; height: 14px; }
.drop-hint { position: absolute; inset: 12px; border: 2px dashed var(--accent); border-radius: 14px; background: color-mix(in srgb, var(--canvas) 82%, transparent); display: grid; place-items: center; z-index: 20; pointer-events: none; }
.drop-hint div { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 16px; }
.drop-hint [data-i] { width: 40px; height: 40px; color: var(--accent); }
.drop-hint b { font-size: 18px; }

/* ---------- busy & toasts ---------- */
.busy { position: fixed; inset: 0; z-index: 90; background: rgba(10,16,14,.35); display: grid; place-items: center; padding: 16px; }
.busy-card { display: flex; align-items: center; gap: 14px; padding: 16px 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); min-width: min(320px, 100%); }
.busy-card .bar { height: 4px; border-radius: 2px; background: var(--line); margin-top: 8px; overflow: hidden; width: 220px; max-width: 100%; }
.busy-card .bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.toasts { position: fixed; bottom: 44px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(520px, calc(100% - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; background: var(--fg); color: var(--bg); box-shadow: var(--shadow); font-size: 13.5px; line-height: 1.4; animation: tin .2s ease-out; }
.toast.err { background: var(--danger); color: #fff; }
.toast button { border: 0; background: transparent; color: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

/* ---------- entrance animations ---------- */
.anim-wait { opacity: 0 !important; animation: none !important; }
.anim-in { animation-duration: var(--dur, .5s); animation-fill-mode: both; animation-timing-function: cubic-bezier(.2,.7,.2,1); }
.anim-in[data-anim="fade"] { animation-name: aFade; }
.anim-in[data-anim="rise"] { animation-name: aRise; }
.anim-in[data-anim="fly-left"] { animation-name: aFlyL; }
.anim-in[data-anim="fly-right"] { animation-name: aFlyR; }
.anim-in[data-anim="zoom"] { animation-name: aZoom; }
.anim-in[data-anim="wipe"] { animation-name: aWipe; }
@keyframes aFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes aRise { from { opacity: 0; translate: 0 48px; } to { opacity: 1; translate: 0 0; } }
@keyframes aFlyL { from { opacity: 0; translate: -160px 0; } to { opacity: 1; translate: 0 0; } }
@keyframes aFlyR { from { opacity: 0; translate: 160px 0; } to { opacity: 1; translate: 0 0; } }
@keyframes aZoom { from { opacity: 0; scale: .55; } to { opacity: 1; scale: 1; } }
@keyframes aWipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

/* ---------- present mode ---------- */
.present { position: fixed; inset: 0; z-index: 100; background: #000; color: #fff; outline: none; user-select: none; }
.present[hidden] { display: none; }
.pmain { position: absolute; inset: 0; }
.pstage { position: absolute; inset: 0; overflow: hidden; background: #000; }
.psl { position: absolute; left: 50%; top: 50%; transform-origin: center; }
.psl .has-link { cursor: pointer; }
.pside { display: none; }
.pbar { position: absolute; left: 50%; bottom: 18px; transform: translate(-50%, 8px); display: flex; align-items: center; gap: 2px; padding: 5px 8px; background: rgba(24,28,27,.86); border: 1px solid rgba(255,255,255,.12); border-radius: 12px; opacity: 0; transition: opacity .25s, transform .25s; backdrop-filter: blur(8px); z-index: 5; }
.pbar.show, .pbar:hover, .pbar:focus-within { opacity: 1; transform: translate(-50%, 0); }
.pbar button { width: 36px; height: 36px; border: 0; background: transparent; color: #fff; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.pbar button:hover { background: rgba(255,255,255,.12); }
.pbar span { font: 600 13px/1 var(--f-mono); padding: 0 8px; color: #e6e6e6; white-space: nowrap; }
.pnotes { position: absolute; left: 50%; bottom: 76px; transform: translateX(-50%); width: min(760px, calc(100% - 32px)); max-height: 32vh; overflow: auto; background: rgba(20,22,22,.92); border: 1px solid rgba(255,255,255,.14); border-radius: 12px; padding: 14px 18px; font-size: 17px; line-height: 1.5; z-index: 4; }
.pnotes em { color: #9aa; }
.plaser { position: fixed; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: #ff2d2d; box-shadow: 0 0 12px 4px rgba(255,40,40,.7); pointer-events: none; z-index: 10; }
.present.laser-on, .present.laser-on * { cursor: none !important; }
.pblack { position: absolute; inset: 0; z-index: 3; }
.pend { position: absolute; inset: 0; display: grid; place-items: center; background: #000; z-index: 4; text-align: center; }
.pend div { display: flex; flex-direction: column; gap: 8px; }
.pend b { font-size: 22px; } .pend span { color: #999; }
.present.presenter { background: #121615; }
.present.presenter .pmain { inset: 16px auto 16px 16px; width: calc(62% - 24px); }
.present.presenter .pstage { border-radius: 8px; }
.present.presenter .pside { display: flex; flex-direction: column; gap: 14px; position: absolute; right: 16px; top: 16px; width: calc(38% - 24px); bottom: calc(40% + 8px); }
.present.presenter .pnotes { display: block; left: auto; right: 16px; transform: none; bottom: 76px; top: 60%; width: calc(38% - 24px); max-height: none; font-size: 18px; }
.ptimer { display: flex; align-items: center; gap: 12px; }
.ptimer .ptime { font: 700 34px/1 var(--f-mono); }
.ptimer .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.25); }
.pnext { flex: 1; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.plabel { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: #9aa6a2; }
.pnext-box { position: relative; flex: 1; overflow: hidden; border-radius: 6px; background: #000; min-height: 0; }
.pnext-box .sl { position: absolute; left: 50%; top: 50%; }
.pstage.aud { position: fixed; inset: 0; }
.tr-fade-in { animation: tFadeIn var(--tdur) ease both; } .tr-fade-out { animation: tFadeOut var(--tdur) ease both; }
.tr-push-in { animation: tPushIn var(--tdur) cubic-bezier(.3,.7,.2,1) both; } .tr-push-out { animation: tPushOut var(--tdur) cubic-bezier(.3,.7,.2,1) both; }
.tr-cover-in { animation: tCoverIn var(--tdur) cubic-bezier(.3,.7,.2,1) both; z-index: 2; } .tr-cover-out { animation: tStay var(--tdur) both; }
.tr-zoom-in { animation: tZoomIn var(--tdur) ease both; } .tr-zoom-out { animation: tFadeOut var(--tdur) ease both; }
.tr-flip-in { animation: tFlipIn var(--tdur) ease both; } .tr-flip-out { animation: tFlipOut var(--tdur) ease both; }
@keyframes tFadeIn { from { opacity: 0; } } @keyframes tFadeOut { to { opacity: 0; } }
@keyframes tPushIn { from { translate: 0 100vh; } } @keyframes tPushOut { to { translate: 0 -100vh; } }
@keyframes tCoverIn { from { translate: 100vw 0; } } @keyframes tStay { to { opacity: 1; } }
@keyframes tZoomIn { from { opacity: 0; scale: .82; } }
@keyframes tFlipIn { 0%, 50% { opacity: 0; rotate: y 90deg; } 100% { opacity: 1; rotate: y 0deg; } }
@keyframes tFlipOut { 0% { rotate: y 0deg; } 50%, 100% { opacity: 0; rotate: y -90deg; } }
@media (prefers-reduced-motion: reduce) {
  .anim-in { animation-name: aFade !important; animation-duration: .01s !important; }
  [class*="tr-"] { animation-duration: .01s !important; }
  .spinner { animation-duration: 2s; }
}

/* ---------- responsive ---------- */
@media (max-width: 1180px) { .work { grid-template-columns: 190px minmax(0,1fr) 270px; } .app.no-side .work { grid-template-columns: 0 minmax(0,1fr) 270px; } .app.no-insp .work { grid-template-columns: 190px minmax(0,1fr) 0; } }
@media (max-width: 900px) {
  .hide-sm { display: none !important; }
  .work, .app.no-side .work, .app.no-insp .work, .app.no-side.no-insp .work { grid-template-columns: minmax(0,1fr); }
  .center { grid-column: 1; grid-row: 1; }
  .slides-panel { position: absolute; left: 0; top: 0; bottom: 0; width: 210px; z-index: 12; box-shadow: var(--shadow); }
  .inspector { position: absolute; right: 0; top: 0; bottom: 0; width: min(320px, 92vw); z-index: 12; box-shadow: var(--shadow); }
  .product { display: none; }
  .rb { min-width: 44px; } .rb span { font-size: 10.5px; }
}
@media (max-width: 560px) {
  .hide-xs { display: none !important; }
  .topbar { gap: 6px; padding: 6px 8px; }
  .wordmark { display: none; }
  .btn { padding: 0 9px; }
  .notes-bar textarea { height: 48px; }
  .present.presenter .pmain { width: auto; right: 16px; bottom: 45%; }
  .present.presenter .pside { display: none; }
}
@media (max-width: 560px) {
  .pbar { gap: 0; padding: 3px 4px; bottom: 12px; }
  .pbar button { width: 34px; height: 34px; }
  .pbar .ptime, .pbar [data-p="presenter"], .pbar [data-p="laser"] { display: none; }
}

/* quick actions (double-tap / right-click) */
.qbar { position: fixed; z-index: 55; display: flex; align-items: center; gap: 2px; flex-wrap: wrap; max-width: min(720px, calc(100vw - 16px)); padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.18); animation: qin .12s ease-out; }
@keyframes qin { from { opacity: 0; transform: translateY(4px); } }
.qb { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; min-width: 34px; justify-content: center; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: var(--fg); font: 600 13px var(--f-ui); cursor: pointer; white-space: nowrap; }
.qb svg { width: 18px; height: 18px; flex: none; }
.qb:hover { background: var(--panel-2); }
.qb.on { background: var(--accent-2); color: var(--accent); }
.qb.danger { color: var(--danger); }
.qb.danger:hover { background: var(--danger-2); }
.qb:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.qsep { width: 1px; align-self: stretch; margin: 4px 3px; background: var(--line); }
.qval { min-width: 24px; text-align: center; font: 600 12px var(--f-mono); color: var(--muted); }
.qsw { display: inline-block; width: 16px; height: 16px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); flex: none; }
.qsw.none { background: linear-gradient(135deg, transparent 45%, var(--danger) 45%, var(--danger) 55%, transparent 55%), var(--panel); }
.qsw.multi { display: inline-flex; width: auto; box-shadow: none; gap: 1px; }
.qsw.multi i { width: 6px; height: 16px; border-radius: 2px; }
.qa { display: inline-flex; flex-direction: column; align-items: center; line-height: 1; font-weight: 700; font-size: 15px; }
.qa span { width: 16px; height: 4px; border-radius: 2px; margin-top: 2px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.qalign { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.qalign button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--fg); font: 12px var(--f-ui); cursor: pointer; }
.qalign button:hover { background: var(--panel-2); border-color: var(--line); }
.qalign svg { width: 20px; height: 20px; }
.pop-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--fg); font: 13px var(--f-ui); text-align: left; cursor: pointer; }
.pop-item:hover { background: var(--panel-2); }
.pop-item.on { background: var(--accent-2); color: var(--accent); font-weight: 600; }
.shape-grid button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-2); }
@media (max-width: 700px) {
  /* on phones the actions dock above the bottom bar and scroll sideways, so they never cover the slide */
  .qbar { left: 8px !important; right: 8px; top: auto !important; bottom: 52px; max-width: none; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .qbar::-webkit-scrollbar { display: none; }
  .qb.hasic .ql { display: none; }
  .qb { min-width: 42px; min-height: 42px; flex: none; }
  body.qbar-open .toasts { bottom: 112px; }
}
@media (max-width: 560px) { .saved { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .qbar { animation: none; } }
