.qb-question-workspace {
  display: grid;
  gap: 18px;
  align-items: start;
}

.qb-card.qb-whiteboard-open .qb-question-workspace {
  grid-template-columns: minmax(280px, 1fr) 8px minmax(320px, var(--whiteboard-width, .9fr));
  gap: 10px;
}

.qb-whiteboard-resizer {
  display: none;
  align-self: stretch;
  min-height: 160px;
  border-radius: 999px;
  background: #d9e2ed;
  cursor: col-resize;
  touch-action: none;
  transition: background .15s ease;
}

.qb-card.qb-whiteboard-open .qb-whiteboard-resizer { display: block; }
.qb-whiteboard-resizer:hover { background: var(--flynn-blue, #407dc4); }

.qb-whiteboard-open-button,
.qb-whiteboard-tool {
  font-family: var(--ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
}

.qb-whiteboard-open-button {
  margin: 10px 0 0 8px;
  padding: 7px 16px;
  color: var(--flynn-blue-dark, #2c5f9e);
  background: #fff;
  border: 1px solid var(--flynn-blue, #407dc4);
}

.qb-whiteboard-open-button:hover {
  color: #fff;
  background: var(--flynn-blue-dark, #2c5f9e);
  border-color: var(--flynn-blue-dark, #2c5f9e);
}

.qb-whiteboard-open-button:focus-visible,
.qb-whiteboard-tool:focus-visible,
.qb-whiteboard-colour:focus-visible {
  outline: 2px solid var(--focus, #407dc4);
  outline-offset: 2px;
}

.qb-whiteboard {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #d9e2ed;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 4px 18px rgba(13, 21, 46, .08);
}

.qb-card.qb-whiteboard-expanded .qb-question-workspace { grid-template-columns: 1fr; gap: 18px; }
.qb-card.qb-whiteboard-expanded .qb-whiteboard-resizer { display: none; }

.qb-whiteboard[hidden] { display: none; }

.qb-whiteboard-header {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: #f5f8fc;
  border-bottom: 1px solid #d9e2ed;
  font-family: var(--ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
}

.qb-whiteboard-viewport {
  max-height: 620px;
  overflow: auto;
  overscroll-behavior: auto;
}

.qb-card.qb-whiteboard-expanded .qb-whiteboard-viewport { max-height: min(76vh, 840px); }

.qb-whiteboard-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--ink, #0d152e);
  font-size: 13px;
  font-weight: 700;
}

.qb-whiteboard-title small {
  color: var(--ink-soft, #5a6478);
  font-size: 10.5px;
  font-weight: 500;
}

.qb-whiteboard-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.qb-whiteboard-paper-tools {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-right: 2px;
  padding-right: 8px;
  border-right: 1px solid #d9e2ed;
}

.qb-whiteboard-paper-tools > span {
  color: var(--ink-soft, #5a6478);
  font-size: 10.5px;
  font-weight: 600;
}

.qb-whiteboard-tool {
  min-height: 32px;
  padding: 5px 10px;
  color: var(--ink, #0d152e);
  background: #fff;
  border: 1px solid #ccd7e4;
}

.qb-whiteboard-tool:hover:not(:disabled) { background: #e9f1fa; }
.qb-whiteboard-tool[aria-pressed="true"] {
  color: #fff;
  background: var(--flynn-blue, #407dc4);
  border-color: var(--flynn-blue, #407dc4);
}
.qb-whiteboard-tool:disabled { cursor: default; opacity: .42; }
.qb-whiteboard-tool.qb-whiteboard-close { font-size: 17px; line-height: 1; padding-inline: 9px; }

.qb-whiteboard-colour {
  width: 32px;
  height: 32px;
  padding: 3px;
  border: 1px solid #ccd7e4;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

.qb-whiteboard-colours,
.qb-whiteboard-zoom-tools {
  display: flex;
  align-items: center;
  gap: 4px;
}

.qb-whiteboard-colour span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--swatch);
}

.qb-whiteboard-colour[aria-pressed="true"] {
  border-color: var(--flynn-blue, #407dc4);
  box-shadow: 0 0 0 2px var(--flynn-blue, #407dc4);
}

.qb-whiteboard-zoom-label {
  min-width: 38px;
  color: var(--ink-soft, #5a6478);
  font-size: 11px;
  text-align: center;
}

.qb-whiteboard-surface {
  position: relative;
  height: 1120px;
  background-color: #fff;
  background-image:
    linear-gradient(#edf1f5 1px, transparent 1px),
    linear-gradient(90deg, #edf1f5 1px, transparent 1px);
  background-size: 24px 24px;
}

.qb-whiteboard-surface.qb-paper-blank { background-image: none; }

.qb-whiteboard-image-layer,
.qb-whiteboard-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.qb-whiteboard-image-layer { pointer-events: none; }
.qb-whiteboard-canvas {
  cursor: crosshair;
  touch-action: none;
}
.qb-whiteboard-canvas.qb-whiteboard-panning { cursor: grab; }
.qb-whiteboard-canvas.qb-whiteboard-panning:active { cursor: grabbing; }
.qb-whiteboard-canvas.qb-whiteboard-moving-image { cursor: move; }

.qb-diagram.qb-whiteboard-source svg {
  border-radius: 7px;
  transition: outline-color .15s ease, box-shadow .15s ease;
}
.qb-card.qb-whiteboard-open .qb-diagram.qb-whiteboard-source { cursor: copy; }
.qb-card.qb-whiteboard-open .qb-diagram.qb-whiteboard-source:hover svg,
.qb-card.qb-whiteboard-open .qb-diagram.qb-whiteboard-source svg:focus-visible {
  outline: 2px solid var(--flynn-blue, #407dc4);
  outline-offset: 4px;
  box-shadow: 0 5px 18px rgba(13, 21, 46, .1);
}
.qb-diagram-copy-hint {
  display: none;
  width: fit-content;
  margin: 7px auto 0;
  color: var(--flynn-blue-dark, #2c5f9e);
  font-family: var(--ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  font-size: 11px;
  font-weight: 600;
}
.qb-card.qb-whiteboard-open .qb-diagram-copy-hint { display: block; }

@media (max-width: 820px) {
  .qb-card.qb-whiteboard-open .qb-question-workspace { grid-template-columns: 1fr; }
  .qb-card.qb-whiteboard-open .qb-whiteboard-resizer { display: none; }
  .qb-whiteboard-open-button { margin-left: 0; }
  .qb-whiteboard-header { align-items: flex-start; flex-direction: column; }
  .qb-whiteboard-tools { justify-content: flex-start; }
  .qb-whiteboard-paper-tools { flex-basis: 100%; border-right: 0; padding-right: 0; }
  .qb-whiteboard-viewport { max-height: min(72vh, 680px); }
}

@media (prefers-reduced-motion: reduce) {
  .qb-whiteboard-open-button, .qb-whiteboard-tool { scroll-behavior: auto; }
}
