/* Independent drawings share one pinned viewport; only the inspector scrolls. */
.preview {
  grid-template-rows: auto auto minmax(0, 1fr) 36px auto;
  padding-left: 24px;
  padding-right: 24px;
}
.preview-heading {
  margin-bottom: 14px;
}
.board-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 0 13px;
  min-width: 0;
}
.board-controls,
.board-zoom {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.board-zoom {
  margin-left: auto;
}
.board-toolbar .button,
.board-toolbar select {
  min-height: 30px;
  padding: 6px 9px;
  font-size: 11px;
}
.board-toolbar .icon-button {
  flex: 0 0 30px;
  height: 30px;
  font-size: 17px;
}
.board-toolbar label {
  color: var(--muted);
  font-size: 10px;
}
.board-toolbar select {
  background: #fdfdf9;
  max-width: 170px;
}
.board-toolbar #canvas-select {
  max-width: 155px;
  font-weight: 550;
}
.board-toolbar #add-canvas {
  background: #eaf0de;
  border-color: #cfd9bd;
}
.board-toolbar #add-canvas:hover {
  background: #dde8ca;
}
.board-toolbar #zoom-out {
  margin-left: auto;
}
.board-toolbar #zoom-level {
  min-width: 40px;
  text-align: center;
  color: #707b65;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.comparison-stage {
  display: block;
  overflow: hidden;
  padding: 0;
  cursor: grab;
  isolation: isolate;
  touch-action: none;
  border: 1px solid #e0e5d7;
  border-radius: 7px;
  background-color: #f0f2e980;
}
.comparison-stage::before,
.comparison-stage::after {
  display: none;
}
.comparison-stage:focus-visible {
  outline: 2px solid #71894a;
  outline-offset: 2px;
}
.board-world {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.board-snap-guides {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  overflow: hidden;
  pointer-events: none;
  color: #3a796c;
}
.board-snap-guides line {
  stroke: currentColor;
  stroke-width: 1;
  stroke-dasharray: 4 3;
}
.board-snap-guides [data-kind="spacing"] {
  color: #9a6736;
}
.board-snap-guides [data-kind="spacing"] line {
  stroke-dasharray: none;
}
.board-snap-guides [data-kind="grid"] {
  color: #777f71;
}
.board-snap-guides rect {
  fill: #fffffa;
}
.board-snap-guides text {
  fill: currentColor;
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.board-snap-hint {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 5;
  max-width: calc(100% - 24px);
  padding: 7px 10px;
  border: 1px solid #cbd7c4;
  border-radius: 5px;
  background: #fffffaf2;
  color: #405536;
  font-size: 11px;
  pointer-events: none;
}
.artboard {
  position: absolute;
  margin: 0;
  box-shadow: 0 5px 20px #29332513;
  background: #fff;
  outline: calc(1px / var(--board-zoom, 1)) solid #d6dccd;
}
.artboard.is-selected {
  z-index: 1;
  outline: calc(2px / var(--board-zoom, 1)) solid #748e55;
}
.artboard.is-active {
  z-index: 2;
  outline-color: #486442;
}
.artboard.is-dragging {
  z-index: 3;
  box-shadow: 0 12px 30px #29332528;
}
.artboard-handle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 0 13px;
  border: 0;
  border-radius: 0;
  background: #e9ede2;
  color: #697460;
  cursor: grab;
  touch-action: none;
  text-align: left;
  font-size: 14px;
  user-select: none;
}
.artboard-handle:hover {
  background: #dfe6d4;
}
.artboard.is-selected .artboard-handle {
  background: #e2ebd7;
  color: #405536;
}
.artboard.is-active .artboard-handle {
  background: #dce8c9;
  color: #405536;
}
.artboard-handle:focus-visible {
  outline: calc(2px / var(--board-zoom, 1)) solid #486442;
  outline-offset: calc(3px / var(--board-zoom, 1));
}
.artboard-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 550;
}
.artboard-drag-hint {
  font-size: 22px;
  opacity: 0.6;
  line-height: 1;
}
.artboard-paper,
.artboard-paper#canvas-host {
  position: relative;
  max-width: none;
  max-height: none;
  box-shadow: none;
  background: #fff;
  overflow: hidden;
  cursor: default;
}
.artboard-paper canvas,
.artboard-paper#canvas-host canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  touch-action: none;
}
.artboard-empty {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 75%;
  max-width: 420px;
  font-size: 16px;
  padding: 26px;
}
.comparison-stage.is-panning,
.comparison-stage.is-panning *,
.comparison-stage.is-moving-artboard .artboard-handle {
  cursor: grabbing !important;
}
@media (min-width: 1550px) {
  .preview {
    padding-left: 40px;
    padding-right: 40px;
  }
}
@media (max-width: 1000px) {
  .preview {
    padding-left: 16px;
    padding-right: 16px;
  }
  .board-toolbar {
    gap: 5px;
  }
}
@media (max-width: 680px) {
  .workspace {
    grid-template-rows: 46% minmax(0, 1fr);
  }
  .preview {
    padding: 10px 12px 0;
    grid-template-rows: auto auto minmax(0, 1fr) 25px;
  }
  .preview-heading {
    margin-bottom: 7px;
  }
  .board-toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
    padding-bottom: 8px;
    gap: 5px;
  }
  .board-toolbar > * {
    flex-shrink: 0;
  }
  .board-toolbar select,
  .board-toolbar #canvas-select {
    max-width: 120px;
  }
  .board-zoom,
  .board-toolbar #zoom-out {
    margin-left: 0;
  }
  .board-toolbar .button,
  .board-toolbar select {
    min-height: 27px;
    padding: 5px 8px;
    font-size: 10px;
  }
  .board-toolbar .icon-button {
    flex-basis: 27px;
    height: 27px;
  }
}

.paper-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.inspector.is-empty {
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.inspector > [hidden] {
  display: none;
}
#selection-empty {
  padding: 28px 23px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}
#selection-empty h3 {
  color: var(--ink);
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 500;
}
@media (max-width: 680px) {
  .inspector.is-empty {
    grid-template-rows: minmax(0, 1fr) auto;
  }
}
#rename-form > label {
  display: block;
  margin: 20px 0 8px;
  color: var(--muted);
  font-size: 12px;
}
#canvas-name {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  padding: 11px;
  color: var(--ink);
  margin-bottom: 22px;
}
#editing-canvas {
  display: block;
  max-width: 245px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.canvas-caption > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 12px;
}
.canvas-caption > span:last-child {
  flex-shrink: 0;
}

.board-zoom > [hidden] {
  display: none;
}

/* A page-sized exhibition reuses the same board and navigation controls. */
body.is-view-mode {
  display: block;
}
.is-view-mode .masthead,
.is-view-mode .project-nav,
.is-view-mode .inspector,
.is-view-mode .statusbar,
.is-view-mode .preview-heading,
.is-view-mode .board-controls,
.is-view-mode .canvas-caption,
.is-view-mode .preview-footer,
.is-view-mode #view-mode,
.is-view-mode #view-all-mode {
  display: none;
}
.is-view-mode .workspace {
  display: block;
}
.is-view-mode .preview {
  position: fixed;
  inset: 0;
  display: block;
  padding: 0;
  background: #f1f2ec;
}
.is-view-mode .comparison-stage {
  --board-top-inset: 88px;
  position: absolute;
  inset: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.is-view-mode .board-toolbar {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: max-content;
  max-width: calc(100% - 24px);
  padding: 8px;
  margin: 0;
  border: 1px solid #d9dfd1;
  border-radius: 10px;
  background: #fffffaf5;
  box-shadow: 0 4px 20px #29332512;
  overflow: visible;
}
.is-view-mode .board-zoom,
.is-view-mode .board-toolbar #zoom-out {
  margin: 0;
}
.is-view-mode .board-toolbar .button,
.is-view-mode .board-toolbar .icon-button {
  min-height: 40px;
  height: 40px;
}
.is-view-mode .board-toolbar .icon-button {
  width: 36px;
  flex-basis: 36px;
}
.is-view-mode #exit-view-mode {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  margin-left: 4px;
}
.is-view-mode #exit-view-mode:hover {
  background: #46563f;
}
.is-view-mode .artboard {
  background: transparent;
  outline: none;
  box-shadow: none;
  pointer-events: none;
}
.is-view-mode .artboard-handle {
  /* Reserve its geometry so every paper keeps its existing world position. */
  visibility: hidden;
}
.is-view-mode .artboard-paper,
.is-view-mode .artboard-paper#canvas-host {
  box-shadow: 0 5px 24px #29332515;
  pointer-events: auto;
}
@media (max-width: 480px) {
  .is-view-mode .board-zoom {
    gap: 4px;
  }
  .is-view-mode #zoom-level {
    display: none;
  }
  .is-view-mode .board-toolbar .button {
    padding: 6px;
    font-size: 11px;
  }
  .is-view-mode #exit-view-mode {
    margin-left: 0;
  }
}
