:root {
  --ink: #1d1813; --ink2: #3a332d; --dim: #7a6f64; --line: #ece6dd; --line2: #d5cdc1; --paper: #faf7f3; --bg: #f3efe9;
  --acc: #c0533a; --acc-d: #a8402b; --acc-soft: #fbeee9; --green: #1f7a4d; --sel: #2f6fed;
  --r: 10px; --shadow: 0 1px 2px rgba(60,40,20,.06), 0 8px 24px rgba(60,40,20,.08);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 400 14px/1.4 'Jost', system-ui, sans-serif; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line2); background: #fff; border-radius: 8px; padding: 7px 12px; font-weight: 500; transition: background .12s, border-color .12s, color .12s; }
button:hover { border-color: var(--acc); color: var(--acc-d); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }
button.primary { background: var(--acc); border-color: var(--acc); color: #fff; }
button.primary:hover { background: var(--acc-d); border-color: var(--acc-d); color: #fff; }
button.ghost { background: transparent; border-color: transparent; }
button.ghost:hover { background: #fff; border-color: var(--line2); }
button.small { padding: 4px 9px; font-size: 13px; }
button:disabled { opacity: .4; cursor: default; }
.muted { color: var(--dim); }
kbd { font: 500 12px 'Jost', sans-serif; border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; background: #fff; }

/* ---------- top bar ---------- */
.top { height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 14px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.mark { width: 30px; height: 30px; border-radius: 50%; background: var(--acc); color: #fff; display: grid; place-items: center; font: 900 17px 'Fraunces', Georgia, serif; }
.brand-name { font: 500 15px 'Jost'; color: var(--dim); } .brand-name b { color: var(--ink); font-weight: 600; }
.deck-title { flex: 0 1 340px; min-width: 120px; border: 1px solid transparent; border-radius: 8px; padding: 6px 10px; font: 900 18px 'Fraunces', Georgia, serif; background: transparent; }
.deck-title:hover { border-color: var(--line2); } .deck-title:focus { border-color: var(--acc); background: #fff; outline: none; }
.save-state { color: var(--dim); font-size: 12.5px; white-space: nowrap; }
.save-state.dirty { color: var(--acc); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn { font-size: 18px; line-height: 1; padding: 5px 9px; }
.sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.split-btn { display: flex; } .split-btn .primary:first-child { border-radius: 8px 0 0 8px; } .split-btn .caret { border-radius: 0 8px 8px 0; padding: 7px 9px; border-left: 1px solid rgba(255,255,255,.35); }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr) 344px; height: calc(100vh - 56px); }
.rail { background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.rail-head { display: flex; align-items: baseline; justify-content: space-between; padding: 14px 16px 6px; }
.rail-head h2, .insp-body h3 { margin: 0; font: 600 12px 'Jost'; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
#slideCount { color: var(--dim); font-size: 12px; }
.slide-list { flex: 1; overflow: auto; padding: 4px 10px 12px; }
.rail-foot { padding: 10px; border-top: 1px solid var(--line); }
.add-slide { width: 100%; padding: 10px; border-style: dashed; color: var(--acc-d); font-weight: 600; }
.slide-item { position: relative; display: grid; grid-template-columns: 22px 1fr; gap: 6px; padding: 6px 6px 8px 2px; border-radius: 10px; cursor: pointer; user-select: none; }
.slide-item:hover { background: var(--paper); }
.slide-item.on { background: var(--acc-soft); }
.slide-item .num { font: 600 11px 'Jost'; color: var(--dim); text-align: right; padding-top: 4px; }
.slide-item canvas { width: 100%; aspect-ratio: 16/9; display: block; border-radius: 6px; border: 1px solid var(--line); background: #fff; }
.slide-item.on canvas { border-color: var(--acc); box-shadow: 0 0 0 2px var(--acc); }
.slide-item .cap { grid-column: 2; font-size: 12px; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.slide-item.sec .cap { color: var(--acc-d); font-weight: 600; }
.slide-item.skip canvas { opacity: .35; } .slide-item.skip .cap::after { content: ' · hidden'; color: var(--dim); }
.slide-item .tools { position: absolute; right: 10px; top: 10px; display: none; gap: 3px; }
.slide-item:hover .tools { display: flex; }
.slide-item .tools button { padding: 1px 6px; font-size: 12px; border-radius: 6px; background: rgba(255,255,255,.95); }
.slide-item.drop-before::before, .slide-item.drop-after::after { content: ''; position: absolute; left: 24px; right: 6px; height: 3px; border-radius: 2px; background: var(--acc); }
.slide-item.drop-before::before { top: -2px; } .slide-item.drop-after::after { bottom: -2px; }
.sec-label { margin: 10px 0 2px 26px; font: 600 10.5px 'Jost'; letter-spacing: .14em; text-transform: uppercase; color: var(--acc); }

.center { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 12px 18px 12px; gap: 10px; }
.stage-bar { display: flex; align-items: center; gap: 12px; min-height: 28px; }
.badge { font: 600 11px 'Jost'; letter-spacing: .1em; text-transform: uppercase; color: var(--acc-d); background: var(--acc-soft); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.stage-hint { color: var(--dim); font-size: 12.5px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--dim); white-space: nowrap; cursor: pointer; }
.stage-wrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.stage { position: relative; aspect-ratio: 16/9; width: 100%; max-height: 100%; background: #fff; box-shadow: var(--shadow); border-radius: 6px; outline: none; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 6px; }
.overlay { position: absolute; inset: 0; }
.bx { position: absolute; border: 1.5px dashed transparent; border-radius: 4px; cursor: move; }
.overlay.guides .bx { border-color: rgba(47,111,237,.22); }
.bx:hover { border-color: rgba(47,111,237,.6) !important; }
.bx.on { border: 2px solid var(--sel) !important; background: rgba(47,111,237,.03); }
.bx .lbl { position: absolute; left: -2px; top: -22px; font: 600 11px 'Jost'; color: #fff; background: var(--sel); padding: 2px 7px; border-radius: 4px 4px 4px 0; white-space: nowrap; display: none; pointer-events: none; }
.bx.on .lbl, .bx:hover .lbl { display: block; }
.bx:hover:not(.on) .lbl { background: rgba(47,111,237,.75); }
.bx .h { position: absolute; width: 12px; height: 12px; background: #fff; border: 2px solid var(--sel); border-radius: 3px; display: none; }
.bx.on .h { display: block; }
.h.nw { left: -7px; top: -7px; cursor: nwse-resize; } .h.ne { right: -7px; top: -7px; cursor: nesw-resize; } .h.sw { left: -7px; bottom: -7px; cursor: nesw-resize; } .h.se { right: -7px; bottom: -7px; cursor: nwse-resize; }
.h.n { left: calc(50% - 6px); top: -7px; cursor: ns-resize; } .h.s { left: calc(50% - 6px); bottom: -7px; cursor: ns-resize; } .h.w { top: calc(50% - 6px); left: -7px; cursor: ew-resize; } .h.e { top: calc(50% - 6px); right: -7px; cursor: ew-resize; }
.hot { position: absolute; cursor: text; border-radius: 4px; }
.hot:hover { background: rgba(192,83,58,.05); outline: 1.5px dashed rgba(192,83,58,.45); }
.guide { position: absolute; background: var(--acc); pointer-events: none; z-index: 5; }
.guide.v { width: 1px; top: 0; bottom: 0; } .guide.hz { height: 1px; left: 0; right: 0; }

.transport { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 7px 10px; }
.transport .play { min-width: 112px; font-weight: 600; }
.transport input[type=range] { flex: 1; accent-color: var(--acc); }
.time { font-variant-numeric: tabular-nums; color: var(--dim); font-size: 13px; min-width: 44px; text-align: right; }

/* ---------- inspector ---------- */
.repeat-slide-list { max-height: 240px; overflow: auto; margin: 10px 0; border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; }
.repeat-slide-list .check { align-items: flex-start; overflow-wrap: anywhere; }
.module-menu { width: 420px; max-width: calc(100vw - 20px); max-height: calc(100vh - 20px); overflow: auto; }
.module-menu h3 { margin: 0 0 12px; }
.inspector { background: #fff; border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; gap: 0; padding: 10px 12px 0; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; min-width: 0; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 8px 6px; color: var(--dim); font-weight: 600; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--acc); }
.tabs button:disabled { opacity: .35; }
.insp-body { flex: 1; overflow: auto; padding: 14px 16px 40px; }
.insp-body h3 { margin: 18px 0 8px; }
.insp-body h3:first-child { margin-top: 2px; }
.f { display: block; margin: 0 0 11px; }
.f > span:first-child { display: block; font-size: 12.5px; color: var(--dim); margin-bottom: 4px; }
.f input[type=text], .f input[type=number], .f input:not([type]), .f select, .f textarea { width: 100%; border: 1px solid var(--line2); border-radius: 8px; padding: 7px 9px; background: #fff; }
.f textarea { resize: vertical; min-height: 64px; line-height: 1.35; }
.f input:focus, .f select:focus, .f textarea:focus { border-color: var(--acc); outline: none; box-shadow: 0 0 0 3px rgba(192,83,58,.12); }
.check { display: flex; align-items: center; gap: 8px; margin: 0 0 11px; font-size: 13.5px; cursor: pointer; }
.check input { accent-color: var(--acc); width: 16px; height: 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } .row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.row4 .f input { padding: 6px 6px; }
.note { font-size: 12.5px; color: var(--dim); margin: -4px 0 12px; }
.blk-head { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; }
.blk-head .ic { width: 36px; height: 36px; border-radius: 50%; background: var(--acc-soft); display: grid; place-items: center; }
.blk-head h2 { margin: 0; font: 900 20px 'Fraunces', Georgia, serif; }
.blk-head + p { margin: 2px 0 14px; color: var(--dim); font-size: 13px; }
.items { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.item { border: 1px solid var(--line); border-radius: 10px; padding: 8px 8px 0; background: var(--paper); }
.item-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font: 600 11px 'Jost'; color: var(--dim); letter-spacing: .08em; }
.item-top .btns { display: flex; gap: 2px; } .item-top button { padding: 0 6px; font-size: 13px; border-color: transparent; background: none; }
.item .f { margin-bottom: 7px; } .item .f > span:first-child { font-size: 11.5px; }
.add-item { width: 100%; border-style: dashed; color: var(--acc-d); }
.blocks { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }
.brow { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; padding: 5px 6px 5px 8px; cursor: pointer; background: #fff; }
.brow:hover { border-color: var(--line2); } .brow.on { border-color: var(--sel); box-shadow: 0 0 0 1px var(--sel); }
.brow canvas { flex: none; }
.brow .bt { flex: 1; min-width: 0; } .brow .bt b { display: block; font-weight: 600; font-size: 13px; } .brow .bt small { display: block; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; }
.brow button { padding: 1px 6px; border-color: transparent; background: none; font-size: 13px; color: var(--dim); }
.brow button:hover { color: var(--acc-d); border-color: var(--line2); }
.brow button.pz.on { color: #fff; background: var(--acc); border-color: var(--acc); }
.layouts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.layouts button { padding: 4px; aspect-ratio: 16/10; display: grid; place-items: center; }
.layouts button.on { border-color: var(--acc); box-shadow: 0 0 0 1px var(--acc); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; align-items: center; }
.sw { width: 30px; height: 30px; border-radius: 50%; padding: 0; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line2); }
.sw.on { box-shadow: 0 0 0 2px var(--ink); }
.swatches input[type=color] { width: 34px; height: 34px; padding: 0; border: 1px solid var(--line2); border-radius: 50%; background: none; cursor: pointer; }
.swatches input[type=color]::-webkit-color-swatch-wrapper { padding: 3px; } .swatches input[type=color]::-webkit-color-swatch { border: 0; border-radius: 50%; }
.icon-pick { display: flex; gap: 8px; align-items: center; }
.icon-pick .prev { width: 40px; height: 40px; border: 1px solid var(--line2); border-radius: 8px; display: grid; place-items: center; background: #fff; }
.img-pick { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.img-pick .thumb { width: 96px; height: 60px; border-radius: 6px; border: 1px solid var(--line2); background: var(--paper) center/cover no-repeat; }

/* ---------- menus, popovers, dialogs ---------- */
.menu { position: fixed; z-index: 50; background: #fff; border: 1px solid var(--line2); border-radius: 12px; box-shadow: 0 12px 40px rgba(40,25,10,.18); padding: 6px; min-width: 220px; max-width: calc(100vw - 20px); max-height: calc(100dvh - 20px); overflow-y: auto; }
.menu button { display: flex; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; gap: 10px; align-items: center; }
.menu button:hover { background: var(--paper); color: var(--ink); }
.menu button small { color: var(--dim); margin-left: auto; font-size: 12px; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.menu .submenu-arrow { margin-left: auto; color: var(--dim); font-size: 18px; line-height: 1; }
.menu .menu-back { border-bottom: 1px solid var(--line); border-radius: 0; margin-bottom: 5px; color: var(--dim); font-size: 12px; }
.pop { position: fixed; z-index: 60; background: #fff; border: 1px solid var(--line2); border-radius: 12px; box-shadow: 0 12px 40px rgba(40,25,10,.18); padding: 10px; width: 340px; max-height: 70vh; overflow: auto; }
.pop input[type=search] { width: 100%; border: 1px solid var(--line2); border-radius: 8px; padding: 7px 9px; margin-bottom: 8px; }
.icon-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.icon-grid button { padding: 6px; aspect-ratio: 1; display: grid; place-items: center; border-color: transparent; }
.icon-grid button:hover, .icon-grid button.on { border-color: var(--acc); background: var(--acc-soft); }
.block-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.block-grid button { text-align: left; display: grid; grid-template-columns: 30px 1fr; gap: 2px 8px; align-items: center; padding: 8px; }
.block-grid button b { font-weight: 600; font-size: 13px; } .block-grid button small { grid-column: 2; color: var(--dim); font-size: 11.5px; line-height: 1.25; }
.block-grid canvas { grid-row: span 2; }

.dlg { border: 0; border-radius: 16px; padding: 22px 24px 24px; width: min(560px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(40,25,10,.3); color: var(--ink); }
.dlg.wide { width: min(1080px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(29,24,19,.38); }
.dlg h2 { margin: 0 0 4px; font: 900 28px 'Fraunces', Georgia, serif; }
.dlg-x { position: absolute; right: 14px; top: 12px; } .dlg-x button { border: 0; font-size: 22px; background: none; padding: 2px 8px; }
.gal-sec { margin: 18px 0 8px; font: 600 12px 'Jost'; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); }
.gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.gal button { padding: 0; border-radius: 12px; overflow: hidden; text-align: left; background: #fff; }
.gal button:hover { box-shadow: 0 0 0 2px var(--acc); }
.gal canvas { display: block; width: 100%; aspect-ratio: 16/9; border-bottom: 1px solid var(--line); }
.gal span { display: block; padding: 8px 10px 9px; font-weight: 600; font-size: 13px; } .gal small { display: block; color: var(--dim); font-weight: 400; font-size: 11.5px; }
.exp { display: grid; gap: 10px; margin-top: 14px; }
.exp-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; align-items: center; }
.exp-card h4 { margin: 0; font: 600 16px 'Jost'; } .exp-card p { margin: 0; color: var(--dim); font-size: 13px; grid-column: 1; }
.exp-card .opts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 8px; align-items: center; font-size: 13px; }
.exp-card .opts select { border: 1px solid var(--line2); border-radius: 7px; padding: 4px 6px; }
.exp-card > button { grid-row: 1 / span 2; grid-column: 2; }
.progress { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin-top: 8px; display: none; }
.progress > i { display: block; height: 100%; width: 0; background: var(--acc); transition: width .2s; }
.progress.on { display: block; }
.exp-status { grid-column: 1 / -1; font-size: 12.5px; color: var(--dim); }
.outline-wrap { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; margin-top: 12px; }
.outline-wrap textarea { width: 100%; height: 420px; border: 1px solid var(--line2); border-radius: 10px; padding: 12px; font: 400 14px/1.5 ui-monospace, Consolas, monospace; resize: vertical; }
.outline-help { font-size: 13px; color: var(--ink2); background: var(--paper); border-radius: 10px; padding: 12px 14px; overflow: auto; max-height: 420px; }
.outline-help code { font: 500 12.5px ui-monospace, Consolas, monospace; color: var(--acc-d); }
.outline-help p { margin: 0 0 8px; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.help-grid { display: grid; grid-template-columns: 1fr auto; gap: 7px 18px; margin-top: 12px; font-size: 14px; }
.help-grid h4 { grid-column: 1 / -1; margin: 10px 0 0; font: 600 12px 'Jost'; letter-spacing: .12em; text-transform: uppercase; color: var(--acc); }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 9px 18px; border-radius: 999px; font-weight: 500; opacity: 0; transition: .25s; pointer-events: none; z-index: 100; max-width: 80vw; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- presenting ---------- */
[hidden] { display: none !important; }
.present { position: fixed; inset: 0; z-index: 1000; background: #fff; display: flex; align-items: center; justify-content: center; }
.present canvas { width: min(100vw, calc(100vh * 16 / 9)); aspect-ratio: 16/9; display: block; }
.present.nocursor { cursor: none; }
.p-hint { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); padding: 8px 18px; border-radius: 999px; background: rgba(29,24,19,.82); color: #fff; font: 500 14px 'Jost'; letter-spacing: .04em; opacity: 0; transition: opacity .35s; pointer-events: none; white-space: nowrap; }
.p-hint.on { opacity: 1; }
.p-hud { position: fixed; right: 16px; bottom: 16px; display: flex; gap: 6px; align-items: center; background: rgba(255,255,255,.94); border: 1px solid var(--line2); border-radius: 999px; padding: 5px 6px 5px 14px; box-shadow: var(--shadow); opacity: 0; transition: opacity .3s; }
.p-hud.on, .p-hud:focus-within { opacity: 1; }
.p-hud span { font-size: 13px; color: var(--dim); margin-right: 4px; font-variant-numeric: tabular-nums; }
.p-hud button { border-radius: 999px; padding: 4px 11px; font-size: 13px; }
.p-hud button.on { background: var(--acc); color: #fff; border-color: var(--acc); }

@media (max-width: 1180px) { .app { grid-template-columns: 200px minmax(0, 1fr) 300px; } .brand-name { display: none; } }
@media (max-width: 900px) {
  body { overflow: auto; } .app { grid-template-columns: 1fr; height: auto; }
  .rail { order: 2; } .rail .slide-list { display: flex; overflow-x: auto; } .slide-item { width: 170px; flex: none; }
  .center { order: 1; } .stage-wrap { min-height: 220px; } .inspector { order: 3; } .save-state, .deck-title { display: none; }
}

/* ---------- table grid ---------- */
.tg-wrap h3 { margin-top: 2px; }
.tg-scroll { overflow: auto; max-height: 340px; border: 1px solid var(--line2); border-radius: 10px; background: #fff; }
.tg-wrap.big .tg-scroll { max-height: min(62vh, 640px); }
.tg { border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tg th, .tg td { padding: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; }
.tg input { width: 124px; border: 0; padding: 7px 8px; background: transparent; font: inherit; color: var(--ink); }
.tg-wrap.big .tg input { width: 170px; font-size: 14px; }
.tg input:focus { outline: 2px solid var(--acc); outline-offset: -2px; background: #fff; position: relative; z-index: 1; }
.tg-head th { background: var(--paper); } .tg-head input { font-weight: 600; color: var(--dim); }
.tg-ctrl th { background: #f6f2ec; position: sticky; top: 0; z-index: 2; }
.tg-ctrl button, .tg-n button { width: 100%; border: 0; border-radius: 0; background: none; padding: 3px 4px; font: 600 11px 'Jost'; color: var(--dim); letter-spacing: .06em; }
.tg-ctrl button:hover, .tg-n button:hover { background: var(--acc-soft); color: var(--acc-d); }
.tg .tg-n { position: sticky; left: 0; z-index: 1; background: #f6f2ec; min-width: 30px; text-align: center; font: 600 11px 'Jost'; color: var(--dim); }
.tg-ctrl .tg-n { z-index: 3; }
.tg tr.hi td { background: var(--acc-soft); } .tg tr.hi .tg-n button { color: var(--acc); }
.tg td.hic, .tg th.hic { background: #fdf4f1; } .tg-ctrl th.hic button { color: var(--acc); }
.tg td.chg { box-shadow: inset 0 0 0 2px var(--acc); }
.tg-tools { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.tg-tools button { padding: 5px 10px; font-size: 13px; }

/* ---------- animation order ---------- */
.bx .ord { position: absolute; right: -11px; top: -11px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; background: var(--acc); color: #fff; font: 700 12px/24px 'Jost'; text-align: center; box-shadow: 0 2px 6px rgba(60,40,20,.25); pointer-events: none; transition: transform .15s, background .15s; z-index: 2; }
.bx .ord.pz { background: var(--ink); }
body.no-order .bx .ord { display: none; }
.overlay.playing { pointer-events: none; } .overlay.playing .bx { border-color: transparent !important; background: none; } .overlay.playing .bx .lbl, .overlay.playing .bx .h { display: none !important; }
.bx.live { border-color: var(--acc) !important; border-style: solid !important; box-shadow: 0 0 0 4px rgba(192,83,58,.14); }
.bx.live .ord { transform: scale(1.25); }
.overlay.playing .bx.waiting .ord { background: #b8aea2; }
.bx.peek { border-color: var(--acc) !important; border-style: solid !important; background: rgba(192,83,58,.05); }
.tl { position: relative; border: 1px solid var(--line); border-radius: 10px; padding: 4px 0 8px; background: #fff; user-select: none; }
.tl-row { display: grid; grid-template-columns: 136px 1fr; align-items: center; min-height: 32px; position: relative; }
.tl-row + .tl-row { border-top: 1px solid #f3eee8; }
.tl-row.on { background: rgba(47,111,237,.06); } .tl-row.off { opacity: .45; }
.tl-row.live .tl-bar { box-shadow: 0 0 0 3px rgba(192,83,58,.25); }
.tl-row.drop-before { box-shadow: inset 0 3px 0 var(--acc); } .tl-row.drop-after { box-shadow: inset 0 -3px 0 var(--acc); }
.tl-lab { display: flex; align-items: center; gap: 5px; padding: 0 6px 0 2px; min-width: 0; font-size: 12.5px; cursor: pointer; }
.tl-lab .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-lab .grip { width: 9px; flex: none; color: #c4b9ac; cursor: grab; font-size: 11px; letter-spacing: -2px; }
.tl-lab canvas { flex: none; }
.tl-lab .ordn { flex: none; min-width: 18px; height: 18px; border-radius: 9px; background: var(--acc); color: #fff; font: 700 10.5px/18px 'Jost'; text-align: center; padding: 0 4px; }
.tl-lab .ordn:empty { background: var(--line); }
.tl-lab .ordn.pz { background: var(--ink); }
.tl-lab .pzb { padding: 0 3px; font-size: 10px; border: 0; background: none; color: #c4b9ac; display: none; }
.tl-row:hover .pzb, .tl-lab .pzb.on { display: inline-block; }
.tl-lab .pzb.on { color: #fff; background: var(--ink); border-radius: 5px; }
.tl-track { position: relative; height: 32px; margin-right: 10px; cursor: pointer; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), #f4efe9 calc(10% - 1px) 10%); }
.tl-bar { position: absolute; top: 9px; height: 14px; border-radius: 7px; background: var(--acc); cursor: ew-resize; min-width: 6px; }
.tl-bar.fixed { background: #cfc5b8; cursor: default; }
.tl-bar.manual { background: repeating-linear-gradient(135deg, var(--acc) 0 6px, var(--acc-d) 6px 12px); }
.tl-head { min-height: 22px; } .tl-ticks { position: relative; height: 22px; margin-right: 10px; }
.tl-ticks span { position: absolute; top: 4px; transform: translateX(-50%); font: 500 10.5px 'Jost'; color: var(--dim); }
.tl-ticks span:first-child { transform: none; }
.tl-playwrap { position: absolute; left: 136px; right: 10px; top: 0; bottom: 0; pointer-events: none; }
.tl-play { position: absolute; top: 2px; bottom: 2px; width: 2px; margin-left: -1px; background: var(--sel); border-radius: 1px; }
.tl-play::before { content: ''; position: absolute; top: -2px; left: -4px; border: 5px solid transparent; border-top-color: var(--sel); }
.tl-tip { position: absolute; background: var(--ink); color: #fff; font: 500 11px 'Jost'; padding: 2px 7px; border-radius: 5px; pointer-events: none; white-space: nowrap; z-index: 3; }
.tl-actions { display: flex; gap: 8px; margin: 10px 0 4px; }

/* ---------- my templates ---------- */
.gal-mine { display: flex; align-items: center; justify-content: space-between; }
.gal-head-btns { display: flex; gap: 6px; letter-spacing: 0; text-transform: none; }
.gal-card { position: relative; } .gal-card > button { width: 100%; }
.gal-tools { position: absolute; top: 8px; right: 8px; display: none; gap: 4px; }
.gal-card:hover .gal-tools { display: flex; }
.gal-tools button { padding: 2px 8px; font-size: 13px; background: rgba(255,255,255,.95); border-radius: 7px; }
.gal .gal-new { border: 2px dashed var(--line2); background: var(--paper); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 190px; padding: 14px; }
.gal .gal-new b { font-size: 34px; color: var(--acc); line-height: 1; margin-bottom: 6px; font-weight: 400; }
.gal .gal-new:hover { border-color: var(--acc); }
.gal .gal-new span { padding: 0; }
.my-lay { position: relative; display: grid; } .my-lay > button:first-child { padding: 4px; aspect-ratio: 16/10; display: grid; place-items: center; width: 100%; }
.my-lay > button:first-child.on { border-color: var(--acc); box-shadow: 0 0 0 1px var(--acc); }
.my-lay .x { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; padding: 0; border-radius: 50%; font-size: 12px; line-height: 1; display: none; background: #fff; }
.my-lay:hover .x { display: block; }

/* ---------- effect tiles ---------- */
.fx-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.fx-grid .fx { padding: 4px 4px 5px; display: flex; flex-direction: column; align-items: center; gap: 3px; border-radius: 9px; background: #fff; }
.fx-grid .fx canvas { width: 100% !important; height: auto !important; aspect-ratio: 96/58; border-radius: 5px; background: #fff; border: 1px solid var(--line); }
.fx-grid .fx span { font-size: 11.5px; font-weight: 600; color: var(--ink2); }
.fx-grid .fx.on { border-color: var(--acc); box-shadow: 0 0 0 2px var(--acc); } .fx-grid .fx.on span { color: var(--acc-d); }

.fx-sec { font: 600 11px 'Jost'; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin: 8px 0 6px; }
.fx-sec:first-child { margin-top: 2px; }
.fx-grid .fx span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* ---------- blocks on every slide ---------- */
.bx.global { border-color: rgba(122, 63, 160, .35) !important; border-style: dotted !important; }
.bx.global:hover, .bx.global.on { border-color: #7a3fa0 !important; border-style: solid !important; }
.bx.global .lbl { background: #7a3fa0 !important; }
.bx.global .h { border-color: #7a3fa0; }
.overlay.playing .bx.global { border-color: transparent !important; }
.gtag { margin-left: auto; font: 600 11px 'Jost'; color: #fff; background: #7a3fa0; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.gl-add { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.gl-add button { padding: 5px 10px; font-size: 13px; }

/* ---------- icon animation tiles ---------- */
.ifx { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ifx-t { padding: 5px 2px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; border-radius: 9px; background: #fff; }
.ifx-t span { font-size: 11px; font-weight: 600; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ifx-t.on { border-color: var(--acc); box-shadow: 0 0 0 2px var(--acc); } .ifx-t.on span { color: var(--acc-d); }

/* ---------- AI deck assistant ---------- */
.ai-panel { flex: 1; min-height: 0; min-width: 0; background: #fff; display: flex; flex-direction: column; overflow: hidden; }
.ai-head { padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--line); }
.ai-h1, .ai-h2 { display: flex; align-items: center; gap: 6px; } .ai-h2 { margin-top: 8px; flex-wrap: wrap; } .ai-h2 button.small { white-space: nowrap; }
.ai-head b { font: 900 17px 'Fraunces', Georgia, serif; white-space: nowrap; }
.ai-head .sp { flex: 1; }
.ai-chip { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--paper); flex: 1 1 100%; min-width: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-log { flex: 1; min-height: 0; overflow: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 8px; }
.ai-msg { max-width: 92%; padding: 9px 12px; border-radius: 14px; line-height: 1.45; font-size: 14px; overflow-wrap: anywhere; }
.ai-msg p { margin: 0 0 6px; } .ai-msg p:last-child { margin: 0; } .ai-msg ul { margin: 4px 0 6px; padding-left: 18px; } .ai-msg code { background: rgba(0,0,0,.06); padding: 0 4px; border-radius: 4px; font-size: 12.5px; }
.ai-msg.user { align-self: flex-end; background: var(--acc); color: #fff; border-bottom-right-radius: 4px; }
.ai-msg.user code { background: rgba(255,255,255,.2); }
.ai-msg.assistant { align-self: flex-start; background: var(--paper); border-bottom-left-radius: 4px; }
.ai-msg.thinking { color: var(--dim); font-size: 13px; }
.ai-msg.error { align-self: stretch; background: #fdecea; color: #8f2a1c; font-size: 13px; }
.ai-thumb { display: block; max-width: 160px; max-height: 110px; border-radius: 8px; margin-top: 6px; }
.ai-file { margin-top: 4px; font-size: 12.5px; opacity: .9; }
.dots { display: inline-flex; gap: 3px; vertical-align: middle; } .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--acc); animation: aidot 1s infinite ease-in-out; } .dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes aidot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.ai-tool { align-self: stretch; border: 1px solid var(--line); border-radius: 10px; font-size: 12.5px; background: #fff; }
.ai-tool summary { display: flex; gap: 8px; align-items: center; padding: 6px 10px; cursor: pointer; list-style: none; color: var(--ink2); }
.ai-tool summary::-webkit-details-marker { display: none; }
.ai-tool .st { width: 14px; height: 14px; border-radius: 50%; flex: none; border: 2px solid var(--line2); }
.ai-tool.run .st { border-color: var(--acc); border-right-color: transparent; animation: aispin .8s linear infinite; }
.ai-tool.ok .st { background: var(--green); border-color: var(--green); } .ai-tool.err .st { background: #c0392b; border-color: #c0392b; }
@keyframes aispin { to { transform: rotate(360deg); } }
.ai-tool pre { margin: 0; padding: 8px 10px; border-top: 1px solid var(--line); max-height: 220px; overflow: auto; font: 11.5px/1.4 ui-monospace, Consolas, monospace; white-space: pre-wrap; color: var(--ink2); background: var(--paper); }
.ai-shot { display: block; width: calc(100% - 20px); margin: 8px 10px 10px; border-radius: 6px; border: 1px solid var(--line); }
.ai-undo { align-self: flex-start; font-size: 12.5px; padding: 4px 10px; border-radius: 999px; }
.ai-empty { text-align: center; padding: 26px 8px; color: var(--ink2); }
.ai-mark { width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 10px; display: grid; place-items: center; background: var(--acc-soft); color: var(--acc); font-size: 24px; }
.ai-empty h3 { margin: 0 0 6px; font: 900 22px 'Fraunces', Georgia, serif; letter-spacing: 0; text-transform: none; color: var(--ink); }
.ai-empty p { margin: 0 0 14px; font-size: 13.5px; color: var(--dim); }
.ai-sugg { display: flex; flex-direction: column; gap: 6px; } .ai-sugg button { text-align: left; font-size: 13px; font-weight: 500; border-radius: 10px; }
.ai-compose { flex-shrink: 0; border-top: 1px solid var(--line); padding: 10px 12px 12px; }
.ai-compose textarea { width: 100%; resize: none; border: 1px solid var(--line2); border-radius: 10px; padding: 9px 10px; font-size: 14px; line-height: 1.4; }
.ai-compose textarea:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px rgba(192,83,58,.12); }
.ai-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; } .ai-hint { flex: 1; font-size: 11.5px; color: var(--dim); }
.ai-attach { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; } .ai-attach:empty { display: none; }
.ai-att { display: flex; align-items: center; gap: 6px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 3px 4px 3px 4px; font-size: 12px; max-width: 180px; }
.ai-att img { width: 30px; height: 30px; object-fit: cover; border-radius: 5px; } .ai-att span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .ai-att button { border: 0; background: none; padding: 0 4px; }
.ai-provs { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin: 12px 0 14px; }
.ai-prov { text-align: left; padding: 10px 12px; border-radius: 12px; display: flex; flex-direction: column; gap: 3px; }
.ai-prov b { font-weight: 600; } .ai-prov small { color: var(--dim); font-size: 12px; line-height: 1.3; }
.ai-prov.on { border-color: var(--acc); box-shadow: 0 0 0 2px var(--acc); background: var(--acc-soft); }
.ai-set { max-width: 560px; }
.ai-steps { background: var(--paper); border-radius: 10px; padding: 10px 14px; font-size: 13.5px; } .ai-steps ol { margin: 6px 0; padding-left: 20px; } .ai-steps p { margin: 6px 0 0; color: var(--dim); }
.ai-steps code, .ai-note code { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; font-size: 12.5px; }
.okc { color: var(--green) !important; } .errc { color: #b03a2e !important; }
.ai-note { margin-top: 14px; font-size: 13px; background: #f4f1fb; border-radius: 10px; padding: 10px 14px; color: var(--ink2); }
.cx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; margin: 12px 0; }
.cx { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; } .cx-h { display: flex; align-items: center; justify-content: space-between; }
.cx .note { margin: 4px 0 6px; }
.code { margin: 0; background: #1d1813; color: #f4efe8; border-radius: 8px; padding: 10px 12px; font: 12px/1.45 ui-monospace, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 900px) { .ai-panel { flex: none; height: 600px; max-height: 80vh; } }

/* ---------- quick AI actions, my decks, version history ---------- */
.ai-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin: 0 0 12px; padding: 8px 9px; border-radius: 10px; background: linear-gradient(90deg, #fbeee9, #f6f1fb); }
.ai-quick > span { font: 700 12px 'Jost'; color: var(--acc-d); margin-right: 2px; }
.ai-quick button { padding: 3px 9px; font-size: 12px; border-radius: 999px; background: #fff; }
.hist { display: flex; flex-direction: column; gap: 6px; max-height: 62vh; overflow: auto; }
.hist-row { display: grid; grid-template-columns: 210px 1fr auto auto; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.hist-when b { display: block; } .hist-when small { color: var(--dim); font-size: 12px; }
.hist-why { font-size: 13px; color: var(--ink2); }
.hist-strip { display: flex; gap: 6px; overflow-x: auto; padding: 0 2px; } .hist-strip:empty { display: none; }
.hist-strip canvas { width: 160px; height: 90px; border: 1px solid var(--line); border-radius: 5px; flex: none; }
/* deck looks: themes and backgrounds, drawn on the current slide */
.looks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-bottom: 8px; }
.look { padding: 4px 4px 5px; display: flex; flex-direction: column; align-items: center; gap: 3px; border-radius: 9px; background: #fff; }
.look canvas { width: 100% !important; height: auto !important; aspect-ratio: 16/9; border-radius: 5px; border: 1px solid var(--line); }
.look span { font-size: 11.5px; font-weight: 600; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.look.on { border-color: var(--acc); box-shadow: 0 0 0 2px var(--acc); } .look.on span { color: var(--acc-d); }
