/* Underline highlights on essay bodies. */
mark.ul-mark {
  background: linear-gradient(to bottom,
              transparent 0,
              transparent 60%,
              rgba(201, 169, 110, 0.32) 60%,
              rgba(201, 169, 110, 0.32) 100%);
  padding: 1px 2px;
  color: inherit;
  cursor: pointer;
  border-radius: 1px;
  transition: background-color .15s ease, box-shadow .15s ease;
  position: relative;
}
mark.ul-mark:hover {
  background: rgba(201, 169, 110, 0.45);
  box-shadow: inset 0 -2px 0 0 rgba(141, 110, 65, .55);
}
mark.ul-mark.is-active {
  background: rgba(201, 169, 110, 0.55);
  box-shadow: inset 0 -2px 0 0 rgba(141, 110, 65, .8);
}

/* Floating popover triggered by clicking a highlight. */
.ul-pop {
  position: absolute;
  z-index: 1000;
  background: #5a4a30;
  color: #faf7f0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 13px;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(40, 30, 15, .25);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .14s ease, transform .14s ease;
}
.ul-pop.is-shown {
  opacity: 1;
  transform: translateY(0);
}
.ul-pop::before {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #5a4a30;
  border-bottom: 0;
}
.ul-pop .ul-pop-count {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
  letter-spacing: .02em;
  color: #ead9b8;
}

/* Floating "Underline" button shown above a text selection. */
.ul-btn {
  position: absolute;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #5a4a30;
  color: #faf7f0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  font-weight: 500;
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(40, 30, 15, .25);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .14s ease, transform .14s ease, background .14s ease;
}
.ul-btn.is-shown { opacity: 1; transform: translateY(0); }
.ul-btn:hover    { background: #3e3320; }
.ul-btn[disabled]{ opacity: .6; cursor: progress; }
.ul-btn::before {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #5a4a30;
  border-bottom: 0;
}
.ul-btn:hover::before { border-top-color: #3e3320; }
.ul-btn .icon { opacity: .9; flex-shrink: 0; }

/* Toast after underline submit. */
.ul-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translate(-50%, 14px);
  z-index: 2000;
  background: #2a2a2a;
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
}
.ul-toast.is-shown { opacity: 1; transform: translate(-50%, 0); }
.ul-toast.is-err   { background: #7d2626; }
