/* ------------------------------------------------------------------ *
 * marks.css — highlighting and notes in the e-book
 * Kept apart from the print sheet: the book still prints as a book.
 * ------------------------------------------------------------------ */

:root{
  --hl-y:#FFE9A3; --hl-g:#C7EEC9; --hl-b:#C5E4F5; --hl-p:#EFD4F0;
  --hl-y-ink:#7A5A00; --hl-g-ink:#1F6B2A; --hl-b-ink:#15536E; --hl-p-ink:#6B2A72;
}
:root[data-mode="dark"]{
  --hl-y:#5E4E12; --hl-g:#1F4A28; --hl-b:#13425A; --hl-p:#46254B;
  --hl-y-ink:#FFE9A3; --hl-g-ink:#C7EEC9; --hl-b-ink:#C5E4F5; --hl-p-ink:#EFD4F0;
}

mark.hl{background:var(--hl-y);color:inherit;padding:.05em 0;border-radius:2px;
  cursor:pointer;-webkit-tap-highlight-color:transparent}
mark.hl-g{background:var(--hl-g)} mark.hl-b{background:var(--hl-b)}
mark.hl-p{background:var(--hl-p)}
mark.hl.has-note{box-shadow:inset 0 -2px 0 0 currentColor}
mark.hl.flash{animation:hlflash .9s ease}
@keyframes hlflash{0%,100%{filter:none}40%{filter:brightness(.86)}}

/* the little bar that appears over a selection */
.hl-bar{position:absolute;z-index:70;display:none;gap:4px;padding:6px;
  background:var(--surface,#fff);border:1px solid var(--line,#D8E0E6);
  border-radius:12px;box-shadow:0 8px 24px rgba(13,36,51,.16)}
.hl-bar.on{display:flex}
.hl-bar button{width:30px;height:30px;border:0;border-radius:50%;cursor:pointer;
  display:flex;align-items:center;justify-content:center;padding:0;
  background:transparent;color:var(--ink-2,#5A7180)}
.hl-bar .sw{border:1px solid rgba(0,0,0,.12)}
.hl-bar .sw.y{background:var(--hl-y)} .hl-bar .sw.g{background:var(--hl-g)}
.hl-bar .sw.b{background:var(--hl-b)} .hl-bar .sw.p{background:var(--hl-p)}
.hl-bar .sw.on{outline:2px solid var(--accent,#0E5C73);outline-offset:1px}
.hl-bar svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:2;
  stroke-linecap:round;stroke-linejoin:round}
.hl-bar .act:hover{color:var(--accent,#0E5C73)}
.hl-bar .sep{width:1px;background:var(--line,#D8E0E6);margin:3px 2px}

/* the note editor */
.hl-note{position:absolute;z-index:71;display:none;width:min(320px,86vw);
  background:var(--surface,#fff);border:1px solid var(--line,#D8E0E6);
  border-radius:14px;box-shadow:0 10px 30px rgba(13,36,51,.18);padding:12px}
.hl-note.on{display:block}
.hl-note textarea{width:100%;min-height:92px;resize:vertical;border-radius:9px;
  border:1px solid var(--line,#D8E0E6);background:var(--bg,#F3F6F8);
  color:var(--ink,#10212C);padding:9px 10px;font:inherit;font-size:.92rem;line-height:1.55}
.hl-note textarea:focus{outline:2px solid var(--accent,#0E5C73);outline-offset:-1px}
.hl-note .row{display:flex;gap:8px;margin-top:9px}
.hl-note .row button{flex:1;border-radius:9px;padding:8px 10px;font:inherit;
  font-size:.88rem;font-weight:600;cursor:pointer;border:1px solid var(--line,#D8E0E6);
  background:var(--bg,#F3F6F8);color:var(--ink,#10212C)}
.hl-note .row .save{background:var(--accent,#0E5C73);border-color:var(--accent,#0E5C73);color:#fff}

/* the button and panel that list a chapter's marks */
.hl-fab{position:fixed;right:16px;bottom:16px;z-index:60;display:none;
  align-items:center;gap:7px;padding:10px 15px;border:1px solid var(--line,#D8E0E6);
  border-radius:999px;background:var(--surface,#fff);color:var(--ink,#10212C);
  box-shadow:0 6px 20px rgba(13,36,51,.15);font:inherit;font-size:.86rem;
  font-weight:700;cursor:pointer}
.hl-fab.on{display:flex}
.hl-fab svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;
  stroke-linecap:round;stroke-linejoin:round}

.hl-panel{position:fixed;inset:auto 0 0 0;z-index:80;max-height:78vh;
  background:var(--surface,#fff);border-top:1px solid var(--line,#D8E0E6);
  border-radius:18px 18px 0 0;box-shadow:0 -10px 34px rgba(13,36,51,.2);
  transform:translateY(102%);transition:transform .22s ease;display:flex;
  flex-direction:column}
.hl-panel.on{transform:translateY(0)}
.hl-panel header{display:flex;align-items:center;gap:10px;padding:14px 16px 10px;
  border-bottom:1px solid var(--line,#D8E0E6)}
.hl-panel header b{font-size:1rem;flex:1}
.hl-panel header .hl-all{font-size:.84rem;font-weight:600;color:var(--accent,#0E5C73);text-decoration:none;flex:none}
.hl-panel header button{border:0;background:transparent;cursor:pointer;
  color:var(--ink-2,#5A7180);font:inherit;font-size:.86rem;font-weight:600}
.hl-list{overflow:auto;padding:4px 16px 22px;-webkit-overflow-scrolling:touch}
.hl-item{display:block;width:100%;text-align:start;border:0;background:transparent;
  border-bottom:1px solid var(--line,#D8E0E6);padding:12px 0;cursor:pointer;font:inherit}
.hl-item:last-child{border-bottom:0}
.hl-item q{display:block;font-size:.92rem;line-height:1.5;quotes:none;
  border-inline-start:3px solid var(--hl-y);padding-inline-start:9px;color:var(--ink,#10212C)}
.hl-item.g q{border-color:var(--hl-g)} .hl-item.b q{border-color:var(--hl-b)}
.hl-item.p q{border-color:var(--hl-p)}
.hl-item .n{display:block;font-size:.88rem;color:var(--ink-2,#5A7180);
  margin-top:6px;padding-inline-start:12px;white-space:pre-wrap}
.hl-item .lost{display:inline-block;margin-top:6px;font-size:.76rem;font-weight:700;
  color:#8A5A00;background:#FFF0CC;border-radius:999px;padding:2px 9px}
.hl-empty{padding:26px 0 30px;text-align:center;color:var(--ink-2,#5A7180);font-size:.9rem}
.hl-scrim{position:fixed;inset:0;z-index:79;background:rgba(10,24,33,.34);
  opacity:0;pointer-events:none;transition:opacity .2s}
.hl-scrim.on{opacity:1;pointer-events:auto}

@media print{
  mark.hl{background:transparent !important;box-shadow:none !important}
  .hl-bar,.hl-note,.hl-fab,.hl-panel,.hl-scrim{display:none !important}
}
