/* Qareken SAT — Bluebook runner tools.
   Highlights & Notes, Calculator (Desmos), Reference Sheet, Line Reader, and the Help /
   Shortcuts / Assistive Technology dialogs. Research: bluebook-ui.md §7–§9 (2025–26 look).
   Layers: line reader 62, panels 70–72, highlight toolbar 85, note card 86, tooltip 88
   (above the panes, below the core's modals/screens at 100+). Dialogs use ui.modal (z 1000). */

/* ================================================================================================
   Shared floating panel (Calculator, Reference Sheet) — §8.1 / §8.2
   ================================================================================================ */
.bb-panel {
  position: absolute;
  z-index: 70;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #fff;
  border: 2px solid var(--bb-ink, #1E1E1E);
  border-radius: 6px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .28);
  overflow: hidden;
  font-family: var(--bb-sans, Roboto, system-ui, -apple-system, "Segoe UI", Arial, sans-serif);
  color: var(--bb-ink, #1E1E1E);
  outline: none;
  animation: bb-tool-pop .14s ease-out;
}
.bb-panel[hidden] { display: none !important; }
.bb-panel.is-front { z-index: 72; }
.bb-panel:focus { outline: none; }
.bb-panel.is-dragging, .bb-panel.is-resizing { box-shadow: 0 14px 40px rgba(0, 0, 0, .34); }
.bb-panel.is-dragging *, .bb-panel.is-resizing * { user-select: none; -webkit-user-select: none; }

.bb-panel-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 4px 0 12px;
  background: var(--bb-ink, #1E1E1E);
  color: #fff;
  cursor: move;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
/* The title is the only header item that gives up space (with an ellipsis), so Expand and ✕ are
   never pushed out of the panel (overflow: hidden) at narrow widths or with large touch targets. */
.bb-panel-title {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font: 700 15px/1 var(--bb-sans, Roboto, system-ui, sans-serif);
  color: #fff;
  white-space: nowrap;
}
.bb-panel-grip-wrap { flex: 1 1 auto; min-width: 24px; display: flex; justify-content: center; }
.bb-panel-grip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #fff;
  cursor: move;
  touch-action: none;
}
.bb-panel-actions { flex: none; display: flex; align-items: center; gap: 2px; }
.bb-panel-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  min-width: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #fff;
  font: 500 13px/1 var(--bb-sans, Roboto, system-ui, sans-serif);
  white-space: nowrap;
  cursor: pointer;
}
.bb-panel-btn-icon, .bb-panel-close-x { display: inline-flex; }
.bb-panel-close { padding: 0 6px; }
.bb-panel-close-text { display: none; }
.bb-panel-btn:hover, .bb-panel-grip:hover { background: rgba(255, 255, 255, .14); }
.bb-panel-head :focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.bb-panel.is-compact .bb-panel-btn-label { display: none; }
.bb-panel.is-compact .bb-panel-expand { padding: 0 6px; }
/* Narrow panel: the grip area only takes the space that is left, so it gives way before the title. */
.bb-panel.is-compact .bb-panel-grip-wrap { flex: 1 1 0; min-width: 0; overflow: hidden; }
.bb-panel.is-compact .bb-seg-btn { padding: 0 7px; }

.bb-panel-body { position: relative; flex: 1 1 auto; min-height: 0; background: #fff; }

.bb-panel-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 3;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  background: repeating-linear-gradient(135deg, transparent 0 4px, rgba(30, 30, 30, .7) 4px 5.5px);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  cursor: nwse-resize;
  touch-action: none;
}
.bb-panel-resize:focus-visible { outline: none; background: repeating-linear-gradient(135deg, transparent 0 4px, var(--bb-blue, #324DC7) 4px 6px); }
.bb-panel-edge { display: none; }
.bb-panel.is-expanded .bb-panel-resize { display: none; }
.bb-panel.is-expanded .bb-panel-edge {
  display: block;
  position: absolute;
  top: 44px;
  bottom: 0;
  right: 0;
  z-index: 3;
  width: 12px;
  cursor: ew-resize;
  touch-action: none;
}
.bb-panel.is-expanded .bb-panel-edge::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 3px;
  width: 4px;
  height: 44px;
  margin-top: -22px;
  border-radius: 2px;
  background: #9A9A9A;
}
.bb-panel.is-expanded { border-radius: 0 6px 6px 0; }
.bb-panel-ref.is-expanded { border-radius: 6px; }

/* Phone sheet: below the runner header so the timer stays visible; not draggable. */
.bb-panel.is-sheet {
  border-width: 2px 0 0;
  border-radius: 0;
  box-shadow: 0 -4px 18px rgba(0, 0, 0, .22);
  animation: bb-tool-sheet-up .2s ease-out;
}
.bb-panel.is-sheet .bb-panel-head { height: 52px; padding: 0 4px 0 14px; gap: 8px; cursor: default; touch-action: auto; }
.bb-panel.is-sheet .bb-panel-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.bb-panel.is-sheet .bb-panel-grip-wrap,
.bb-panel.is-sheet .bb-panel-expand,
.bb-panel.is-sheet .bb-panel-resize,
.bb-panel.is-sheet .bb-panel-edge { display: none; }
.bb-panel.is-sheet .bb-panel-close { height: 44px; padding: 0 14px; font-size: 15px; font-weight: 700; }
.bb-panel.is-sheet .bb-panel-close-x { display: none; }
.bb-panel.is-sheet .bb-panel-close-text { display: inline; }
.bb-panel.is-sheet .bb-panel-body { padding-bottom: env(safe-area-inset-bottom, 0px); }

/* ================================================================================================
   Calculator — §8.1
   ================================================================================================ */
.bb-seg {
  flex: none;
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 999px;
}
.bb-seg-btn {
  height: 26px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font: 500 12px/1 var(--bb-sans, Roboto, system-ui, sans-serif);
  white-space: nowrap;
  cursor: pointer;
}
.bb-seg-btn:hover { background: rgba(255, 255, 255, .14); }
.bb-seg-btn[aria-checked="true"] { background: #fff; color: var(--bb-ink, #1E1E1E); font-weight: 700; }
.bb-panel.is-sheet .bb-seg-btn { height: 38px; padding: 0 14px; font-size: 14px; }

.bb-calc-body { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: #fff; }
/* An absolute child fills the padding box, so the sheet body's safe-area padding does not apply to
   it: keep the Desmos keypad out of the iPhone home-indicator area explicitly. */
.bb-panel.is-sheet .bb-calc-body { bottom: env(safe-area-inset-bottom, 0px); }

/* Expanded calculator (desktop; calculator.js never sets the flag for phone sheets): the panel docks
   as a full-height left column of width --bb-calc-w, so the question area (.bb-main, a stretched item
   in the column flex .bb-test) moves to its right. The split / single-column / review layouts inside
   .bb-main are absolutely positioned and reflow into the remaining width. The calculator measures
   the host, not .bb-main, so this cannot feed back into the panel size. */
.bb-root.bb-calc-expanded .bb-main {
  margin-left: max(0px, calc(var(--bb-calc-w, 0px) - var(--bb-safe-l, 0px)));
}
.bb-calc-host { position: absolute; top: 0; right: 0; bottom: 0; left: 0; }
.bb-calc-host[hidden] { display: none !important; }
.bb-calc-host.is-covered { visibility: hidden; }
.bb-calc-status {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  overflow: auto;
  background: #fff;
  text-align: center;
}
.bb-calc-status[hidden] { display: none !important; }
.bb-calc-status-icon { color: var(--bb-red, #C13145); }
.bb-calc-status-title { margin: 0; font: 700 17px/1.3 var(--bb-sans, Roboto, system-ui, sans-serif); }
.bb-calc-status-text { margin: 0; max-width: 320px; font: 400 14px/1.5 var(--bb-sans, Roboto, system-ui, sans-serif); color: #3A3A3A; }
.bb-calc-status-actions { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 6px; }
.bb-calc-retry {
  min-height: 40px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--bb-blue, #324DC7);
  color: #fff;
  font: 700 15px/1 var(--bb-sans, Roboto, system-ui, sans-serif);
  cursor: pointer;
}
.bb-calc-retry:hover { background: #2A41AD; }
.bb-calc-retry:focus-visible { outline: 2px solid var(--bb-ink, #1E1E1E); outline-offset: 2px; }
.bb-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #D9DEE8;
  border-top-color: var(--bb-blue, #324DC7);
  border-radius: 50%;
  animation: bb-tool-spin .8s linear infinite;
}

/* ================================================================================================
   Reference Sheet — §8.2
   ================================================================================================ */
.bb-ref-body {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 16px 18px 22px;
  color: var(--bb-ink, #1E1E1E);
  outline: none;
}
.bb-ref-body:focus-visible { box-shadow: inset 0 0 0 2px var(--bb-blue, #324DC7); }
.bb-ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 16px 12px;
  align-items: start;
}
.bb-ref-fig { margin: 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.bb-ref-fig.is-wide { grid-column: span 2; }
.bb-ref-svg { display: block; width: 100%; max-width: 140px; height: auto; overflow: visible; }
.bb-ref-fig.is-wide .bb-ref-svg { max-width: 280px; }
.bb-ref-svg .ln { fill: none; stroke: var(--bb-ink, #1E1E1E); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.bb-ref-svg .ln.thin { stroke-width: 1; }
.bb-ref-svg .ln.dash { stroke-dasharray: 4 3; }
.bb-ref-svg .pt { fill: var(--bb-ink, #1E1E1E); }
.bb-ref-svg text { fill: var(--bb-ink, #1E1E1E); font-family: var(--bb-serif, "Noto Serif", Georgia, serif); font-size: 13px; font-style: italic; }
.bb-ref-svg text .up, .bb-ref-svg text.ang { font-style: normal; }
.bb-ref-svg text.ang { font-size: 10px; }
.bb-ref-cap { display: flex; flex-direction: column; align-items: center; gap: 2px; font-family: var(--bb-serif, "Noto Serif", Georgia, serif); font-size: 15px; line-height: 1.45; }
.bb-ref-cap-title { font-family: var(--bb-sans, Roboto, system-ui, sans-serif); font-weight: 700; font-size: 14px; }
.bb-ref-formula { white-space: nowrap; }
.bb-ref-math .katex { font-size: 1.05em; }
.bb-ref-math.is-fallback { font-family: var(--bb-serif, "Noto Serif", Georgia, serif); }
.bb-ref-facts {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid #D0D0D0;
  font-family: var(--bb-serif, "Noto Serif", Georgia, serif);
  font-size: 15px;
  line-height: 1.5;
}
.bb-ref-facts p { margin: 0 0 6px; }
.bb-ref-facts p:last-child { margin-bottom: 0; }
.bb-panel.is-sheet .bb-ref-body { padding: 14px 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
.bb-panel.is-sheet .bb-ref-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }

/* ================================================================================================
   Line Reader — §9.3
   ================================================================================================ */
.bb-lr { position: absolute; left: 0; right: 0; top: 0; height: 0; z-index: 62; pointer-events: none; }
.bb-lr[hidden] { display: none !important; }
.bb-lr-mask { position: absolute; left: 0; right: 0; background: rgba(0, 0, 0, .8); pointer-events: none; }
.bb-lr-mask-top { top: 0; }
.bb-lr-mask-bottom { bottom: 0; }
.bb-lr-frame { position: absolute; left: 0; right: 0; top: 0; pointer-events: none; }
.bb-lr-window { background: rgba(0, 0, 0, .09); pointer-events: none; }
.bb-lr-bar {
  position: relative;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bb-ink, #1E1E1E);
  color: #fff;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.bb-lr-bar-top { cursor: grab; }
.bb-lr.is-dragging .bb-lr-bar-top { cursor: grabbing; }
.bb-lr-bar-bottom { cursor: ns-resize; }
.bb-lr-grip, .bb-lr-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 30px;
  border-radius: 6px;
  outline: none;
}
.bb-lr-grip svg { transform: rotate(90deg); }
.bb-lr-grip:focus-visible, .bb-lr-handle:focus-visible { box-shadow: 0 0 0 2px #fff; }
.bb-lr-close {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.bb-lr-close:hover { background: rgba(255, 255, 255, .14); }
.bb-lr-close:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }

/* ================================================================================================
   Highlights & Notes — §7.1
   ================================================================================================ */
.bb-root mark.bb-hl {
  padding: 0;
  margin: 0;
  border-radius: 1px;
  background-color: transparent;
  color: inherit;
  cursor: pointer;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.bb-root mark.bb-hl.bb-hl-yellow, .bb-root .bb-hl-atom.bb-hl-yellow { background-color: #FEDB00; }
.bb-root mark.bb-hl.bb-hl-blue, .bb-root .bb-hl-atom.bb-hl-blue { background-color: #BFE3FB; }
.bb-root mark.bb-hl.bb-hl-pink, .bb-root .bb-hl-atom.bb-hl-pink { background-color: #FCC9DD; }
.bb-root mark.bb-hl.bb-ul-solid,
.bb-root mark.bb-hl.bb-ul-dashed,
.bb-root mark.bb-hl.bb-ul-dotted {
  text-decoration-line: underline;
  text-decoration-color: var(--bb-ink, #1E1E1E);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  text-decoration-skip-ink: none;
}
.bb-root mark.bb-hl.bb-ul-solid { text-decoration-style: solid; }
.bb-root mark.bb-hl.bb-ul-dashed { text-decoration-style: dashed; }
.bb-root mark.bb-hl.bb-ul-dotted { text-decoration-style: dotted; }
.bb-root .bb-hl-atom { border-radius: 2px; cursor: pointer; }
.bb-root .bb-hl-atom.bb-ul-solid { border-bottom: 2px solid var(--bb-ink, #1E1E1E); }
.bb-root .bb-hl-atom.bb-ul-dashed { border-bottom: 2px dashed var(--bb-ink, #1E1E1E); }
.bb-root .bb-hl-atom.bb-ul-dotted { border-bottom: 2px dotted var(--bb-ink, #1E1E1E); }
.bb-root mark.bb-hl.is-active, .bb-root .bb-hl-atom.is-active { outline: 2px solid var(--bb-ink, #1E1E1E); outline-offset: 1px; }
.bb-root mark.bb-hl:focus { outline: none; }
.bb-root mark.bb-hl:focus-visible { outline: 2px solid var(--bb-blue, #324DC7); outline-offset: 2px; }

/* Note marker after a highlight that has a note. Empty element: it never changes text offsets. */
.bb-root .bb-note-pin {
  position: relative;
  display: inline-block;
  width: 15px;
  height: 15px;
  margin: 0 2px 0 3px;
  vertical-align: -2px;
  border-radius: 3px;
  background: var(--bb-ink, #1E1E1E) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 5h8M4 8h8M4 11h5' fill='none' stroke='%23fff' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") center / 11px 11px no-repeat;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.bb-root .bb-note-pin::after { content: ""; position: absolute; top: -12px; right: -12px; bottom: -12px; left: -12px; }
.bb-root .bb-note-pin:focus { outline: none; }
.bb-root .bb-note-pin:focus-visible { outline: 2px solid var(--bb-blue, #324DC7); outline-offset: 2px; }

/* Floating toolbar */
.bb-ann-toolbar {
  position: absolute;
  z-index: 85;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-family: var(--bb-sans, Roboto, system-ui, sans-serif);
  color: var(--bb-ink, #1E1E1E);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  animation: bb-tool-pop .12s ease-out;
}
.bb-ann-toolbar[hidden], .bb-note[hidden], .bb-ann-tip[hidden], .bb-ann-ulmenu[hidden], .bb-ann-preview[hidden] { display: none !important; }
.bb-ann-toolbar.is-offscreen { visibility: hidden; pointer-events: none; }
.bb-ann-pill {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 6px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .22), 0 0 0 1px rgba(0, 0, 0, .10);
}
.bb-ann-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--bb-ink, #1E1E1E);
  cursor: pointer;
}
.bb-ann-btn:hover:not(:disabled) { background: #EEF1F7; }
.bb-ann-btn:disabled { color: #ABABAB; cursor: default; }
.bb-ann-btn:focus { outline: none; }
.bb-ann-btn:focus-visible { box-shadow: 0 0 0 2px var(--bb-blue, #324DC7); }
.bb-ann-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .3);
}
.bb-sw-yellow .bb-ann-dot { background: #FEDB00; }
.bb-sw-blue .bb-ann-dot { background: #BFE3FB; }
.bb-sw-pink .bb-ann-dot { background: #FCC9DD; }
.bb-ann-check { opacity: 0; color: var(--bb-ink, #1E1E1E); }
.bb-ann-swatch.is-selected .bb-ann-dot { box-shadow: inset 0 0 0 2px var(--bb-ink, #1E1E1E); }
.bb-ann-swatch.is-selected .bb-ann-check { opacity: 1; }
.bb-ann-gap { width: 2px; }
.bb-ann-ulbtn { width: 46px; gap: 1px; }
.bb-ann-ulbtn.is-on { background: #E6EDF8; }
.bb-ann-u {
  font: 700 17px/1 var(--bb-serif, "Noto Serif", Georgia, serif);
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  text-decoration-skip-ink: none;
}
.bb-ann-u.bb-ul-solid { text-decoration-style: solid; }
.bb-ann-u.bb-ul-dashed { text-decoration-style: dashed; }
.bb-ann-u.bb-ul-dotted { text-decoration-style: dotted; }
.bb-ann-chev { flex: none; }
.bb-ann-divider { width: 1px; height: 24px; margin: 0 4px; background: #C9C9C9; }
.bb-ann-notebtn.has-note { color: var(--bb-blue, #324DC7); }
.bb-ann-notebtn.has-note::after {
  content: "";
  position: absolute;
  top: 7px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bb-blue, #324DC7);
  box-shadow: 0 0 0 2px #fff;
}

.bb-ann-ulmenu {
  position: absolute;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-width: 196px;
  padding: 6px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .22), 0 0 0 1px rgba(0, 0, 0, .08);
}
.bb-ann-ulopt {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--bb-ink, #1E1E1E);
  font: 400 14px/1.2 var(--bb-sans, Roboto, system-ui, sans-serif);
  text-align: left;
  cursor: pointer;
}
.bb-ann-ulopt:hover { background: #F2F4F8; }
.bb-ann-ulopt[aria-checked="true"] { background: #E6EDF8; font-weight: 700; }
.bb-ann-ulopt:focus { outline: none; }
.bb-ann-ulopt:focus-visible { box-shadow: inset 0 0 0 2px var(--bb-blue, #324DC7); }
.bb-ann-ulsample {
  flex: none;
  width: 34px;
  font: 400 16px/1 var(--bb-serif, "Noto Serif", Georgia, serif);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  text-decoration-skip-ink: none;
}
.bb-ann-ulsample.bb-ul-solid { text-decoration-line: underline; text-decoration-style: solid; }
.bb-ann-ulsample.bb-ul-dashed { text-decoration-line: underline; text-decoration-style: dashed; }
.bb-ann-ulsample.bb-ul-dotted { text-decoration-line: underline; text-decoration-style: dotted; }

.bb-ann-preview {
  display: block;
  max-width: min(300px, calc(100vw - 32px));
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .2), 0 0 0 1px rgba(0, 0, 0, .1);
  color: var(--bb-ink, #1E1E1E);
  font: 400 14px/1.4 var(--bb-sans, Roboto, system-ui, sans-serif);
  text-align: left;
  cursor: pointer;
}
.bb-ann-preview:focus { outline: none; }
.bb-ann-preview:focus-visible { box-shadow: 0 0 0 2px var(--bb-blue, #324DC7); }
.bb-ann-preview-label {
  display: block;
  margin-bottom: 2px;
  color: #505050;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.bb-ann-preview-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* "Select some text to highlight it." */
.bb-ann-tip {
  position: absolute;
  z-index: 88;
  left: 0;
  top: 0;
  max-width: min(260px, calc(100vw - 16px));
  padding: 9px 14px;
  border-radius: 6px;
  background: #505050;
  color: #fff;
  font: 500 14px/1.35 var(--bb-sans, Roboto, system-ui, sans-serif);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
  pointer-events: none;
  animation: bb-tool-fade .15s ease-out;
}
.bb-ann-tip.has-arrow::before {
  content: "";
  position: absolute;
  top: -7px;
  left: var(--bb-arrow-x, 50%);
  margin-left: -7px;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 7px solid #505050;
}

/* Note card: floating near the highlight (desktop) or bottom sheet (phones). */
.bb-note {
  position: absolute;
  z-index: 86;
  left: 0;
  top: 0;
  width: 340px;
  max-width: calc(100% - 8px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 2px solid var(--bb-ink, #1E1E1E);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .28);
  color: var(--bb-ink, #1E1E1E);
  font-family: var(--bb-sans, Roboto, system-ui, sans-serif);
  animation: bb-tool-pop .12s ease-out;
}
.bb-note-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 7px 8px 7px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, .18);
  background: #FEDB00;
}
.bb-note-head.bb-c-blue { background: #BFE3FB; }
.bb-note-head.bb-c-pink { background: #FCC9DD; }
.bb-note-quote {
  flex: 1 1 auto;
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font: 700 14px/1.35 var(--bb-serif, "Noto Serif", Georgia, serif);
  overflow-wrap: anywhere;
}
.bb-note-trash {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--bb-ink, #1E1E1E);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .14);
  cursor: pointer;
}
.bb-note-trash:hover { background: #F4F4F4; }
.bb-note-body { flex: 1 1 auto; min-height: 0; display: flex; }
.bb-note-input {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  min-height: 112px;
  max-height: 40vh;
  margin: 0;
  padding: 12px 14px;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: var(--bb-ink, #1E1E1E);
  font: 400 16px/1.45 var(--bb-sans, Roboto, system-ui, sans-serif);
  resize: vertical;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.bb-note-input:focus { box-shadow: inset 0 0 0 2px var(--bb-blue, #324DC7); }
.bb-note-input::placeholder { color: #767676; }
.bb-note-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 12px 12px;
  border-top: 1px solid #E3E3E3;
}
.bb-note-cancel, .bb-note-save {
  min-height: 36px;
  padding: 0 18px;
  border-radius: 999px;
  font: 700 14px/1 var(--bb-sans, Roboto, system-ui, sans-serif);
  cursor: pointer;
}
.bb-note-cancel { border: 0; background: transparent; color: var(--bb-blue, #324DC7); }
.bb-note-cancel:hover { background: #EEF1FB; }
.bb-note-save { border: 0; background: var(--bb-blue, #324DC7); color: #fff; }
.bb-note-save:hover { background: #2A41AD; }
.bb-note-trash:focus-visible, .bb-note-cancel:focus-visible, .bb-note-save:focus-visible {
  outline: 2px solid var(--bb-blue, #324DC7);
  outline-offset: 2px;
}
.bb-note.is-sheet {
  left: 0 !important;
  right: 0;
  top: auto !important;
  bottom: var(--bb-kb, 0px);
  width: auto !important;
  max-width: none;
  max-height: calc(100% - 16px);
  border-width: 2px 0 0;
  border-radius: 14px 14px 0 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -8px 28px rgba(0, 0, 0, .25);
  animation: bb-tool-sheet-up .18s ease-out;
}
.bb-note.is-sheet.has-kb { padding-bottom: 0; }
.bb-note.is-sheet .bb-note-input { min-height: 96px; max-height: 32vh; resize: none; }
.bb-note.is-sheet .bb-note-trash { width: 40px; height: 40px; }
.bb-note.is-sheet .bb-note-cancel, .bb-note.is-sheet .bb-note-save { min-height: 44px; padding: 0 22px; font-size: 15px; }

/* ================================================================================================
   Dialogs: Help, Shortcuts, Assistive Technology (built on ui.modal) — §9.4
   ================================================================================================ */
.modal-overlay.bb-modal-overlay { background: rgba(30, 30, 30, .62); }
.modal.bb-modal {
  border-radius: 8px;
  color: #1E1E1E;
  font-family: Roboto, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  box-shadow: 0 12px 44px rgba(0, 0, 0, .35);
}
.bb-modal .modal-header { padding: 18px 20px 14px 24px; border-bottom: 1px solid #D9D9D9; }
.bb-modal .modal-title { font-size: 22px; font-weight: 500; line-height: 1.25; color: #1E1E1E; }
.bb-modal .modal-close {
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #1E1E1E;
}
.bb-modal .modal-close:hover { background: #F0F0F0; color: #1E1E1E; }
.bb-modal .modal-body { padding: 18px 24px 24px; font-size: 16px; line-height: 1.55; }
.bb-modal .modal-footer { padding: 14px 24px; border-top: 1px solid #D9D9D9; }
.bb-modal .modal-footer .btn {
  min-height: 40px;
  padding: 0 26px;
  border: 1px solid #1E1E1E;
  border-radius: 999px;
  background: #FEDB00;
  color: #1E1E1E;
  font-size: 15px;
  font-weight: 700;
}
.bb-modal .modal-footer .btn:hover:not(:disabled) { background: #F2D000; }
.bb-modal :focus { outline: none; }
.bb-modal :focus-visible { outline: 2px solid #324DC7; outline-offset: 2px; }
.bb-modal p { margin: 0 0 12px; }
.bb-modal strong { font-weight: 700; }
.bb-dlg-list { margin: 0 0 4px; padding-left: 1.25em; }
.bb-dlg-list li { margin: 0 0 8px; }
.bb-dlg-list li::marker { color: #505050; }

/* Help */
.bb-help-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid #E3E3E3; }
.bb-help-section h3 { margin: 0 0 10px; font-size: 18px; font-weight: 700; color: #1E1E1E; }
.bb-help-tools { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.bb-help-tool { display: flex; gap: 14px; align-items: flex-start; }
.bb-help-tool-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #E6EDF8;
  color: #1E1E1E;
}
.bb-help-tool-text { min-width: 0; }
.bb-help-tool-text h4 { margin: 0 0 2px; font-size: 16px; font-weight: 700; }
.bb-help-tool-text p { margin: 0; }
.bb-dlg-texticon { display: block; }

/* Shortcuts */
.bb-sc-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
.bb-sc-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.bb-sc-table th, .bb-sc-table td { padding: 10px 12px; border-bottom: 1px solid #E3E3E3; text-align: left; vertical-align: top; }
.bb-sc-table thead th { background: #fff; border-bottom: 2px solid #1E1E1E; font-size: 14px; font-weight: 700; white-space: nowrap; }
.bb-sc-table thead th.is-mine { color: #324DC7; }
.bb-sc-mine {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #E6EDF8;
  color: #1A2264;
  font-size: 11px;
  font-weight: 700;
  vertical-align: 1px;
}
.bb-sc-action { font-weight: 500; }
.bb-sc-table td.is-mine { background: #F7F9FD; }
.bb-kbd-line { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.bb-kbd-combo { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.bb-kbd {
  display: inline-block;
  min-width: 26px;
  padding: 2px 7px;
  border: 1px solid #9A9A9A;
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #fff;
  color: #1E1E1E;
  font: 500 13px/1.4 Roboto, system-ui, sans-serif;
  text-align: center;
}
.bb-kbd-plus { color: #6E6E6E; font-size: 12px; }
.bb-kbd-sep { color: #505050; font-size: 13px; }
.bb-kbd-note { display: block; margin-top: 4px; color: #505050; font-size: 13px; }

/* Assistive technology accordion */
.bb-acc-controls { display: flex; justify-content: flex-end; gap: 16px; margin: 0 0 8px; }
.bb-acc-all {
  min-height: 36px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: #324DC7;
  font: 700 14px/1 Roboto, system-ui, sans-serif;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.bb-acc-list { border-top: 1px solid #D9D9D9; }
.bb-acc-item { border-bottom: 1px solid #D9D9D9; }
.bb-acc-h { margin: 0; font-size: inherit; }
.bb-acc-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 10px 4px;
  border: 0;
  background: transparent;
  color: #1E1E1E;
  font: 700 16px/1.3 Roboto, system-ui, sans-serif;
  text-align: left;
  cursor: pointer;
}
.bb-acc-btn:hover .bb-acc-title { text-decoration: underline; text-underline-offset: 3px; }
.bb-acc-chev { flex: none; transition: transform .15s ease; }
.bb-acc-btn[aria-expanded="true"] .bb-acc-chev { transform: rotate(180deg); }
.bb-acc-panel { padding: 0 4px 14px; }
.bb-acc-panel[hidden] { display: none !important; }

/* ================================================================================================
   Responsive
   ================================================================================================ */
@media (pointer: coarse) {
  .bb-panel-btn { height: 40px; min-width: 40px; }
  .bb-panel-grip { width: 44px; height: 40px; }
  .bb-panel-resize { width: 32px; height: 32px; }
  .bb-ann-btn { width: 44px; height: 44px; }
  .bb-ann-ulbtn { width: 52px; }
  .bb-ann-pill { gap: 0; padding: 2px 4px; }
  .bb-ann-divider { margin: 0 2px; }
  .bb-ann-ulopt { min-height: 44px; }
  .bb-lr-bar { height: 40px; }
  .bb-lr-close { width: 40px; height: 40px; right: 2px; }
  .bb-acc-all { min-height: 44px; }
}

@media (max-width: 1023.98px) {
  .bb-panel-title { font-size: 14px; }
}

@media (max-width: 759.98px) {
  .bb-ann-pill { padding: 2px 3px; }
  .bb-ann-gap { display: none; }
  .modal.bb-modal { max-height: calc(100dvh - 12px); border-radius: 14px 14px 0 0; }
  .bb-modal .modal-header { padding: 14px 12px 12px 18px; }
  .bb-modal .modal-title { font-size: 20px; }
  .bb-modal .modal-body { padding: 14px 18px 20px; font-size: 15px; }
  .bb-modal .modal-footer { padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px)); }
  .bb-modal .modal-footer .btn { min-height: 44px; }
  .bb-help-tool { gap: 12px; }
  .bb-help-tool-icon { width: 36px; height: 36px; }

  /* Shortcut table → stacked cards */
  .bb-sc-wrap { overflow: visible; margin: 0; padding: 0; }
  .bb-sc-table, .bb-sc-table tbody, .bb-sc-table tr, .bb-sc-table th, .bb-sc-table td { display: block; width: 100%; }
  .bb-sc-table thead { display: none; }
  .bb-sc-table tr { padding: 10px 0; border-bottom: 1px solid #E3E3E3; }
  .bb-sc-table th, .bb-sc-table td { padding: 2px 0; border: 0; }
  .bb-sc-table td.is-mine { background: transparent; }
  .bb-sc-action { margin-bottom: 4px; font-weight: 700; }
  .bb-sc-table td::before {
    content: attr(data-label);
    display: block;
    margin: 4px 0 3px;
    color: #505050;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
  }
  .bb-sc-table td.is-mine::before { color: #324DC7; }
}

/* ================================================================================================
   Motion
   ================================================================================================ */
@keyframes bb-tool-pop { from { opacity: 0; transform: translateY(4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes bb-tool-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes bb-tool-sheet-up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes bb-tool-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .bb-panel, .bb-panel.is-sheet, .bb-ann-toolbar, .bb-note, .bb-note.is-sheet, .bb-ann-tip { animation: none; }
  .bb-acc-chev { transition: none; }
  .bb-spinner { animation-duration: 2.4s; }
}
