.selection-help {
  margin: 12px 0 20px;
  padding: 12px 16px;
  border: 1px solid #c6dac9;
  border-radius: 12px;
  background: #f2f7ef;
  color: #285e48;
  font-size: 14px;
}

.selection-enabled { cursor: text; user-select: text; }
.az-bridge .selection-enabled { margin-left: .3em; }
.selection-enabled::selection,
.selection-enabled *::selection { background: #b7d6bb; color: #173f2d; }

.selection-popover {
  position: fixed;
  z-index: 60;
  width: max-content;
  max-width: min(430px, calc(100vw - 24px));
  max-height: 45dvh;
  overflow: auto;
  padding: 12px 37px 12px 15px;
  border: 1px solid #91b19a;
  border-radius: 12px;
  background: #fffef9;
  box-shadow: 0 12px 35px #153c2a44;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

.selection-popover p { margin: 0; white-space: pre-wrap; }
.selection-popover small { display: block; margin-top: 7px; font-size: 12px; color: #60746a; }
.selection-popover small:empty { display: none; }
.selection-popover mark { background: #e7d88b; color: #243f2e; border-radius: 3px; padding: 1px 2px; font-weight: 700; }
.selection-popover .selection-close {
  position: absolute;
  top: 2px;
  right: 3px;
  min-height: 32px;
  border: 0;
  padding: 1px 9px;
  background: transparent;
  font-size: 23px;
}

/* The chosen word stays distinct from the automatically expanded context. */
::highlight(bt-context) { background-color: #f5e8a4; color: #263b30; }
::highlight(bt-focus) { background-color: #ffbf80; color: #532b0c; }
.alignment-colours::selection, .alignment-colours *::selection { background-color: transparent; color: inherit; }
.selection-popover .selection-focus { background: #ffbf80; color: #532b0c; }
.selection-source { padding-bottom: 9px; margin-bottom: 9px !important; border-bottom: 1px solid #e3e6d9; }
.selection-source:empty, .selection-lexical:empty { display: none; }
.selection-source:not(:empty)::before { content: 'В тексте'; display: block; margin-bottom: 4px; color: #60746a; font-size: 12px; }
.selection-lexical { margin-top: 10px; padding-top: 9px; border-top: 1px solid #e3e6d9; }
.selection-lexical b { font-size: 14px; }
.selection-lexical p { margin-top: 3px; }
.selection-lexical small { margin-top: 3px; }

/* Compact presentation: shared labels, a single dictionary line, optional grammar. */
.selection-popover { max-width: min(390px, calc(100vw - 24px)); padding: 10px 32px 10px 12px; font-size: 14px; line-height: 1.4; }
.selection-source { padding-bottom: 7px; margin-bottom: 7px !important; }
.selection-source:not(:empty)::before, .selection-label { display: block; margin: 0 0 4px; color: #60746a; font-size: 12px; line-height: 1.4; font-weight: 400; }
.selection-lexical { margin-top: 7px; padding-top: 7px; }
.selection-lexical p { margin: 0; }
.selection-lexical small { font-size: 11px; }
