:root {
  --bgg-blue: #0b66d8;
  --bgg-blue-dark: #064c9f;
  --bgg-text: #172033;
  --bgg-muted: #64748b;
  --bgg-border: rgba(11, 102, 216, 0.18);
  --bgg-soft: #f1f7ff;
  --bgg-shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
}

.bgg-term-wrap {
  position: relative;
  display: inline;
  white-space: normal;
  isolation: isolate;
}

.bgg-term-link,
.bgg-term-link:visited {
  color: var(--bgg-blue);
  font-weight: 700;
  text-decoration: none !important;
  cursor: help;
  transition: color .18s ease, background .18s ease, box-shadow .18s ease;
}

.bgg-underline-dotted .bgg-term-link {
  border-bottom: 2px dotted rgba(11, 102, 216, 0.45);
}

.bgg-underline-solid .bgg-term-link {
  border-bottom: 2px solid rgba(11, 102, 216, 0.45);
}

.bgg-underline-highlight .bgg-term-link {
  background: linear-gradient(180deg, transparent 58%, rgba(11, 102, 216, .14) 0);
  border-bottom: 0;
}

.bgg-term-wrap:hover .bgg-term-link,
.bgg-term-wrap.is-active .bgg-term-link,
.bgg-term-link:focus {
  color: var(--bgg-blue-dark);
}

.bgg-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  z-index: 9999;
  width: min(320px, calc(100vw - 40px));
  transform: translateX(-50%) translateY(8px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: #ffffff;
  color: var(--bgg-text);
  border: 1px solid var(--bgg-border);
  border-radius: 18px;
  padding: 16px 17px;
  box-shadow: var(--bgg-shadow);
  line-height: 1.55;
  font-size: 14px;
  text-align: left;
}

.bgg-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  background: #fff;
  border-right: 1px solid var(--bgg-border);
  border-bottom: 1px solid var(--bgg-border);
  rotate: 45deg;
  margin-top: -7px;
}

.bgg-tooltip strong {
  display: block;
  color: var(--bgg-blue-dark);
  font-size: 15px;
  margin-bottom: 7px;
}

.bgg-tooltip-def,
.bgg-tooltip-example,
.bgg-tooltip-more {
  display: block;
}

.bgg-tooltip-example {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(100, 116, 139, .25);
  color: #334155;
  font-size: 13px;
}

.bgg-tooltip-more {
  margin-top: 10px;
  color: var(--bgg-blue) !important;
  font-weight: 800;
  text-decoration: none !important;
}

@media (hover: hover) {
  .bgg-term-wrap:hover .bgg-tooltip,
  .bgg-term-wrap:focus-within .bgg-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
  }
}

.bgg-term-wrap.is-active .bgg-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.bgg-style-minimal .bgg-tooltip {
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .10);
}

.bgg-style-modern .bgg-tooltip,
.bgg-style-academic .bgg-tooltip {
  background: radial-gradient(circle at top right, rgba(11, 102, 216, .08), transparent 40%), #fff;
}

.bgg-style-soft .bgg-tooltip {
  background: #f8fbff;
}

.bgg-glossary-archive,
.bgg-term-page {
  margin: 30px 0;
  color: var(--bgg-text);
}

.bgg-archive-head {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  align-items: flex-start;
  padding: 22px;
  border: 1px solid var(--bgg-border);
  border-radius: 24px;
  background: linear-gradient(135deg, #fff, #f5f9ff);
  box-shadow: 0 12px 35px rgba(15, 23, 42, 0.06);
}

.bgg-archive-head h2 {
  margin: 0 0 8px;
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: -0.03em;
}

.bgg-archive-head p {
  margin: 0;
  color: var(--bgg-muted);
}

.bgg-search {
  min-width: min(280px, 100%);
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--bgg-muted);
  font-weight: 700;
}

.bgg-search input,
.bgg-standalone-search input {
  width: 100%;
  border: 1px solid var(--bgg-border) !important;
  border-radius: 999px !important;
  padding: 11px 15px !important;
  background: #fff !important;
  color: var(--bgg-text) !important;
  outline: none;
}

.bgg-cat-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}

.bgg-cat-filter button {
  border: 1px solid var(--bgg-border);
  background: #fff;
  color: var(--bgg-blue-dark);
  border-radius: 999px;
  padding: 8px 13px;
  font-weight: 800;
  cursor: pointer;
}

.bgg-cat-filter button.is-active {
  background: var(--bgg-blue);
  color: #fff;
}

.bgg-term-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.bgg-cols-1 { grid-template-columns: 1fr; }
.bgg-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bgg-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bgg-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.bgg-term-card {
  display: flex;
  gap: 14px;
  min-height: 170px;
  border: 1px solid rgba(11,102,216,.14);
  border-radius: 22px;
  background: #fff;
  padding: 17px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.bgg-term-card:hover {
  transform: translateY(-3px);
  border-color: rgba(11,102,216,.28);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.10);
}

.bgg-card-icon,
.bgg-term-icon {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  background: var(--bgg-soft);
  color: var(--bgg-blue);
}

.bgg-term-card h3 {
  margin: 0 0 7px;
  font-size: 17px;
  line-height: 1.25;
}

.bgg-term-card h3 a {
  color: var(--bgg-text);
  text-decoration: none;
}

.bgg-card-cat {
  display: inline-flex;
  align-items: center;
  margin-bottom: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(11,102,216,.08);
  color: var(--bgg-blue-dark);
  font-size: 11px;
  font-weight: 800;
}

.bgg-term-card p {
  margin: 0 0 9px;
  color: var(--bgg-muted);
  font-size: 13.5px;
  line-height: 1.55;
}

.bgg-card-example {
  font-style: italic;
}

.bgg-card-more {
  color: var(--bgg-blue) !important;
  font-weight: 800;
  text-decoration: none !important;
  font-size: 13px;
}

.bgg-term-card.is-hidden {
  display: none !important;
}

.bgg-term-page {
  border: 1px solid var(--bgg-border);
  border-radius: 24px;
  padding: 26px;
  background: linear-gradient(135deg, #fff, #f7fbff);
  box-shadow: 0 12px 35px rgba(15, 23, 42, .06);
}

.bgg-term-page-head {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 20px;
}

.bgg-ipa {
  font-weight: 900;
  color: var(--bgg-blue-dark);
}

.bgg-term-cats {
  color: var(--bgg-muted);
  font-size: 13px;
}

.bgg-term-page h2 {
  font-size: 18px;
  margin: 18px 0 8px;
}

.bgg-example-section {
  background: #fff;
  border: 1px dashed rgba(11,102,216,.25);
  border-radius: 18px;
  padding: 14px 16px;
}

.bgg-standalone-search {
  margin: 16px 0;
}

@media (max-width: 760px) {
  .bgg-tooltip {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 20px;
    width: auto;
    max-width: none;
    transform: translateY(16px);
    border-radius: 20px;
  }
  .bgg-term-wrap.is-active .bgg-tooltip {
    transform: translateY(0);
  }
  .bgg-tooltip::after { display: none; }
  .bgg-archive-head { flex-direction: column; }
  .bgg-term-grid,
  .bgg-cols-2,
  .bgg-cols-3,
  .bgg-cols-4 { grid-template-columns: 1fr; }
  .bgg-term-card { min-height: 0; }
}
