/* =====================================================================
   study.css — marca-texto, favoritos, popover de seleção e glossário
   ===================================================================== */

/* ---------- Destaques (marca-texto) ---------- */
mark.ub-hl { color: inherit; border-radius: 3px; padding: 0 .04em; cursor: pointer; }
mark.ub-hl[data-color="yellow"] { background: rgba(255, 213, 0, .45); }
mark.ub-hl[data-color="green"]  { background: rgba(64, 192, 87, .40); }
mark.ub-hl[data-color="blue"]   { background: rgba(77, 171, 247, .42); }
mark.ub-hl[data-color="pink"]   { background: rgba(240, 98, 146, .40); }
[data-theme="dark"] mark.ub-hl { color: #fff; }

/* ---------- Popover de seleção ---------- */
.sel-popover {
  position: absolute; z-index: 90;
  display: flex; align-items: center; gap: .35rem;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  padding: .4rem .5rem; box-shadow: 0 8px 28px rgba(0,0,0,.25);
}
.sel-popover[hidden] { display: none; }
.hl-dots { display: flex; gap: .3rem; }
.hl-dot {
  width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
  border: 2px solid rgba(0,0,0,.12); padding: 0;
}
.hl-dot:hover { transform: scale(1.12); }
.hl-dot[data-color="yellow"] { background: #ffd500; }
.hl-dot[data-color="green"]  { background: #40c057; }
.hl-dot[data-color="blue"]   { background: #4dabf7; }
.hl-dot[data-color="pink"]   { background: #f06292; }
.hl-act {
  border: 0; background: transparent; cursor: pointer;
  font-size: 1.05rem; line-height: 1; color: var(--muted);
  width: 30px; height: 30px; border-radius: 8px;
}
.hl-act:hover { background: var(--accent-soft); color: var(--accent); }
.hl-act.star:hover { color: var(--gold); }

/* Botão Fechar — oculto no desktop, aparece na barra mobile */
.hl-close { display: none !important; }

/* ---- Barra inferior no mobile (substitui o popover flutuante) ---- */
.sel-popover--mobile {
  position: fixed !important;
  bottom: 0; left: 0; right: 0;
  top: auto !important;
  width: 100%;
  justify-content: center;
  gap: 1rem;
  padding: .9rem 1.25rem;
  padding-bottom: calc(.9rem + env(safe-area-inset-bottom, 0px));
  border-radius: 20px 20px 0 0;
  border: none;
  border-top: 2px solid var(--border);
  box-shadow: 0 -8px 40px rgba(0,0,0,.22);
  z-index: 9500;
  animation: popSlideUp .22s ease;
}
@keyframes popSlideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.sel-popover--mobile .hl-dots   { gap: .75rem; }
.sel-popover--mobile .hl-dot    { width: 38px; height: 38px; }
.sel-popover--mobile .hl-act    { width: 46px; height: 46px; font-size: 1.25rem; border-radius: 12px; }
.sel-popover--mobile .hl-close  { display: inline-flex !important; color: var(--muted); }

/* ---------- Termo de glossário ---------- */
.glossary-term {
  border-bottom: 1px dotted var(--accent);
  color: var(--accent); cursor: help;
  text-decoration: none;
}
.glossary-term:hover { background: var(--accent-soft); border-radius: 3px; }

/* ---------- Balão do glossário ---------- */
.glossary-tip {
  position: absolute; z-index: 95;
  width: min(320px, 86vw);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  padding: .8rem 1rem; box-shadow: 0 10px 34px rgba(0,0,0,.28);
}
.glossary-tip[hidden] { display: none; }
.glossary-tip::after {
  content: ""; position: absolute; left: 50%; transform: translateX(-50%);
  border: 8px solid transparent; bottom: -16px; border-top-color: var(--surface);
}
.glossary-tip.below::after { bottom: auto; top: -16px; border-top-color: transparent; border-bottom-color: var(--surface); }
.gt-term { display: block; color: var(--accent); font-size: 1rem; margin-bottom: .25rem; }
.gt-def { margin: 0; font-size: .9rem; line-height: 1.55; color: var(--text); }

/* ---------- Painel de favoritos ---------- */
.fav-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(90vw, 360px); z-index: 64;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: -4px 0 24px rgba(0,0,0,.18);
  transform: translateX(100%); transition: transform .28s ease;
  display: flex; flex-direction: column;
}
.fav-panel.open { transform: translateX(0); }
.fav-panel[hidden] { display: none; }
.fav-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1rem; background: var(--accent); color: #fff;
}
.fav-head .icon-btn { color: #fff; font-size: 1.4rem; }
.fav-list { overflow-y: auto; padding: .5rem; flex: 1; }
.fav-empty { color: var(--muted); text-align: center; padding: 2rem 1rem; font-size: .92rem; }

.fav-item {
  display: flex; align-items: flex-start; gap: .5rem;
  padding: .65rem; border-radius: 10px; border: 1px solid var(--border);
  margin-bottom: .5rem;
}
.fav-item:hover { border-color: var(--accent); }
.fav-item a { flex: 1; color: var(--text); display: block; }
.fav-item a:hover { text-decoration: none; }
.fav-ref {
  display: inline-block; font-size: .7rem; font-weight: 700; color: #fff;
  background: var(--accent); padding: .1rem .45rem; border-radius: 5px;
  margin-bottom: .3rem; font-variant-numeric: tabular-nums;
}
.fav-text {
  display: block; font-family: var(--reading-font);
  font-size: .9rem; line-height: 1.5; color: var(--text);
}
.fav-del {
  border: 0; background: transparent; color: var(--muted);
  font-size: 1.2rem; cursor: pointer; line-height: 1; padding: 0 .25rem;
}
.fav-del:hover { color: #c0392b; }
