/* Board Studio (/whiteboard). It wears Video Studio's frame and panels
   (video-studio.css): menus and Export along the top, then the library, the
   board and the settings in a row. The tools float on the board's left
   edge and the zoom in its corner. On a phone the library and the settings
   become sheets opened from tabs, and the tools run along the bottom. The
   board itself is the person's paper: white, cream, dark or chalkboard. */

/* ---- Start screen ---- */
.bs-new .st-new-row > .st-field { flex: 0 0 auto; }

/* ---- The frame ---- */
.bs-work { grid-template-rows: auto minmax(0, 1fr); }
.bs-body { grid-template-columns: 252px minmax(0, 1fr) 292px; }
.bs-main { position: relative; display: grid; min-width: 0; min-height: 0; }
.bs-menu { max-height: 72vh; overflow-y: auto; scrollbar-width: thin; }
.bs-menu-head { margin: 6px 10px 2px; color: var(--accent-strong); font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; }
.bs-menu-sep { margin: 4px 6px; border: 0; border-top: 1px solid var(--border); }

/* ---- The board ---- */
.bs-view { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #fff; touch-action: none; }
.bs-svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; outline: none; cursor: default; touch-action: none; -webkit-user-select: none; user-select: none; }
.bs-app[data-tool="hand"] .bs-svg, .bs-svg.is-space { cursor: grab; }
.bs-svg.is-panning { cursor: grabbing; }
.bs-app:is([data-tool="shape"], [data-tool="frame"], [data-tool="line"], [data-tool="sticky"], [data-tool="pen"], [data-tool="highlighter"]) .bs-svg { cursor: crosshair; }
.bs-app[data-tool="text"] .bs-svg { cursor: text; }
.bs-app[data-tool="eraser"] .bs-svg { cursor: cell; }
.bs-app[data-tool="select"] .bs-el { cursor: move; }
.bs-app[data-tool="select"] .bs-el.bs-gantt [data-task] { cursor: ew-resize; }
.bs-el.is-locked { pointer-events: none; }
.bs-fold { cursor: pointer; }
.bs-fold:hover circle { stroke-width: 2.5; }

/* What sits over the board at screen size. */
.bs-over { pointer-events: none; }
.bs-over :is(.bs-handle, .bs-end, .bs-grow) { pointer-events: all; }
.bs-sel-box { fill: none; stroke: #7c4dff; stroke-width: 1.5; }
.bs-sel-all { fill: none; stroke: #7c4dff; stroke-width: 1; stroke-dasharray: 4 3; }
.bs-handle { fill: #fff; stroke: #7c4dff; stroke-width: 1.5; }
.bs-handle[data-handle="nw"], .bs-handle[data-handle="se"] { cursor: nwse-resize; }
.bs-handle[data-handle="ne"], .bs-handle[data-handle="sw"] { cursor: nesw-resize; }
.bs-handle[data-handle="n"], .bs-handle[data-handle="s"] { cursor: ns-resize; }
.bs-handle[data-handle="e"], .bs-handle[data-handle="w"] { cursor: ew-resize; }
.bs-end { fill: #fff; stroke: #7c4dff; stroke-width: 2; cursor: move; }
.bs-end.is-bound { fill: #7c4dff; stroke: #fff; }
.bs-grow { cursor: crosshair; }
.bs-grow circle { fill: #7c4dff; fill-opacity: 0.9; stroke: #fff; stroke-width: 1.5; }
.bs-grow path { fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; }
.bs-grow:hover circle { fill: #e8b44f; stroke: #07040d; }
.bs-grow:hover path { stroke: #07040d; }
.bs-port { fill: #fff; stroke: #7c4dff; stroke-width: 1.5; }
.bs-port.is-on { fill: #7c4dff; }
.bs-target { fill: rgba(124, 77, 255, 0.08); stroke: #7c4dff; stroke-width: 2; }
.bs-marquee { fill: rgba(124, 77, 255, 0.08); stroke: #7c4dff; stroke-width: 1; stroke-dasharray: 3 3; }
.bs-guide { stroke: #e5484d; stroke-width: 1; stroke-dasharray: 3 2; }
.bs-erase { fill: rgba(229, 72, 77, 0.12); stroke: #e5484d; stroke-width: 1.5; }

.bs-editor { position: absolute; z-index: 4; margin: 0; padding: 0 2px; overflow: hidden; color: inherit; background: transparent; border: 0; border-radius: 0; outline: 1.5px dashed #7c4dff; outline-offset: 3px; resize: none; white-space: pre-wrap; overflow-wrap: break-word; -webkit-user-select: text; user-select: text; }
.bs-editor[hidden] { display: none; }

/* The tools, standing on the board's left edge. */
.bs-rail { position: absolute; left: 10px; top: 50%; z-index: 5; display: flex; flex-direction: column; gap: 2px; max-height: calc(100% - 24px); padding: 4px; overflow-y: auto; background: var(--surface); border: 2px solid var(--edge); box-shadow: var(--hard); scrollbar-width: none; transform: translateY(-50%); }
.bs-rail::-webkit-scrollbar { display: none; }
.bs-tool { width: 34px; height: 34px; color: var(--muted); }
.bs-tool.is-on { color: var(--tint-text, #fff); background: var(--tint); }
.bs-rail-gap { flex: none; height: 1px; margin: 3px 4px; background: var(--border); }

.bs-zoom { position: absolute; right: 10px; bottom: 10px; z-index: 5; display: flex; align-items: center; gap: 1px; padding: 2px; background: var(--surface); border: 2px solid var(--edge); box-shadow: var(--hard); }
.bs-zoom-val { min-width: 50px; padding: 4px 2px; color: var(--text); background: none; border: 0; font: 500 0.72rem/1 var(--mono); cursor: pointer; }
.bs-zoom-val:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.bs-msg { position: absolute; left: 60px; bottom: 10px; z-index: 5; max-width: calc(100% - 260px); margin: 0; pointer-events: none; }
.bs-msg:not(:empty) { padding: 6px 10px; color: var(--text); background: var(--surface); border: 2px solid var(--edge); box-shadow: var(--hard); }
.bs-msg[data-kind="warn"] { border-color: var(--gold); }
.bs-msg[data-kind="ok"] { border-color: #2ec4b6; }

/* Presenting: the board alone. */
.bs-work.is-present { grid-template-rows: minmax(0, 1fr); }
.bs-work.is-present :is(.vs-top, .vs-lib, .vs-insp, .bs-rail, .bs-zoom, .vs-tabs) { display: none; }
.bs-work.is-present .bs-body { grid-template-columns: minmax(0, 1fr); }
.bs-work.is-present .bs-msg { left: 50%; transform: translateX(-50%); max-width: 90%; }
.bs-work.is-present .bs-svg { cursor: pointer; }
.bs-work:fullscreen { width: 100%; height: 100%; margin: 0; border: 0; }

/* ---- Library ---- */
.bs-lib-body { padding-bottom: 24px; }
.bs-stickies { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.bs-sticky-btn { aspect-ratio: 1; padding: 0; border: 2px solid var(--edge); border-radius: 0; box-shadow: 2px 2px 0 var(--edge); cursor: pointer; transition: transform 160ms var(--spring, ease); }
.bs-sticky-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.bs-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.bs-tile { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; padding: 7px 2px 5px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 0; font: inherit; font-size: 0.66rem; line-height: 1.2; cursor: pointer; transition: border-color 140ms ease, color 140ms ease; }
.bs-tile:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.bs-tile-icon { display: grid; place-items: center; height: 30px; color: var(--text); }
.bs-tile-name { max-width: 100%; overflow: hidden; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.bs-rows { display: flex; flex-direction: column; gap: 6px; }
.bs-row-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 10px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 0; font: inherit; text-align: left; cursor: pointer; }
.bs-row-btn b { font-weight: 600; }
.bs-row-btn small { color: var(--muted); font-size: 0.74rem; line-height: 1.3; }
.bs-row-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.bs-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.bs-frames { display: flex; flex-direction: column; gap: 2px; margin: 0 0 10px; padding: 0; list-style: none; }
.bs-frame-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; width: 100%; padding: 6px 8px; color: var(--muted); background: none; border: 0; border-radius: 0; font: inherit; text-align: left; cursor: pointer; }
.bs-frame-row.is-sel { color: var(--text); background: var(--tint); }
.bs-frame-row small { font-family: var(--mono); font-size: 0.66rem; }
.bs-frame-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bs-frame-row:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.bs-makers { grid-template-columns: 1fr; }
.bs-makers .vs-maker-btn { padding: 9px 10px; }
.bs-makers .vs-maker-icon { width: 34px; height: 34px; }

/* ---- Settings ---- */
.bs-insp-kind { margin: 2px 0 0; }
.bs-swatches { display: flex; flex-wrap: wrap; gap: 5px; }
.bs-sw { width: 22px; height: 22px; padding: 0; border: 2px solid var(--edge); border-radius: 0; cursor: pointer; }
.bs-sw.is-none { background: linear-gradient(135deg, #fff 45%, #e5484d 45%, #e5484d 55%, #fff 55%); }
.bs-sw.is-on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent-strong); }
.bs-sw:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.bs-well { width: 30px; height: 22px; padding: 0; background: none; border: 2px solid var(--edge); border-radius: 0; cursor: pointer; }
.bs-in { flex: 1 1 auto; min-width: 0; padding: 5px 8px; font-size: 0.8rem; }
.bs-icon-row { display: flex; flex-wrap: wrap; gap: 2px; }
.bs-task { padding: 8px 0; border-top: 1px solid var(--border); }
.bs-task:first-child { border-top: 0; padding-top: 0; }
.bs-task-top { display: flex; align-items: center; gap: 2px; margin-bottom: 6px; }
.bs-task-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.bs-task-grid label { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.bs-task-grid label.is-wide { grid-column: 1 / -1; }
.bs-task-grid span { color: var(--muted); font-size: 0.7rem; }
.bs-task-grid :is(input, select) { width: 100%; min-width: 0; }
.bs-task-grid input[type="date"] { padding: 4px 6px; font-size: 0.76rem; }

/* ---- Dialogs ---- */
.bs-text-dlg { display: flex; flex-direction: column; gap: 8px; }
.bs-src { width: 100%; min-height: 240px; padding: 10px 12px; font: 0.82rem/1.5 var(--mono); resize: vertical; white-space: pre; }
.bs-export { display: flex; flex-direction: column; gap: 12px; }
.bs-fmt-group .st-field-label { margin: 0 0 6px; }
.bs-fmt-row { display: flex; flex-wrap: wrap; gap: 6px; }
.bs-fmt { flex: 0 0 auto; }
.bs-fmt:disabled { opacity: 0.4; cursor: default; }
.bs-fmt-line { min-height: 1.3em; margin: 0; }
.bs-exp-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding-top: 10px; border-top: 1px solid var(--border); }
.bs-exp-opts .vs-field { flex: 0 1 auto; }
.bs-exp-opts .vs-field[hidden], .bs-exp-opts .vs-check[hidden] { display: none; }
.bs-exp-opts select { min-width: 200px; }
.bs-formats p { margin: 0 0 10px; }
.bs-ftable { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.bs-ftable th, .bs-ftable td { padding: 6px 8px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.bs-ftable th { color: var(--accent-strong); font: 500 0.66rem/1.2 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }

@media (hover: hover) {
  .bs-tile:hover, .bs-row-btn:hover { color: var(--text); border-color: var(--gold); }
  .bs-sticky-btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--edge); }
  .bs-frame-row:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
  .bs-zoom-val:hover { color: var(--gold); }
}

/* ---- Phones ---- */
@media (max-width: 760px) {
  .bs-new .st-new-row > .st-field { flex: 1 1 100%; }
  .bs-new .seg { flex-wrap: wrap; }
  .bs-work { grid-template-rows: auto minmax(0, 1fr) auto; }
  .bs-body { grid-template-columns: minmax(0, 1fr); }
  .bs-main { height: 100%; }
  .bs-rail { left: 6px; right: 6px; top: auto; bottom: 6px; flex-direction: row; max-height: none; overflow-x: auto; overflow-y: hidden; transform: none; }
  .bs-tool { width: 38px; height: 38px; }
  .bs-rail-gap { width: 1px; height: auto; margin: 4px 3px; }
  .bs-zoom { top: 6px; right: 6px; bottom: auto; }
  #bs-zoom-out, #bs-zoom-in { display: none; }
  .bs-msg { left: 8px; right: 8px; bottom: 62px; max-width: none; }
  .bs-sw { width: 28px; height: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .bs-work * { transition: none !important; animation: none !important; }
}
.bs-work .vs-insp .seg-small .seg-btn { padding-left: 8px; padding-right: 8px; }
