/* The lesson board (spec 4.5, BD-9, BD-11, BD-12). Stickers keep the same
   pastel in light and dark; the canvas is #F4F1EC or #1B1C21. */
body.bd-open {
  overflow: hidden;
}
.board-view {
  --bd-canvas: #f4f1ec;
  --bd-ink: #2a2b33;
  --bd-dot: rgb(42 43 51 / 14%);
  position: fixed;
  inset: 0;
  z-index: 85;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  color: var(--text);
  background: var(--bg);
}
:root[data-theme="dark"] .board-view {
  --bd-canvas: #1b1c21;
  --bd-dot: rgb(255 255 255 / 12%);
}
.bd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.bd-head-copy,
.bd-head-actions,
.bd-zoom,
.bd-live-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.bd-head-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}
.bd-title {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bd-zoom-label {
  min-width: 44px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.badge--live {
  color: var(--on-accent);
  background: var(--accent);
}
.bd-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.bd-tools-gap {
  flex: 1 1 auto;
}
.bd-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--text);
  background: transparent;
  white-space: nowrap;
}
.bd-tool:hover:not(:disabled),
.bd-tool.is-active {
  border-color: var(--line-strong);
  background: var(--accent-soft);
}
.bd-tool:disabled {
  opacity: 0.45;
}

.bd-canvas {
  position: relative;
  overflow: hidden;
  outline: none;
  touch-action: none;
  user-select: none;
  background-color: var(--bd-canvas);
  background-image: radial-gradient(
    circle,
    var(--bd-dot) 1.2px,
    transparent 1.4px
  );
  background-size: var(--bd-grid, 24px) var(--bd-grid, 24px);
  cursor: grab;
}
.bd-canvas:active {
  cursor: grabbing;
}
.bd-world {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.bd-item {
  position: absolute;
  box-sizing: border-box;
  overflow: hidden;
  border-radius: 6px;
  color: var(--bd-ink);
  cursor: default;
  outline: none;
}
.bd-item:focus-visible,
.bd-item.is-selected {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.bd-item.is-mine,
.bd-item.is-shared {
  cursor: move;
}
.bd-item.is-pending {
  opacity: 0.7;
}
.bd-item--sticky,
.bd-item--card {
  --bd-fill: #fbf0c4;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--bd-fill) 88%, #000);
  background: var(--bd-fill);
  box-shadow: 0 1px 2px rgb(0 0 0 / 12%);
}
.bd-item[data-color="pink"] {
  --bd-fill: #f9d6e2;
}
.bd-item[data-color="mint"] {
  --bd-fill: #d5eedd;
}
.bd-item[data-color="lavender"] {
  --bd-fill: #e2dbf5;
}
.bd-item[data-color="blue"] {
  --bd-fill: #d3e6f7;
}
.bd-item[data-color="butter"] {
  --bd-fill: #fbf0c4;
}
.bd-item[data-color="peach"] {
  --bd-fill: #fce1cf;
}
.bd-text {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.bd-item--text {
  padding: 4px 6px;
  color: var(--text);
}
.bd-text--heading {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}
.bd-card-title {
  display: block;
  margin-bottom: 6px;
  font-size: 20px;
}
.bd-item--frame {
  border: 1.5px solid color-mix(in srgb, var(--text) 38%, transparent);
  border-radius: 10px;
  background: transparent;
  overflow: visible;
}
.bd-frame-title {
  position: absolute;
  left: 8px;
  top: -26px;
  max-width: 100%;
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bd-item--image {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  border: 1px solid var(--line-strong);
  background: var(--panel);
}
.bd-image {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  pointer-events: none;
}
.bd-caption {
  padding: 4px 8px;
  color: var(--bd-ink);
  background: #fff;
  font-size: 16px;
}
.bd-photo-gone,
.bd-word-gone {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  height: 100%;
  padding: 8px;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 16px;
  text-align: center;
}
.bd-item--word {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 12%);
}
.bd-word-image {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  pointer-events: none;
}
.bd-word-copy {
  display: grid;
  min-width: 0;
  flex: 1;
}
.bd-word-copy strong {
  font-size: 20px;
}
.bd-word-copy span {
  color: #5c5c61;
  font-size: 16px;
}
.bd-item--link {
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  background: #fff;
}
.bd-link {
  display: grid;
  color: #24558c;
  font-size: 16px;
  text-decoration: underline;
}
.bd-link small {
  color: #5c5c61;
  font-size: 14px;
}
.bd-handle {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 20px;
  height: 20px;
  border-radius: 6px 0 6px 0;
  background: var(--accent);
  cursor: nwse-resize;
}
.bd-lock {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 16px;
  height: 16px;
  opacity: 0.7;
}
.bd-lock .icon {
  width: 16px;
  height: 16px;
}
.bd-item.is-shared::after {
  content: "";
  position: absolute;
  left: 4px;
  bottom: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.bd-marquee {
  position: absolute;
  border: 1px dashed var(--accent);
  background: var(--accent-soft);
  pointer-events: none;
}
.bd-editor {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  resize: none;
  color: inherit;
  background: transparent;
  font: inherit;
  font-size: 18px;
  line-height: 1.35;
}
.bd-selbar {
  position: absolute;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  max-width: calc(100% - 16px);
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.bd-bar-btn {
  min-width: 40px;
}
.bd-bar-btn.is-active {
  background: var(--accent-soft);
}
.bd-colors {
  display: inline-flex;
  gap: 4px;
  padding-inline: 4px;
}
.bd-color {
  width: 24px;
  height: 24px;
  min-height: 0;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: var(--bd-swatch);
  box-shadow: 0 0 0 1px var(--line-strong);
}
.bd-color.is-active {
  border-color: var(--accent);
}
.bd-panel {
  position: absolute;
  z-index: 4;
  top: 96px;
  right: 8px;
  bottom: 8px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(320px, calc(100% - 16px));
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.bd-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.bd-panel-head h3 {
  margin: 0;
  font-size: 15px;
}
.bd-words {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}
.bd-word-option .btn {
  display: grid;
  justify-items: start;
  width: 100%;
  text-align: left;
}
.bd-pictures {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 10px;
}
.bd-picture {
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
}
.bd-picture img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.bd-popover {
  position: absolute;
  z-index: 5;
  display: grid;
  gap: 8px;
  width: min(320px, calc(100% - 16px));
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.bd-popover-actions {
  display: flex;
  gap: 8px;
}
.bd-banner {
  position: absolute;
  z-index: 6;
  left: 50%;
  top: 100px;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: var(--r-pill);
  color: var(--on-accent);
  background: var(--danger);
  font-size: 14px;
}
.board-view.is-offline .bd-canvas {
  filter: grayscale(0.4);
}
.bd-toasts {
  position: absolute;
  z-index: 7;
  left: 50%;
  bottom: 16px;
  display: grid;
  gap: 8px;
  transform: translateX(-50%);
  width: min(440px, calc(100% - 16px));
}
.bd-toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.bd-toast--error {
  border-color: var(--danger);
}
/* lists */
.bd-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.bd-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--panel);
}
.bd-list-open {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
  text-align: left;
}
.bd-list-actions,
.bd-list-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.bd-list-bar {
  justify-content: space-between;
  margin-bottom: 12px;
}
.bd-templates {
  display: grid;
  gap: 8px;
}
.bd-template {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  color: var(--text);
  background: var(--panel);
  text-align: left;
}
.bd-template[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}
/* tablet: touch targets from 44 px; phone: a viewer with own notes (BD-11) */
@media (max-width: 1023px) {
  .bd-tool,
  .bd-bar-btn {
    min-height: 44px;
  }
  .bd-handle {
    width: 28px;
    height: 28px;
  }
}
@media (max-width: 767px) {
  .bd-tool-label {
    display: none;
  }
  .bd-tool {
    min-width: 44px;
    justify-content: center;
  }
  .bd-panel {
    top: auto;
    height: 55%;
    width: calc(100% - 16px);
  }
  .bd-head {
    flex-wrap: wrap;
  }
}
@media (prefers-reduced-motion: reduce) {
  .board-view * {
    transition: none !important;
    animation: none !important;
  }
}
html[data-anim="off"] .board-view * {
  transition: none !important;
  animation: none !important;
}
.bd-tool .icon,
.bd-bar-btn .icon {
  width: 18px;
  height: 18px;
  flex: none;
}
.bd-bar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
