/* Highlights with notes and Define outside the e-book reader (static/marks.js). Same three colours as the reader
   (reader-notes.css): warm yellow, paprika orange, blue; never green or teal. Painted with ::highlight(), so
   only colours and lines are possible: a highlight with a note gets a paprika underline instead of the
   reader's dot. */
:root {
  --mk-yellow: light-dark(#ffe28a, #6b5418);
  --mk-orange: light-dark(#fcc6ab, #7a3a20);
  --mk-blue: light-dark(#c6dbf6, #28466e);
}
::highlight(mk-yellow) { background-color: var(--mk-yellow); color: inherit; }
::highlight(mk-orange) { background-color: var(--mk-orange); color: inherit; }
::highlight(mk-blue) { background-color: var(--mk-blue); color: inherit; }
::highlight(mk-note) { text-decoration: underline 2px var(--accent); text-underline-offset: 0.2em; }
::highlight(mk-flash) { background-color: color-mix(in srgb, var(--accent) 45%, transparent); color: inherit; }
.mk-yellow { background: var(--mk-yellow); }
.mk-orange { background: var(--mk-orange); }
.mk-blue { background: var(--mk-blue); }

/* --- the bar for selected words: at the bottom, clear of the phone's own menu above the selection --------- */
.mk-toolbar {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nr-h, 0px) + 12px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; white-space: nowrap;
  width: max-content; max-width: calc(100vw - 12px); box-sizing: border-box; padding: 6px 8px; border-radius: 14px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  box-shadow: 0 6px 24px rgba(37, 36, 34, 0.28);
  -webkit-user-select: none; user-select: none;
}
.mk-toolbar[hidden], .mk-hl-tools[hidden], .mk-toolbar [hidden] { display: none; }
.mk-toolbar button { margin: 0; }
.mk-hl-tools { display: flex; align-items: center; gap: 6px; }
.mk-swatches { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.mk-swatch-row { display: flex; gap: 6px; }
.mk-tool-name { font-size: 0.75rem; line-height: 1; color: var(--muted); }
.mk-swatch {
  width: 32px; height: 32px; min-width: 32px; padding: 0; border-radius: 50%;
  border: 2px solid var(--border); cursor: pointer;
}
.mk-swatch:hover, .mk-swatch:focus-visible { border-color: var(--accent); }
.mk-tool {
  min-height: 36px; padding: 0 10px; border-radius: 999px; font-size: 0.92rem;
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
}

/* --- sheets: from the bottom on a phone, in the middle on a wide screen -------------------------------- */
.mk-sheet {
  width: min(560px, 100vw); max-width: 100vw; max-height: 80vh; margin: auto auto 0; padding: 14px 16px 18px;
  border: none; border-radius: 16px 16px 0 0; background: var(--surface); color: var(--text);
  overflow-y: auto; box-shadow: 0 -6px 30px rgba(37, 36, 34, 0.3);
}
.mk-sheet::backdrop { background: rgba(37, 36, 34, 0.45); }
.mk-sheet.mk-top { margin: 8vh auto auto; border-radius: 16px; }  /* the note editor: clear of the keyboard */
@media (min-width: 700px) { .mk-sheet { margin: auto; border-radius: 16px; } }
.mk-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.mk-head h2 { flex: 1; margin: 0; font-size: 1.1rem; overflow-wrap: anywhere; }
.mk-quote {
  margin: 0 0 12px; padding: 8px 12px; border-left: 4px solid var(--accent); background: var(--bg);
  border-radius: 0 8px 8px 0; font-style: italic; white-space: pre-line;
}
.mk-label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
.mk-note-box { margin: 0 0 12px; }
.mk-note-box p { margin: 0; white-space: pre-wrap; }
.mk-colors, .mk-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.mk-colors button { display: inline-flex; align-items: center; gap: 6px; }
.mk-colors button[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.mk-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--border); }
.mk-danger { color: var(--danger); }
.mk-sheet textarea {
  width: 100%; box-sizing: border-box; font: inherit; padding: 8px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
}

/* --- the list ----------------------------------------------------------------------------------------- */
.mk-list { list-style: none; margin: 0; padding: 0; }
.mk-item { display: flex; align-items: stretch; gap: 6px; margin: 0 0 8px; border-radius: 10px; background: var(--bg); }
.mk-item-yellow { box-shadow: inset 4px 0 0 var(--mk-yellow); }
.mk-item-orange { box-shadow: inset 4px 0 0 var(--mk-orange); }
.mk-item-blue { box-shadow: inset 4px 0 0 var(--mk-blue); }
.mk-go {
  flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  padding: 10px 10px 10px 14px; background: none; border: none; color: var(--text); font: inherit; cursor: pointer;
}
.mk-go:disabled { cursor: default; opacity: 0.75; }
.mk-snip { font-style: italic; }
.mk-item-note { padding-left: 8px; border-left: 2px solid var(--accent); white-space: pre-wrap; }
.mk-meta { font-size: 0.8rem; color: var(--muted); }
.mk-del { align-self: center; margin-right: 8px; }
.mk-empty { color: var(--muted); padding: 8px 0; }
.mk-hint { margin: 4px 0 8px; }

.mk-toast {
  position: fixed; z-index: 61; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nr-h, 0px) + 80px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px); padding: 10px 14px;
  border-radius: 10px; background: var(--top-bg); color: var(--top-text); box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
}
.mk-toast[hidden] { display: none; }
.mk-toast button { background: none; border: none; color: var(--top-link); font-weight: 700; padding: 4px; }
