/* Storyboard Studio (Update 2.0, U2-5). Mobile first: phones get the Table view, the canvas and panel grow on wider screens.
 * Uses the tokens from tokens.css. Loaded only by storyboard.php. */

/* ── Project list ── */
.sb-list { max-width: 1180px; margin: 0 auto; padding: 16px 0 40px; }
.sb-list-head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.sb-list-head h1 { margin: 0 0 4px; font-size: clamp(26px, 5vw, 38px); letter-spacing: -0.02em; }
.sb-list-head .row { display: flex; gap: 8px; flex-wrap: wrap; }
.sb-note { background: var(--tip-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 14px; }
.sb-send { border-color: var(--accent); margin-bottom: 14px; }
.sb-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 14px; }
.sb-proj { display: flex; flex-direction: column; gap: 10px; }
.sb-proj-open { color: inherit; text-decoration: none; display: block; }
.sb-proj-open h2 { margin: 0 0 4px; font-size: 18px; overflow-wrap: anywhere; }
.sb-proj-open:hover h2, .sb-proj-open:focus-visible h2 { color: var(--accent); }
.sb-proj .row { display: flex; flex-wrap: wrap; gap: 6px; }
@media (min-width: 700px) { .sb-list-head { flex-direction: row; justify-content: space-between; align-items: flex-end; } .sb-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); } }
.sb-page-list #sb-app { padding-left: 16px; padding-right: 16px; }

/* ── Editor shell ── */
.sb-page-editor .site-footer, .sb-page-editor .ad-slot { display: none !important; }
.sb-page-editor { overflow: hidden; }
.sb-ed { display: flex; flex-direction: column; height: calc(100dvh - 40px); min-height: 420px; }
.sb-top { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-bottom: 1px solid var(--border); background: var(--bg-2); flex-wrap: wrap; position: relative; z-index: 5; }
.sb-title { flex: 1 1 140px; min-width: 0; background: transparent; border: 1px solid transparent; border-radius: var(--radius-xs); color: var(--text); font: 600 15px var(--font); padding: 6px 8px; }
.sb-title:hover { border-color: var(--border-strong); }
.sb-title:focus-visible, .sb-title:focus { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 1px; }
.sb-saved { font-size: 12px; color: var(--muted); white-space: nowrap; }
.sb-views { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); overflow: hidden; }
.sb-views button { background: none; border: 0; color: var(--muted); padding: 6px 12px; font: 600 13px var(--font); cursor: pointer; min-height: 32px; }
.sb-views button.active { background: var(--accent-soft); color: var(--text); }
.sb-prog { display: none; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.sb-prog-bar { width: 80px; height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.sb-prog-bar i { display: block; height: 100%; background: var(--grad); width: 0; transition: width .3s var(--ease); }
.sb-menu { position: relative; }
.sb-menu > summary { list-style: none; }
.sb-menu > summary::-webkit-details-marker { display: none; }
.sb-menu > div, .sbt-menu > div, .sbt-cols-menu { position: absolute; right: 0; top: calc(100% + 4px); background: var(--surface-solid); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 6px; display: flex; flex-direction: column; min-width: 190px; box-shadow: var(--shadow-lg); z-index: 30; }
.sb-menu > div button, .sbt-menu > div button { background: none; border: 0; color: var(--text); text-align: left; padding: 8px 10px; border-radius: var(--radius-xs); cursor: pointer; font: 14px var(--font); }
.sb-menu > div button:hover, .sbt-menu > div button:hover, .sb-menu > div button:focus-visible, .sbt-menu > div button:focus-visible { background: var(--surface-3); }
@media (min-width: 900px) { .sb-prog { display: inline-flex; } }

.sb-body { flex: 1; min-height: 0; display: flex; position: relative; }
.sb-tools { display: none; flex-direction: column; gap: 2px; padding: 6px; border-right: 1px solid var(--border); background: var(--bg-2); overflow-y: auto; }
.sb-tools.off { display: none !important; }
.sb-tools button { width: 40px; height: 40px; border-radius: var(--radius-xs); border: 1px solid transparent; background: none; color: var(--text); font-size: 17px; cursor: pointer; }
.sb-tools button:hover { background: var(--surface-3); }
.sb-tools button.active { background: var(--accent-soft); border-color: var(--accent); }
.sb-tools-sep { height: 1px; background: var(--border); margin: 4px 2px; }
@media (min-width: 700px) { .sb-tools { display: flex; } }
.sb-main { flex: 1; min-width: 0; position: relative; overflow: hidden; }
.sb-canvas, .sb-table { position: absolute; inset: 0; }
.sb-table { overflow: auto; }
.sb-panel { width: 340px; flex: 0 0 340px; border-left: 1px solid var(--border); background: var(--bg-2); overflow-y: auto; }
.sb-ed.panel-off .sb-panel { display: none; }
@media (max-width: 999px) {
  .sb-panel { position: absolute; z-index: 20; right: 0; top: 0; bottom: 0; width: min(380px, 100%); box-shadow: var(--shadow-lg); }
}
@media (max-width: 699px) {
  .sb-panel { top: auto; height: 72%; width: 100%; border-left: 0; border-top: 1px solid var(--border-strong); border-radius: var(--radius) var(--radius) 0 0; }
  .sb-top .sb-saved { order: 9; width: 100%; }
}
.sb-canvas.drop { outline: 2px dashed var(--accent); outline-offset: -6px; }

/* ── Canvas ── */
.sbc-viewport { position: absolute; inset: 0; overflow: hidden; background-color: var(--bg); background-image: radial-gradient(circle, rgba(255, 255, 255, 0.09) 1px, transparent 1px); touch-action: none; outline: none; cursor: default; }
.sbc-viewport.sbc-nogrid { background-image: none; }
.sb-canvas[data-tool="hand"] .sbc-viewport, .sbc-viewport.can-pan { cursor: grab; }
.sbc-viewport.panning { cursor: grabbing; }
.sb-canvas[data-tool="shot"] .sbc-viewport, .sb-canvas[data-tool="text"] .sbc-viewport, .sb-canvas[data-tool="heading"] .sbc-viewport, .sb-canvas[data-tool="frame"] .sbc-viewport, .sb-canvas[data-tool="colour"] .sbc-viewport, .sb-canvas[data-tool="table"] .sbc-viewport, .sb-canvas[data-tool="comment"] .sbc-viewport, .sb-canvas[data-tool="arrow"] .sbc-viewport { cursor: crosshair; }
.sbc-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.sbc-arrows { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
.sbc-arrows path, .sbc-arrows line, .sbc-arrows polyline { stroke: var(--accent-2); stroke-width: 2; fill: none; }
.sbc-arrows marker path { fill: var(--accent-2); stroke: none; }
.sbc-marquee { position: absolute; border: 1px solid var(--accent-2); background: rgba(34, 211, 238, 0.08); pointer-events: none; z-index: 10; }
.sbc-zoom { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 2px; background: var(--surface-solid); border: 1px solid var(--border-strong); border-radius: var(--radius-pill); padding: 3px; z-index: 6; }
.sbc-zoom button { background: none; border: 0; color: var(--text); min-width: 34px; height: 30px; border-radius: var(--radius-pill); cursor: pointer; font: 600 13px var(--font); }
.sbc-zoom button:hover { background: var(--surface-3); }
.sbc-zl { min-width: 54px !important; }

.sbc-item { position: absolute; box-sizing: border-box; border-radius: var(--radius-sm); background: var(--surface-solid); border: 1px solid var(--border-strong); color: var(--text); overflow: hidden; box-shadow: var(--shadow-sm); user-select: none; }
.sbc-item.sel { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.sbc-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sbc-item.locked { border-style: dashed; }
.sbc-item.dragging { opacity: .85; box-shadow: var(--shadow-lg); }
.sbc-resize { position: absolute; right: 0; bottom: 0; width: 16px; height: 16px; cursor: nwse-resize; background: linear-gradient(135deg, transparent 50%, var(--accent-2) 50%); opacity: 0; }
.sbc-item.sel .sbc-resize, .sbc-item:hover .sbc-resize { opacity: .9; }
[contenteditable="true"] { user-select: text; outline: none; cursor: text; }
[contenteditable="true"]:empty::before { content: attr(data-placeholder); color: var(--muted); }

.t-shot { display: flex; flex-direction: column; }
.sbc-shot-media { aspect-ratio: 16 / 9; background: var(--bg); display: grid; place-items: center; position: relative; flex: 0 0 auto; overflow: hidden; }
.sbc-shot-media img, .sbc-shot-media video, .t-image img, .sbc-vid video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.sbc-add-media { background: none; border: 1px dashed var(--border-strong); color: var(--muted); border-radius: var(--radius-xs); padding: 8px 12px; cursor: pointer; font: 13px var(--font); }
.sbc-play { position: absolute; inset: auto auto 8px 8px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .6); color: #fff; cursor: pointer; }
.sbc-shot-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px 2px; font-size: 13px; }
.sbc-shot-head span { color: var(--muted); font-size: 12px; margin-left: auto; }
.sbc-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--plan-locked); flex: 0 0 auto; }
.st-described { background: var(--warn); } .st-prompted { background: var(--accent-2); } .st-has_media, .st-done { background: var(--ok); }
.sbc-script { margin: 2px 10px; font-size: 12px; font-style: italic; color: #d5d8e4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sbc-desc { margin: 2px 10px; font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sbc-meta { margin: 2px 10px; font-size: 12px; color: var(--accent-3); }
.sbc-shot-btns, .sbc-col-btns { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 10px 10px; margin-top: auto; }
.sbc-shot-btns button, .sbc-col-btns button, .sbc-cmt form button, .sbc-resolve { background: var(--surface-3); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-pill); padding: 4px 10px; font: 600 12px var(--font); cursor: pointer; }
.sbc-shot-btns button:first-child { background: var(--accent); border-color: var(--accent); color: #fff; }
.sbc-shot-btns button:disabled { opacity: .45; cursor: default; }
.t-text { border: 0; color: #1d1d1f; padding: 0; }
.sbc-text { padding: 12px; min-height: 100%; box-sizing: border-box; font-size: 15px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.t-heading { background: transparent; border-color: transparent; box-shadow: none; overflow: visible; }
.sbc-heading { font-weight: 750; letter-spacing: -0.02em; padding: 4px 6px; white-space: pre-wrap; }
.sbc-heading.lv1 { font-size: 40px; } .sbc-heading.lv2 { font-size: 26px; }
.t-image, .t-video { display: flex; flex-direction: column; }
.t-image img { flex: 1; min-height: 0; }
.sbc-vid { flex: 1; min-height: 0; position: relative; background: #000; }
.sbc-cap { padding: 5px 8px; font-size: 12px; color: var(--muted); min-height: 24px; flex: 0 0 auto; }
.t-audio { padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.t-audio audio { width: 100%; height: 32px; }
.t-frame { background: rgba(255, 255, 255, 0.025); border: 2px dashed var(--border-strong); box-shadow: none; overflow: visible; }
.sbc-frame-label { position: absolute; top: -28px; left: 0; font: 700 14px var(--font); color: var(--muted); white-space: nowrap; padding: 2px 6px; }
.t-colour { padding: 8px; display: flex; flex-direction: column; }
.sbc-swatches { display: flex; flex: 1; gap: 4px; min-height: 60px; }
.sbc-sw { flex: 1; border: 0; border-radius: var(--radius-xs); cursor: pointer; display: flex; align-items: flex-end; justify-content: center; padding: 4px; min-width: 0; }
.sbc-sw span { font: 600 10px var(--mono); background: rgba(0, 0, 0, .55); color: #fff; padding: 1px 4px; border-radius: 4px; }
.t-comment { background: #2a2414; border-color: var(--warn); }
.sbc-cmt { padding: 8px 10px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; height: 100%; box-sizing: border-box; overflow: auto; }
.sbc-cmt p { margin: 0; }
.sbc-cmt.resolved { opacity: .55; }
.sbc-cmt form { display: flex; gap: 4px; margin-top: auto; }
.sbc-cmt form .input { flex: 1; min-width: 0; padding: 4px 8px; font-size: 13px; }
.sbc-resolve { align-self: flex-start; }
.t-table { overflow: auto; }
.sbc-tbl-head { padding: 8px 10px; font: 600 13px var(--font); border-bottom: 1px solid var(--border); }
.sbc-tbl-head input { width: 56px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 2px 4px; }
.sbc-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.sbc-tbl th, .sbc-tbl td { border-bottom: 1px solid var(--border); padding: 5px 8px; text-align: left; vertical-align: top; }
.sbc-tbl th { color: var(--muted); font-weight: 600; }

/* ── Table view ── */
.sbt-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 10px 12px; position: sticky; top: 0; left: 0; background: var(--bg-2); border-bottom: 1px solid var(--border); z-index: 4; }
.sbt-bar .select, .sbt-bar .input { width: auto; min-height: 34px; padding: 4px 8px; font-size: 13px; }
.sbt-cols, .sbt-menu { position: relative; }
.sbt-cols > summary, .sbt-menu > summary { list-style: none; }
.sbt-cols > summary::-webkit-details-marker, .sbt-menu > summary::-webkit-details-marker { display: none; }
.sbt-cols-menu { left: 0; right: auto; gap: 4px; padding: 10px; }
.sbt-wrap { padding: 0 0 80px; }
.sbt { border-collapse: collapse; width: 100%; min-width: 720px; font-size: 13px; }
.sbt th { position: sticky; top: 55px; background: var(--surface-solid); color: var(--muted); font-weight: 600; text-align: left; padding: 8px; border-bottom: 1px solid var(--border-strong); z-index: 2; white-space: nowrap; }
.sbt td { border-bottom: 1px solid var(--border); padding: 4px 6px; vertical-align: top; }
.sbt tr.sel td { background: var(--accent-soft); }
.sbt tr.dragging { opacity: .4; }
.sbt tr.drop-before td { box-shadow: inset 0 2px 0 var(--accent); }
.sbt-handle { cursor: grab; color: var(--muted); width: 20px; text-align: center; user-select: none; }
.sbt-no { font-weight: 700; white-space: nowrap; }
.sbt-cell { min-height: 24px; padding: 4px 6px; border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere; min-width: 120px; max-width: 360px; cursor: text; }
.sbt-cell:focus { outline: 2px solid var(--accent-2); }
.sbt-cell[contenteditable="true"] { background: var(--surface-3); }
.sbt-time { white-space: nowrap; font-family: var(--mono); font-size: 12px; }
.sbt-dur, .sbt-ms { width: 64px; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 3px 6px; }
.sbt-lock { background: none; border: 0; cursor: pointer; color: var(--muted); }
.sbt-thumb { position: relative; width: 96px; aspect-ratio: 16 / 9; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); padding: 0; overflow: hidden; cursor: pointer; display: grid; place-items: center; color: var(--muted); }
.sbt-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sbt-thumb span { position: absolute; color: #fff; text-shadow: 0 1px 3px #000; }
.sbt-prompt { max-width: 280px; font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sbt-pbtns { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.sbt-st { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; white-space: nowrap; }
.sbt-q { color: var(--warn); }
.sbt-num { font-family: var(--mono); }
.sbt-actions { width: 40px; }
.sbt-empty { padding: 30px 16px; text-align: center; color: var(--muted); }

/* ── Inspector ── */
.sbi-tabs { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg-2); z-index: 2; }
.sbi-tabs button { flex: 1; background: none; border: 0; color: var(--muted); padding: 8px 4px; border-radius: var(--radius-xs); font: 600 13px var(--font); cursor: pointer; }
.sbi-tabs button.active { background: var(--surface-3); color: var(--text); }
.sbi-tabs .sbi-close { flex: 0 0 36px; }
.sbi-body { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.sbi-body h3 { margin: 0; font-size: 16px; }
.sbi-f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.sbi-f .input, .sbi-f .select, .sbi-f textarea { font-size: 14px; }
.sbi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sbi-prompt pre { white-space: pre-wrap; font: 12px/1.5 var(--mono); background: var(--code-bg); padding: 8px; border-radius: var(--radius-xs); max-height: 220px; overflow: auto; margin: 6px 0; }
.sbi-prompt .row, .sbi-body .row { display: flex; flex-wrap: wrap; gap: 6px; }
.sbi-body .row.between { justify-content: space-between; align-items: center; }
.sbi-cmts p { margin: 4px 0; font-size: 13px; }
.sbi-cmts p.resolved { opacity: .5; }
.sbi-cmts form { display: flex; gap: 6px; margin-top: 6px; }
.sbi-cmts form .input { flex: 1; min-width: 0; }
.sbi-pal div { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.sbi-swatch { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border-strong); cursor: pointer; }
.sbi-pal input[type="color"] { width: 32px; height: 30px; border: 0; background: none; padding: 0; cursor: pointer; }
.sbi-card { border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 6px 10px; margin-top: 6px; }
.sbi-card summary { cursor: pointer; font-weight: 600; }
.sbi-card[open] { display: flex; flex-direction: column; gap: 8px; }
.sbi-outline ul { list-style: none; margin: 6px 0 0; padding: 0; max-height: 260px; overflow: auto; }
.sbi-outline li button { text-align: left; width: 100%; padding: 4px 6px; border-radius: 6px; }
.sbi-outline li button.on { background: var(--accent-soft); }
.linkish { background: none; border: 0; color: var(--accent-2); cursor: pointer; font: inherit; padding: 0; }
.btn.danger { color: var(--err); }
.sbi-allc p { margin: 6px 0; font-size: 13px; }

/* ── Dialogs ── */
.sb-dialog { background: var(--surface-solid); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 20px; max-width: min(460px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); }
.sb-dialog::backdrop { background: rgba(0, 0, 0, .6); }
.sb-dialog h2 { margin-top: 0; font-size: 19px; }
.sb-dialog .row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.sb-vers { list-style: none; padding: 0; max-height: 50vh; overflow: auto; }
.sb-vers li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 14px; }

/* Focus rings everywhere in the studio */
.sb-ed button:focus-visible, .sb-ed summary:focus-visible, .sb-list button:focus-visible, .sb-list a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── PDF print ── */
#sb-print { display: none; }
@media print {
  body.sb-printing > *:not(#sb-app), body.sb-printing .sb-top, body.sb-printing .sb-body { display: none !important; }
  body.sb-printing, body.sb-printing .sb-ed { background: #fff !important; color: #111 !important; height: auto; overflow: visible; }
  body.sb-printing #sb-print { display: block; }
  .sbp-page { page-break-after: always; break-after: page; padding: 10mm; font: 11px/1.4 Arial, sans-serif; color: #111; }
  .sbp-page header { display: flex; justify-content: space-between; border-bottom: 1px solid #999; padding-bottom: 4px; margin-bottom: 8px; }
  .sbp-grid { display: grid; gap: 8mm; }
  .per-2 .sbp-grid { grid-template-columns: 1fr; }
  .per-4 .sbp-grid, .per-6 .sbp-grid { grid-template-columns: 1fr 1fr; }
  .sbp-shot { break-inside: avoid; }
  .sbp-img { aspect-ratio: 16 / 9; border: 1px solid #999; background: #eee; overflow: hidden; }
  .per-6 .sbp-img { aspect-ratio: 2 / 1; }
  .sbp-img img { width: 100%; height: 100%; object-fit: cover; }
  .sbp-shot p { margin: 3px 0; }
}

/* ── Script to Storyboard wizard (U2-6) ── */
.sbs { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, .65); display: flex; align-items: stretch; justify-content: center; padding: 0; }
.sbs-card { background: var(--surface-solid); color: var(--text); width: 100%; max-width: 820px; display: flex; flex-direction: column; max-height: 100dvh; border: 1px solid var(--border-strong); }
@media (min-width: 700px) { .sbs { align-items: center; padding: 24px; } .sbs-card { border-radius: var(--radius); max-height: calc(100dvh - 48px); box-shadow: var(--shadow-lg); } }
.sbs-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.sbs-head h2 { margin: 0; font-size: 18px; }
.sbs-steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; font-size: 12px; color: var(--muted); flex: 1; flex-wrap: wrap; }
.sbs-steps li { padding: 3px 9px; border-radius: var(--radius-pill); border: 1px solid var(--border); }
.sbs-steps li.on { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.sbs-steps li.done { color: var(--ok); }
.sbs-x { background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; padding: 4px 8px; border-radius: 6px; margin-left: auto; }
.sbs-body { padding: 16px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 12px; }
.sbs-body h3 { margin: 4px 0 0; font-size: 16px; } .sbs-body h4 { margin: 8px 0 0; font-size: 14px; }
.sbs-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.sbs-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sbs-file { cursor: pointer; }
.sbs-script { width: 100%; min-height: 220px; font: 14px/1.5 var(--mono); resize: vertical; box-sizing: border-box; }
.sbs-wc { margin: 0; color: var(--muted); } .sbs-wc.over { color: var(--err); font-weight: 600; }
.sbs-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 600px) { .sbs-grid { grid-template-columns: 1fr 1fr; } }
.sbs-err { margin: 0; color: var(--err); background: var(--err-bg); padding: 8px 12px; border-radius: var(--radius-xs); }
.sbs-warn { color: var(--warn); background: var(--warn-bg); padding: 8px 12px; border-radius: var(--radius-xs); margin: 0; }
.sbs-badge { font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: var(--radius-pill); background: var(--tip-bg); color: var(--tip); margin-left: 4px; white-space: nowrap; }
.sbs-badge.mine { background: var(--ok-bg); color: var(--ok); }
.sbs-q { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.sbs-q p { margin: 0; }
.sbs-q .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sbs-q .input.small { padding: 6px 10px; font-size: 13px; }
.sbs-ass ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.sbs-bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.sbs-bar i { display: block; height: 100%; background: var(--grad); transition: width .4s var(--ease); }
.sbs-shots { margin: 0; padding-left: 22px; font-size: 13px; display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; }
.sbs-shots i { color: var(--muted); }
.sbs-dir input:disabled + * { opacity: .6; }
@media (max-width: 599px) { .sbs-steps { order: 3; flex-basis: 100%; } .sbs-foot .btn { flex: 1; } }

/* ── Timeline (U2-7) ── */
.sb-tlwrap { flex: 0 0 auto; border-top: 1px solid var(--border-strong); background: var(--bg-2); }
.sb-ed.tl-open .sb-body { flex: 1 1 40%; }
.sbtl { display: flex; flex-direction: column; height: min(46vh, 420px); outline: none; }
.sbtl:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.sbtl-top { display: flex; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--border); min-height: 0; }
.sbtl-prev { flex: 0 0 auto; background: #000; border-radius: var(--radius-xs); overflow: hidden; display: grid; place-items: center; height: 150px; max-width: 46%; }
.sbtl-prev canvas { height: 150px; width: auto; max-width: 100%; display: block; }
.sbtl-side { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; overflow: auto; }
.sbtl-bar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.sbtl-bar .btn.active, .sbtl-bar .btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.sbtl-time { font: 600 12px var(--mono); color: var(--muted); padding: 0 6px; white-space: nowrap; }
.sbtl-props { font-size: 13px; }
.sbtl-props p { margin: 0; }
.sbtl-pf { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.sbtl-pf label { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; }
.sbtl-pf .input, .sbtl-pf .select { width: auto; min-height: 28px; padding: 2px 6px; font-size: 12px; }
.sbtl-pf input[type="number"] { width: 64px; }
.sbtl-pf input[type="range"] { width: 90px; }
.sbtl-txt textarea { min-width: 200px; }
.sbtl-scroll { flex: 1; overflow: auto; position: relative; }
.sbtl-grid { position: relative; min-width: 100%; }
.sbtl-ruler { position: sticky; top: 0; height: 22px; background: var(--surface-solid); border-bottom: 1px solid var(--border); z-index: 3; cursor: col-resize; }
.sbtl-ruler > span:not(.sbtl-lab) { position: absolute; top: 4px; font: 10px var(--mono); color: var(--muted); transform: translateX(2px); border-left: 1px solid var(--border-strong); padding-left: 3px; height: 18px; pointer-events: none; }
.sbtl-corner { height: 22px; display: flex; align-items: center; }
.sbtl-corner .btn { padding: 0 6px; min-height: 20px; font-size: 11px; }
.sbtl-mk { position: absolute; top: 0; width: 10px; height: 10px; margin-left: -5px; background: var(--mk, var(--warn)); border: 0; transform: rotate(45deg) translateY(4px); cursor: pointer; z-index: 2; padding: 0; }
.sbtl-row { display: flex; height: 40px; border-bottom: 1px solid var(--border); }
.sbtl-row.k-text { height: 32px; }
.sbtl-lab { position: sticky; left: 0; width: 150px; flex: 0 0 150px; background: var(--surface-solid); border-right: 1px solid var(--border); z-index: 2; display: flex; align-items: center; gap: 4px; padding: 0 6px; font-size: 11px; box-sizing: border-box; }
.sbtl-lab b { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sbtl-ms { width: 22px; height: 22px; border-radius: 5px; border: 1px solid var(--border-strong); background: none; color: var(--muted); font: 700 10px var(--font); cursor: pointer; padding: 0; }
.sbtl-ms.on { background: var(--warn); color: #111; border-color: var(--warn); }
.sbtl-lane { position: relative; flex: 1; }
.sbtl-clip { position: absolute; top: 4px; bottom: 4px; border-radius: 6px; background: #2b4f8a; border: 1px solid rgba(255, 255, 255, .25); color: #fff; font-size: 11px; overflow: hidden; cursor: grab; touch-action: none; user-select: none; display: flex; align-items: center; box-sizing: border-box; }
.sbtl-clip.k-overlay { background: #9c3a73; } .sbtl-clip.k-text { background: #6b3fa0; } .sbtl-clip.k-audio { background: #1f7a5a; }
.sbtl-clip.ph { background: repeating-linear-gradient(135deg, #3a3f55, #3a3f55 6px, #31354a 6px, #31354a 12px); }
.sbtl-clip.sel { outline: 2px solid var(--accent); outline-offset: 0; z-index: 1; }
.sbtl-clip:focus-visible { outline: 2px solid var(--accent-2); }
.sbtl-cl { padding: 0 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.sbtl-e { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; z-index: 1; }
.sbtl-e.l { left: 0; } .sbtl-e.r { right: 0; }
.sbtl-clip.sel .sbtl-e { background: rgba(255, 255, 255, .28); }
.sbtl-tx { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; background: #fff; border: 2px solid #111; border-radius: 3px; transform: rotate(45deg); pointer-events: none; z-index: 2; opacity: .9; }
.sbtl-ph { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--accent); z-index: 4; pointer-events: none; }
@media (max-width: 699px) {
  .sbtl { height: 62vh; }
  .sbtl-top { flex-direction: column; }
  .sbtl-prev { max-width: 100%; height: 170px; }
  .sbtl-prev canvas { height: 170px; }
  .sbtl-lab { width: 96px; flex-basis: 96px; gap: 2px; padding: 0 3px; }
  .sbtl-tn { display: none; }
}

/* ── Export (U2-7) ── */
.sbx { max-width: min(520px, calc(100vw - 32px)); }
.sbx-run { margin: 12px 0; }
.sbx-msg { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.sbx-done { text-align: center; }
.sbx-done .row { justify-content: center; }
.sbx-ico { font-size: 44px; display: block; }
.sbx-video { width: 100%; max-height: 50vh; background: #000; border-radius: var(--radius-sm); margin: 8px 0; }
.sb-storage { margin-top: 16px; }

/* ── Read-only board (shared /b/code and landing pages) ── */
.sbv-wrap { max-width: 1100px; margin: 0 auto; padding: 16px 16px 40px; }
.sbv-meta { margin: 0 0 10px; }
.sbv-bible { margin-bottom: 12px; }
.sbv-bible summary { cursor: pointer; }
.sbv-bible dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 10px 0 0; font-size: 14px; }
.sbv-bible dt { font-weight: 600; } .sbv-bible dd { margin: 0; color: var(--muted); }
.sbv-pal i { display: inline-block; width: 20px; height: 20px; border-radius: 5px; margin-right: 4px; border: 1px solid var(--border-strong); }
.sbv-tabs { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); overflow: hidden; margin-bottom: 12px; }
.sbv-tabs button { background: none; border: 0; color: var(--muted); padding: 8px 16px; font: 600 14px var(--font); cursor: pointer; }
.sbv-tabs button.active { background: var(--accent-soft); color: var(--text); }
.sbv-cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .sbv-cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); } }
.sbv-shot { display: flex; flex-direction: column; gap: 6px; padding: 12px; }
.sbv-shot p { margin: 0; font-size: 14px; }
.sbv-img { aspect-ratio: 16 / 9; background: var(--bg); border-radius: var(--radius-xs); overflow: hidden; display: grid; place-items: center; color: var(--muted); font: 700 22px var(--font); }
.sbv-img img { width: 100%; height: 100%; object-fit: cover; }
.sbv-head { display: flex; justify-content: space-between; } .sbv-head span { color: var(--muted); font-size: 12px; }
.sbv-line { font-style: italic; color: #d5d8e4; }
.sbv-vo { color: var(--accent-3); }
.sbv-prompt summary { cursor: pointer; color: var(--accent-2); font-size: 13px; }
.sbv-prompt pre { white-space: pre-wrap; font: 12px/1.5 var(--mono); background: var(--code-bg); padding: 8px; border-radius: var(--radius-xs); }
.sbv-actions { margin: 16px 0; display: flex; justify-content: center; }
.sbv-cta { margin: 20px 0; }
.sbl-hero { padding: 20px 0 10px; }
.sbl-hero h1 { font-size: clamp(30px, 6vw, 48px); letter-spacing: -0.03em; margin: 0 0 10px; }
.sbl-hero .lead { font-size: 17px; color: #c9ccd8; max-width: 720px; }
.sbl-hero .row { display: flex; flex-wrap: wrap; gap: 8px; }
.sb-landing section { margin-top: 20px; }
.sbtl-short { display: none; }
@media (max-width: 699px) { .sbtl-full { display: none; } .sbtl-short { display: inline; } }
/* U2-9 QA: tabs wrapper, and readable text in panel and wizard fields (contrast 4.5:1) */
.sbi-tablist { display: flex; gap: 2px; flex: 1; }
.sbi-tablist button { flex: 1; background: none; border: 0; color: var(--muted); padding: 8px 4px; border-radius: var(--radius-xs); font: 600 13px var(--font); cursor: pointer; }
.sbi-tablist button.active { background: var(--surface-3); color: var(--text); }
.sbi-f .input, .sbi-f .select, .sbi-f textarea, .sbi-f input, .sbi-f select { color: var(--text); background-color: var(--bg); }

/* ── Storyboard Editor Update U1: app mode, editor bar, icons (docs/STORYBOARD_EDITOR_UPDATE.md) ── */
.icon { width: 20px; height: 20px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.icon[width="16"] { width: 16px; height: 16px; } .icon[width="18"] { width: 18px; height: 18px; } .icon[width="24"] { width: 24px; height: 24px; } .icon[width="14"] { width: 14px; height: 14px; }
.icon[width="40"] { width: 40px; height: 40px; stroke-width: 1.5; } .icon[width="44"] { width: 44px; height: 44px; stroke-width: 1.5; }
body.app-mode { overflow: hidden; background: var(--bg); }
body.app-mode.sb-page-list { overflow: auto; }
body.app-mode .topbar, body.app-mode .site-footer, body.app-mode .ann-bar, body.app-mode .ad-slot, body.app-mode .adsbygoogle { display: none !important; }
.app-bar { position: sticky; top: 0; z-index: 50; height: 40px; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; padding: 0 8px; background: var(--surface-solid); border-bottom: 1px solid var(--border-strong); }
.app-left { display: flex; align-items: center; gap: 6px; min-width: 0; }
.app-right { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.app-markwrap { position: relative; }
.app-mark { display: inline-flex; align-items: center; gap: 2px; height: 32px; padding: 0 6px; border: 1px solid transparent; border-radius: var(--radius-xs); background: none; color: var(--muted); cursor: pointer; }
.app-mark img { width: 24px; height: 24px; border-radius: 6px; display: block; }
.app-mark-dot { width: 22px; height: 22px; border-radius: 50%; background: var(--grad); display: block; }
.app-mark:hover, .app-mark[aria-expanded="true"] { background: var(--surface-3); color: var(--text); }
.app-menu { position: absolute; left: 0; top: calc(100% + 4px); min-width: 220px; padding: 6px; background: var(--surface-solid); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; z-index: 60; }
.app-menu[hidden] { display: none; }
.app-menu a, .app-menu button { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-xs); color: var(--text); text-decoration: none; background: none; border: 0; font: 500 14px var(--font); text-align: left; cursor: pointer; }
.app-menu a:hover, .app-menu button:hover, .app-menu a:focus-visible, .app-menu button:focus-visible { background: var(--surface-3); }
.app-menu .icon { color: var(--muted); }
.app-title { min-width: 0; flex: 1; display: flex; }
.app-title-text { font: 600 14px var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; }
.app-title .sb-title { flex: 1 1 auto; max-width: 420px; height: 30px; padding: 4px 8px; font-size: 14px; }
.app-status { font-size: 12px; color: var(--muted); white-space: nowrap; }
.sb-saved::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: var(--ok); vertical-align: 1px; }
.sb-saved[data-state="saving"]::before { background: var(--warn); }
.sb-saved[data-state="offline"]::before { background: var(--err); }
.app-icon, .app-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px; border: 1px solid transparent; border-radius: var(--radius-xs); background: none; color: var(--muted); font: 600 13px var(--font); cursor: pointer; }
.app-icon:hover, .app-btn:hover { background: var(--surface-3); color: var(--text); }
.app-btn { border-color: var(--border-strong); color: var(--text); }
.app-avatar { width: 28px; height: 28px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--surface-3); color: var(--text); font: 700 12px var(--font); text-decoration: none; margin-left: 4px; }
.app-avatar img { width: 100%; height: 100%; object-fit: cover; }
.app-signin { font: 600 13px var(--font); color: var(--accent-2); padding: 0 6px; }
.app-bar :focus-visible, .sb-top :focus-visible, .sb-tools :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sb-loading { padding: 16px; }
/* The tool row under the editor bar */
.sb-top { min-height: 40px; padding: 4px 8px; gap: 4px; }
.sb-top-sep { width: 1px; height: 20px; background: var(--border-strong); margin: 0 4px; }
.sb-ib { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 1px solid transparent; border-radius: var(--radius-xs); background: none; color: var(--muted); cursor: pointer; }
.sb-ib:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.sb-ib:disabled { opacity: .4; cursor: default; }
.sb-tb { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-xs); background: none; color: var(--text); font: 600 13px var(--font); cursor: pointer; list-style: none; }
.sb-tb::-webkit-details-marker { display: none; }
.sb-tb:hover, .sb-tb[aria-pressed="true"] { background: var(--surface-3); border-color: var(--border-strong); }
.sb-tb[aria-pressed="true"] { color: var(--text); border-color: var(--accent); }
.sb-tb[aria-pressed="true"] .icon { color: var(--accent); }
.sb-tb .icon, .sb-views .icon { color: var(--muted); }
.sb-views button { display: inline-flex; align-items: center; gap: 6px; }
.sb-views button.active .icon { color: var(--accent); }
.sb-tools button { display: grid; place-items: center; color: var(--muted); }
.sb-tools button:hover { color: var(--text); }
.sb-tools button.active { color: var(--accent); }
.sbc-zoom button { display: inline-grid; place-items: center; }
.btn .icon { margin-right: 4px; }
.sbt-thumb span .icon { color: #fff; filter: drop-shadow(0 1px 2px #000); }
.sbt-handle .icon { color: var(--muted); }
.sbt-lock { display: inline-grid; place-items: center; }
.sb-help { max-width: min(760px, calc(100vw - 32px)); }
.sb-help-grid { display: grid; grid-template-columns: 1fr; gap: 12px 24px; max-height: 60vh; overflow: auto; }
@media (min-width: 640px) { .sb-help-grid { grid-template-columns: 1fr 1fr; } }
.sb-help h3 { margin: 4px 0 6px; font-size: 14px; color: var(--accent-2); }
.sb-help dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 10px; margin: 0; font-size: 13px; }
.sb-help dd { margin: 0; color: var(--muted); }
.sb-help kbd { font: 600 12px var(--mono); padding: 1px 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); white-space: nowrap; }
.sbx-ico .icon { color: var(--accent); }
.ui-empty-ico .icon { color: var(--accent); }
@media (max-width: 699px) {
  .app-bar { grid-template-columns: minmax(0, 1fr) auto auto; }
  .sb-saved { font-size: 0; } .sb-saved::before { margin-right: 0; width: 9px; height: 9px; }
  .app-btn span { display: none; }
  .app-title .sb-title { max-width: none; }
  .sb-top { flex-wrap: nowrap; overflow-x: auto; }
  .sb-top > * { flex-shrink: 0; }
  .sb-tb { padding: 0 8px; }
}
@media (prefers-reduced-motion: reduce) { .app-menu, .sb-prog-bar i { transition: none; } }

/* ── Storyboard Editor Update U2: sidebar (docs/STORYBOARD_EDITOR_UPDATE.md section 8) ── */
.sb-side { flex: 0 0 232px; width: 232px; display: flex; flex-direction: column; gap: 2px; padding: 8px; background: var(--surface-solid); border-right: 1px solid var(--border); overflow-y: auto; overflow-x: hidden; transition: width .2s var(--ease), flex-basis .2s var(--ease); }
.sb-side-group { display: flex; flex-direction: column; gap: 2px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.sb-side-group:last-of-type { border-bottom: 0; }
.sb-side-label { margin: 6px 10px 4px; font: 700 11px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.sb-side-item { position: relative; display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 12px; border: 0; border-radius: var(--radius-xs); background: none; color: var(--muted); font: 500 14px var(--font); text-align: left; cursor: pointer; white-space: nowrap; }
.sb-side-item:hover { background: var(--surface-3); color: var(--text); }
.sb-side-item.active { background: var(--accent-soft); color: var(--text); }
.sb-side-item.active .icon { color: var(--accent); }
.sb-side-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.sb-side-toggle { margin-top: auto; border-top: 1px solid var(--border); border-radius: 0; padding-top: 4px; }
.sb-ed.side-collapsed .sb-side { flex-basis: 64px; width: 64px; }
.sb-ed.side-collapsed .sb-side-label, .sb-ed.side-collapsed .sb-side-item span { display: none; }
.sb-ed.side-collapsed .sb-side-item { justify-content: center; padding: 0; }
.sb-ed.side-collapsed .sb-side-group { border-bottom: 1px solid var(--border); }
/* Tooltip with the name when collapsed (hover or keyboard focus) */
.sb-ed.side-collapsed .sb-side-item:hover::after, .sb-ed.side-collapsed .sb-side-item:focus-visible::after { content: attr(data-tip); position: fixed; margin-left: 52px; padding: 5px 9px; border-radius: 6px; background: #000; color: #fff; font: 600 12px var(--font); white-space: nowrap; z-index: 80; pointer-events: none; }
.sb-side { position: relative; }
.sb-tabbar { display: none; }
@media (prefers-reduced-motion: reduce) { .sb-side { transition: none; } }
/* Phones: the sidebar becomes a bottom tab bar with the 5 most used items and More */
@media (max-width: 699px) {
  .sb-side, .sb-side-open, .sb-side-open + .sb-top-sep { display: none !important; }
  .sb-tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: 56px; z-index: 40; background: var(--surface-solid); border-top: 1px solid var(--border-strong); padding-bottom: env(safe-area-inset-bottom); }
  .sb-tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; background: none; color: var(--muted); font: 600 11px var(--font); cursor: pointer; }
  .sb-tabbar button.active { color: var(--text); } .sb-tabbar button.active .icon { color: var(--accent); }
  .sb-tabbar button:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
  .sb-ed { height: calc(100dvh - 40px - 56px); }
  .sb-panel { bottom: 0; }
}
.sb-more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 12px; }
.sb-more-item { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font: 600 12px var(--font); cursor: pointer; }
.sb-more-item .icon { color: var(--muted); }
.sb-more-item:hover, .sb-more-item:focus-visible { border-color: var(--accent); }
/* Media library tab */
.sbi-media-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sbi-media-item { border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sbi-media-item p { margin: 0; }
.sbi-media-thumb { position: relative; aspect-ratio: 16 / 10; background: var(--bg); border-radius: 6px; overflow: hidden; display: grid; place-items: center; color: var(--muted); }
.sbi-media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sbi-media-kind { position: absolute; right: 4px; bottom: 4px; background: rgba(0, 0, 0, .65); color: #fff; border-radius: 4px; padding: 1px 3px; display: grid; }
.sbi-media-name { font: 600 12px var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sbi-media-item .row { display: flex; flex-wrap: wrap; gap: 4px; }
.sbi-media-item .btn { padding: 2px 8px; font-size: 12px; }
/* Timeline: adjustment layer */
.sbtl-clip.k-adjust { background: linear-gradient(90deg, #0f766e, #155e75); }
.sbtl-row.k-adjust { height: 34px; }
.sbtl-adj { display: inline-flex; align-items: center; gap: 4px; }
.sbtl-adj input[type="range"] { width: 90px; }
.sbtl-adj output { font: 600 11px var(--mono); min-width: 30px; color: var(--text); }
.sbtl-adj-note { flex-basis: 100%; }
.sb-side-toggle { position: sticky; bottom: -8px; background: var(--surface-solid); z-index: 1; }
.sbtl-pf .input, .sbtl-pf .select, .sbtl-pf input, .sbtl-pf select, .sbtl-pf textarea { color: var(--text); background-color: var(--bg); } /* readable fields (contrast) */

/* ── Storyboard Editor Update U3: right column (Player, Export, inspector), resizable panels ── */
.sb-side { flex-basis: var(--side-w, 232px); width: var(--side-w, 232px); }
.sb-ed.side-collapsed .sb-side { flex-basis: 64px; width: 64px; }
.sbtl { height: var(--tl-h, 300px); }
.sb-right { flex: 0 0 var(--right-w, 340px); width: var(--right-w, 340px); min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg-2); border-left: 1px solid var(--border); }
.sb-ed .sb-panel { position: static; flex: 1 1 auto; width: auto; min-height: 0; border: 0; box-shadow: none; border-radius: 0; height: auto; overflow-y: auto; }
.sb-ed .sb-panel[hidden], .sb-clippanel[hidden] { display: none; }
.sb-ed.panel-off .sb-right, .sb-ed.panel-off .sb-rz-right { display: none; }
.sb-clippanel { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 10px 12px; }
.sb-rmode { padding: 4px 6px; border-bottom: 1px solid var(--border); border-top: 1px solid var(--border); }
/* Resizers: a thin line that brightens on hover, drag or keyboard focus */
.sb-rz { flex: 0 0 6px; margin: 0 -3px; position: relative; z-index: 6; cursor: col-resize; touch-action: none; background: transparent; }
.sb-rz::after { content: ""; position: absolute; inset: 0 2px; background: transparent; transition: background .15s; }
.sb-rz:hover::after, .sb-rz.dragging::after, .sb-rz:focus-visible::after { background: var(--accent); }
.sb-rz:focus-visible { outline: none; }
.sb-rz-tl { height: 6px; margin: -3px 0; cursor: row-resize; }
.sb-rz-tl::after { inset: 2px 0; }
.sb-ed.side-collapsed .sb-rz-side { display: none; }
/* Player */
.sb-player { flex: 0 0 auto; display: flex; flex-direction: column; border-bottom: 1px solid var(--border); }
.sb-stage { height: clamp(160px, 36vh, 460px); background: #050608; display: grid; place-items: center; overflow: hidden; position: relative; }
.sb-stage.zoomed { overflow: auto; place-items: start center; }
.sb-frame { position: relative; background: #000; box-shadow: 0 0 0 1px rgba(255, 255, 255, .08); cursor: pointer; }
.sb-pcanvas { width: 100%; height: 100%; display: block; }
.sb-stage:fullscreen { height: 100vh; width: 100vw; background: #000; }
.sb-pbar { display: flex; align-items: center; gap: 4px; padding: 4px 6px; flex-wrap: wrap; }
.sb-psel { height: 30px; padding: 0 6px; border-radius: var(--radius-xs); border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); font: 600 12px var(--font); }
.sb-ptime { margin-left: auto; font: 600 12px var(--mono); color: var(--muted); }
.sb-safe-menu { position: relative; }
.sb-safe-menu > summary { list-style: none; }
.sb-safe-menu > summary::-webkit-details-marker { display: none; }
.sb-safe-menu > div { position: absolute; left: 0; top: calc(100% + 4px); z-index: 30; min-width: 230px; padding: 10px; display: flex; flex-direction: column; gap: 6px; background: var(--surface-solid); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-size: 13px; }
.sb-export-btn { margin: 6px 8px 8px; justify-content: center; display: flex; align-items: center; gap: 8px; width: auto; min-height: 40px; font-weight: 700; }
/* Safe zones (only in the player, never in the export) */
.sb-safe { position: absolute; inset: 0; pointer-events: none; }
.sb-safe > i { position: absolute; display: none; }
.sb-safe.on-safe .sz-action { display: block; inset: 5%; border: 1px dashed rgba(255, 255, 255, .55); }
.sb-safe.on-safe .sz-title { display: block; inset: 10%; border: 1px solid rgba(34, 211, 238, .7); }
.sb-safe.on-shorts .sz-shorts, .sb-safe.on-reels .sz-reels { display: block; inset: 0; }
.sz-shorts b, .sz-reels b { position: absolute; background: rgba(248, 113, 113, .28); border: 1px solid rgba(248, 113, 113, .6); }
.sz-shorts b:first-child { right: 2%; top: 42%; width: 13%; height: 46%; }   /* like, comment, share buttons */
.sz-shorts b:last-child { left: 0; right: 18%; bottom: 0; height: 17%; }     /* title, channel and caption */
.sz-reels b:first-child { right: 2%; top: 48%; width: 12%; height: 44%; }
.sz-reels b:last-child { left: 0; right: 16%; bottom: 0; height: 20%; }
.sz-reels b { background: rgba(167, 139, 250, .28); border-color: rgba(167, 139, 250, .6); }
/* Clip inspector */
.sbtl-clip-h { margin: 0 0 8px; }
.sbtl-ctabs { margin-bottom: 10px; }
.sb-clippanel .sbtl-pf { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.sb-clippanel .sbtl-pf label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; }
.sb-clippanel .sbtl-pf label.check { justify-content: flex-start; }
.sb-clippanel .sbtl-pf .select, .sb-clippanel .sbtl-pf .input { max-width: 60%; }
.sb-clippanel .sbtl-adj input[type="range"] { flex: 1; width: auto; }
.sb-clippanel .sbtl-txt { flex-direction: column; align-items: stretch !important; }
.sb-clippanel .sbtl-txt textarea { max-width: none !important; min-width: 0; }
.sbtl-proj h3 { margin: 0 0 4px; font-size: 15px; }
/* Tablets: the right column floats over the board; phones: a sheet from the bottom */
@media (max-width: 999px) {
  .sb-right { position: absolute; z-index: 20; right: 0; top: 0; bottom: 0; width: min(380px, 100%); box-shadow: var(--shadow-lg); }
  .sb-rz-right, .sb-rz-side { display: none; }
}
@media (max-width: 699px) {
  .sb-right { top: auto; height: 78%; width: 100%; border-left: 0; border-top: 1px solid var(--border-strong); border-radius: var(--radius) var(--radius) 0 0; overflow-y: auto; }
  .sb-stage { height: 30vh; }
  .sb-rz { display: none; }
}
.sb-rmode { flex: 0 0 auto; display: flex; }
.sb-rmode button { flex: 1; min-height: 32px; }
.sb-stage { height: clamp(160px, 32vh, 400px); }
/* Editor Update U4: timeline header (time left, transport centre, zoom and modes right) and the three modes */
.sbtl-head { flex: 0 0 44px; height: 44px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 0 8px; border-bottom: 1px solid var(--border); background: var(--surface-solid); user-select: none; }
.sbtl-hl { display: flex; align-items: center; gap: 6px; min-width: 0; }
.sbtl-hr { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.sbtl-transport { display: flex; align-items: center; gap: 2px; }
.sbtl-ib { min-width: 32px; height: 32px; padding: 0 6px; display: inline-grid; place-items: center; border: 1px solid transparent; border-radius: var(--radius-xs); background: none; color: var(--muted); cursor: pointer; font: 600 12px var(--font); }
.sbtl-ib:hover { background: var(--surface-3); color: var(--text); }
.sbtl-ib:focus-visible, .sbtl-tc:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sbtl-ib.active, .sbtl-ib[aria-pressed="true"] { color: var(--text); background: var(--accent-soft); border-color: var(--accent); }
.sbtl-play { width: 40px; height: 36px; border-radius: 10px; background: var(--accent); color: #111; margin: 0 4px; }
.sbtl-play:hover { background: var(--accent); color: #000; filter: brightness(1.08); }
.sbtl-io-b.set { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.sbtl-rate { min-width: 0; font: 700 11px var(--mono); color: var(--accent); }
.sbtl-rate:empty { display: none; }
.sbtl-sep { width: 1px; height: 20px; background: var(--border-strong); margin: 0 4px; }
.sbtl-tc { font: 700 13px var(--mono); color: var(--text); background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 4px 8px; cursor: text; min-width: 108px; text-align: left; }
.sbtl-tcin { font: 700 13px var(--mono); width: 104px; background: transparent; color: var(--text); border: 0; padding: 0; outline: none; }
.sbtl-dur { font: 600 11px var(--mono); color: var(--muted); white-space: nowrap; }
.sbtl-load { font-size: 11px; color: var(--muted); white-space: nowrap; }
.sbtl-io { position: absolute; top: 0; height: 22px; background: color-mix(in srgb, var(--accent) 22%, transparent); border-bottom: 2px solid var(--accent); pointer-events: none; z-index: 1; }
.sbtl-iomk { position: absolute; top: 0; width: 6px; height: 22px; border: 2px solid var(--accent); pointer-events: none; z-index: 2; box-sizing: border-box; }
.sbtl-iomk.in { border-right: 0; } .sbtl-iomk.out { border-left: 0; margin-left: -6px; }
.sbtl { transition: none; }
.sb-ed.tl-anim .sbtl { transition: height .2s var(--ease, ease); }
/* Minimized: only the header bar */
.sb-ed.tl-min .sbtl { height: 44px; }
.sb-ed.tl-min .sbtl-top, .sb-ed.tl-min .sbtl-body, .sb-ed.tl-min .sb-rz-tl { display: none; }
.sb-ed.tl-anim.tl-min .sbtl-top, .sb-ed.tl-anim.tl-min .sbtl-body { display: flex; }
.sb-ed.tl-min .sbtl, .sb-ed.tl-anim .sbtl { overflow: hidden; }
/* Full screen: the timeline moves into the editor body next to the icon sidebar, the Player stays top right */
.sb-ed.tl-full .sb-top, .sb-ed.tl-full .sb-tools, .sb-ed.tl-full .sb-main, .sb-ed.tl-full .sb-rz-side, .sb-ed.tl-full .sb-rz-tl { display: none; }
.sb-ed.tl-full .sb-body .sb-tlwrap { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; border-top: 0; }
.sb-ed.tl-full .sb-tlhost { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sb-ed.tl-full .sbtl { flex: 1; height: auto; min-height: 0; }
.sb-ed.tl-full .sb-right, .sb-ed.tl-full.panel-off .sb-right { display: flex; position: static; flex: 0 0 min(var(--right-w, 340px), 30vw); width: min(var(--right-w, 340px), 30vw); height: auto; box-shadow: none; border-radius: 0; }
.sb-ed.tl-full.panel-off .sb-rz-right { display: block; }
.sb-ed.tl-full .sb-rmode, .sb-ed.tl-full .sb-panel, .sb-ed.tl-full .sb-clippanel { display: none; }
.sb-ed.tl-full .sb-stage { height: clamp(160px, 42vh, 440px); }
@media (max-width: 999px) {
  .sb-ed.tl-full .sb-body { flex-direction: column; }
  .sb-ed.tl-full .sb-side { display: none; }
  .sb-ed.tl-full .sb-right, .sb-ed.tl-full.panel-off .sb-right { order: -1; width: 100%; flex: 0 0 auto; border-left: 0; border-bottom: 1px solid var(--border); overflow: visible; }
  .sb-ed.tl-full .sb-stage { height: 26vh; }
  .sb-ed.tl-full .sb-rz-right, .sb-ed.tl-full.panel-off .sb-rz-right { display: none; }
}
/* The header follows the timeline's own width (docked, full screen next to the Player, or a phone) */
.sbtl { container-type: inline-size; container-name: sbtl; }
@container sbtl (max-width: 760px) { .sbtl-dur { display: none; } }
@container sbtl (max-width: 620px) {
  .sbtl-head { height: auto; flex-basis: auto; grid-template-columns: 1fr auto; row-gap: 2px; padding: 4px 6px; }
  .sbtl-transport { grid-column: 1 / -1; grid-row: 2; justify-content: center; flex-wrap: wrap; }
}
@media (max-width: 699px) { .sb-ed.tl-min .sbtl { height: auto; } }
/* Editor Update U5: tool strip, track headers, clip pictures, trim feedback, right-click menu */
.sbtl-body { flex: 1; min-height: 0; display: flex; }
.sbtl-body .sbtl-scroll { flex: 1; min-width: 0; }
.sbtl-tools { flex: 0 0 38px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px; border-right: 1px solid var(--border); background: var(--surface-solid); overflow-y: auto; }
.sbtl-tools .sbtl-ib { width: 32px; min-width: 32px; padding: 0; }
.sbtl-top .sbtl-bar { flex-wrap: wrap; }
.sbtl-top { padding: 4px 8px; }
.sbtl-zoom { width: 96px; accent-color: var(--accent); }
.sb-ed.tl-full .sbtl-body { flex: 1; }
/* Cursors follow the tool */
.sbtl[data-cur="razor"] .sbtl-clip { cursor: crosshair; }
.sbtl[data-cur="hand"] .sbtl-grid { cursor: grab; } .sbtl[data-cur="hand"] .sbtl-clip { cursor: grab; }
.sbtl[data-cur="zoom"] .sbtl-lane, .sbtl[data-cur="zoom"] .sbtl-clip { cursor: zoom-in; }
.sbtl[data-cur="type"] .sbtl-lane, .sbtl[data-cur="type"] .sbtl-clip { cursor: text; }
.sbtl[data-cur="trackfwd"] .sbtl-lane, .sbtl[data-cur="trackfwd"] .sbtl-clip { cursor: e-resize; }
.sbtl[data-cur="slip"] .sbtl-clip, .sbtl[data-cur="slide"] .sbtl-clip { cursor: ew-resize; }
.sbtl[data-cur="ripple"] .sbtl-e, .sbtl[data-cur="roll"] .sbtl-e, .sbtl-e { cursor: col-resize; }
.sbtl[data-cur="razor"] .sbtl-e, .sbtl[data-cur="hand"] .sbtl-e, .sbtl[data-cur="zoom"] .sbtl-e, .sbtl[data-cur="type"] .sbtl-e, .sbtl[data-cur="slip"] .sbtl-e, .sbtl[data-cur="slide"] .sbtl-e, .sbtl[data-cur="trackfwd"] .sbtl-e { pointer-events: none; }
/* Track headers */
.sbtl-row { height: 44px; position: relative; }
.sbtl-row.locked .sbtl-lane { background: repeating-linear-gradient(135deg, transparent, transparent 8px, rgba(255, 255, 255, .03) 8px, rgba(255, 255, 255, .03) 16px); }
.sbtl-row.locked .sbtl-clip { opacity: .6; cursor: not-allowed; }
.sbtl-tgt { flex: 0 0 auto; min-width: 28px; height: 22px; padding: 0 3px; border-radius: 5px; border: 1px solid var(--border-strong); background: none; color: var(--muted); font: 700 10px var(--mono); cursor: pointer; }
.sbtl-tgt.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.sbtl-tn { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.sbtl-hb { flex: 0 0 auto; width: 22px; height: 22px; display: inline-grid; place-items: center; padding: 0; border-radius: 5px; border: 1px solid transparent; background: none; color: var(--muted); font: 700 10px var(--font); cursor: pointer; }
.sbtl-hb:hover { background: var(--surface-3); color: var(--text); }
.sbtl-hb.on { background: var(--warn); color: #111; }
.sbtl-tgt:focus-visible, .sbtl-hb:focus-visible, .sbtl-hrz:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sbtl-hrz { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; cursor: row-resize; z-index: 3; }
.sbtl-hrz:hover, .sbtl-hrz:focus-visible { background: var(--accent); opacity: .6; }
/* Clips: filmstrip and waveform under the name, saffron outline when selected */
.sbtl-vis { position: absolute; left: 0; top: 0; height: 100%; pointer-events: none; }
.sbtl-clip.vis .sbtl-cl { position: relative; text-shadow: 0 1px 2px rgba(0, 0, 0, .9); align-self: flex-start; padding-top: 3px; }
.sbtl-clip.sel { outline: 2px solid var(--accent); box-shadow: 0 0 0 1px #000 inset; }
.sbtl-e.limit { background: #ef4444 !important; }
/* Ruler ticks */
.sbtl-ruler { background-image: linear-gradient(to right, var(--border-strong) 1px, transparent 1px); background-repeat: repeat-x; }
/* Trim feedback */
.sbtl-snap { position: absolute; top: 0; bottom: 0; width: 1px; background: #fde047; z-index: 5; pointer-events: none; }
.sbtl-snap.flash { animation: sbtl-flash .35s ease-out; }
@keyframes sbtl-flash { from { box-shadow: 0 0 0 3px rgba(253, 224, 71, .6); } to { box-shadow: none; } }
@media (prefers-reduced-motion: reduce) { .sbtl-snap.flash { animation: none; } }
.sbtl { position: relative; }
.sbtl-tip { position: absolute; z-index: 30; padding: 4px 8px; border-radius: 6px; background: #000; color: #fff; font: 600 12px var(--mono); white-space: nowrap; pointer-events: none; box-shadow: var(--shadow-lg); }
/* Right-click menu */
.sbtl-menu { position: fixed; z-index: 90; min-width: 220px; padding: 4px; border-radius: var(--radius-sm); background: var(--surface-solid); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
.sbtl-menu button { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 32px; padding: 0 10px; border: 0; border-radius: 6px; background: none; color: var(--text); font: 500 13px var(--font); text-align: left; cursor: pointer; }
.sbtl-menu button:hover:not(:disabled), .sbtl-menu button:focus-visible { background: var(--surface-3); outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.sbtl-menu button:disabled { color: var(--muted); opacity: .55; cursor: default; }
.sbtl-menu kbd { font: 11px var(--mono); color: var(--muted); }
/* Marker dialog */
.sbtl-mkc { border: 0; padding: 0; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 8px 14px; }
.sbtl-mkc legend { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.sbtl-mkc label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.sbtl-mkc span { width: 14px; height: 14px; border-radius: 3px; background: var(--mk); transform: rotate(45deg); }
@media (max-width: 699px) { .sbtl-top .sbtl-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; } .sbtl-top .sbtl-bar > * { flex-shrink: 0; } .sbtl-tools { flex-basis: 34px; } .sbtl-tools .sbtl-ib { width: 30px; min-width: 30px; height: 30px; } .sbtl-zoom { width: 64px; } }
/* Editor Update U6: titles (preset tiles, Title tab sections) */
.sb-dialog.sbtl-tpick { width: min(760px, calc(100vw - 32px)); max-width: min(760px, calc(100vw - 32px)); }
.sbtl-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 10px 0 14px; }
.sbtl-tile { display: flex; flex-direction: column; gap: 6px; padding: 6px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-solid); color: var(--text); font: 600 13px var(--font); cursor: pointer; text-align: left; }
.sbtl-tile canvas { width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 6px; display: block; }
.sbtl-tile:hover { border-color: var(--accent); }
.sbtl-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sbtl-sec { margin: 10px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.sb-clippanel .sbtl-pf input[type="color"] { width: 44px; height: 28px; padding: 0; border: 1px solid var(--border-strong); border-radius: 6px; background: none; }
@media (max-width: 699px) { .sbtl-tiles { grid-template-columns: repeat(2, 1fr); } }
.sb-help-grid:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sbtl-zoom:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
