/* Word Help — highlight difficult English words + a bilingual hover flap. */
.gloss-word {
  border-bottom: 1.5px dotted #c98a2e;
  cursor: help;
  background: linear-gradient(transparent 60%, rgba(239, 159, 39, 0.18) 0);
  border-radius: 2px;
}
.gloss-word:hover,
.gloss-word:focus { background: rgba(239, 159, 39, 0.28); outline: none; }

/* the flap (popover) */
.gloss-flap {
  position: absolute;
  z-index: 9000;
  max-width: 300px;
  width: max-content;
  background: #fff;
  color: #15233b;
  border: 1px solid #e6dcc6;
  border-radius: 14px;
  box-shadow: 0 14px 40px rgba(20, 30, 50, 0.22);
  padding: 13px 15px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .14s ease, transform .14s ease;
  pointer-events: none;
}
.gloss-flap.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.gloss-flap .gf-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.gloss-flap .gf-word { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: 16px; color: #2A2460; }
.gloss-flap .gf-pos { font-size: 11px; font-style: italic; color: #8a8aa0; }
.gloss-flap .gf-speak {
  margin-left: auto; border: none; background: #eef0ff; color: #3C3489;
  width: 30px; height: 30px; border-radius: 9px; cursor: pointer; font-size: 15px;
  display: grid; place-items: center; flex-shrink: 0;
}
.gloss-flap .gf-speak:hover { background: #3C3489; color: #fff; }
.gloss-flap .gf-ipa { color: #8a8aa0; font-size: 12px; margin-bottom: 6px; }
.gloss-flap .gf-en { margin: 0 0 7px; }
.gloss-flap .gf-hi {
  margin: 0; padding-top: 7px; border-top: 1px solid #f0ead9;
  font-family: 'NotoSansDevanagari', 'Inter', sans-serif; color: #b45309; font-size: 14.5px;
}
.gloss-flap .gf-hi b { color: #8a6a20; font-weight: 700; font-size: 11px; letter-spacing: .4px; text-transform: uppercase; display: block; margin-bottom: 2px; }

.gloss-flap .gf-foot {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 10px; padding-top: 9px; border-top: 1px solid #f0ead9;
}
.gloss-flap .gf-save {
  border: none; background: #fff1e3; color: #b45309; font-weight: 700;
  font-size: 12px; padding: 6px 11px; border-radius: 9px; cursor: pointer;
}
.gloss-flap .gf-save:hover { background: #FF6B00; color: #fff; }
.gloss-flap .gf-save:disabled { opacity: .6; cursor: default; }
.gloss-flap .gf-saved { font-size: 12px; font-weight: 700; color: #15803d; }
.gloss-flap .gf-login { font-size: 12px; font-weight: 700; color: #3C3489; text-decoration: none; }
.gloss-flap .gf-login:hover { text-decoration: underline; }
.gloss-flap .gf-explored { margin-left: auto; font-size: 11.5px; color: #8a8aa0; }
.gloss-flap .gf-explored b { color: #b45309; }

/* when Word Help is switched off, neutralise the highlights */
.wordhelp-off .gloss-word { border-bottom: 0; background: none; cursor: auto; }

@media (max-width: 520px) { .gloss-flap { max-width: 86vw; } }
@media (prefers-reduced-motion: reduce) { .gloss-flap { transition: none; } }
