.mk-page-glossary {
  --glossary-bg: color-mix(in oklab, var(--surface, #0f1324) 95%, transparent);
  background: var(--glossary-bg);
}

.glossary-main {
  position: relative;
  padding-bottom: 80px;
}

.glossary-hero {
  padding: 120px 0 60px;
  text-align: center;
}

.glossary-hero .container {
  max-width: 960px;
  margin: 0 auto;
  display: grid;
  gap: 22px;
}

.glossary-hero h1 {
  margin: 0;
  font-size: clamp(2.4rem, 4vw, 3.4rem);
  letter-spacing: 0.04em;
}

.glossary-hero p {
  margin: 0;
  color: var(--muted, rgba(255, 255, 255, .7));
  font-size: clamp(1rem, 1.4vw, 1.2rem);
}

.glossary-filter {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.glossary-filter .glossary-language-select {
  min-width: min(100%, 320px);
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(14, 16, 29, .82);
  color: var(--text, #fff);
  font: inherit;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.glossary-filter .glossary-language-select:focus {
  border-color: rgba(122, 60, 255, .7);
  box-shadow: 0 0 0 3px rgba(122, 60, 255, .25);
  outline: none;
}

.glossary-filter label {
  font-weight: 600;
  color: rgba(255, 255, 255, .75);
}

.glossary-filter input[type="search"] {
  min-width: min(100%, 420px);
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(14, 16, 29, .82);
  color: var(--text, #fff);
  font: inherit;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.glossary-filter input[type="search"]:focus {
  border-color: rgba(122, 60, 255, .7);
  box-shadow: 0 0 0 3px rgba(122, 60, 255, .25);
  outline: none;
}

.glossary-table-wrapper {
  padding: 40px 0 120px;
}

.glossary-table-wrapper .container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
}

.glossary-table-scroll {
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 24px;
  background: rgba(15, 19, 36, .92);
  padding: 12px;
  overflow: auto;
  max-height: 75vh;
}

.glossary-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 960px;
}

.glossary-table caption {
  text-align: left;
  font-weight: 600;
  margin-bottom: 16px;
  color: rgba(255, 255, 255, .72);
}

.glossary-table th,
.glossary-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  text-align: left;
  vertical-align: top;
}

.glossary-table thead th {
  position: sticky;
  top: 0;
  background: rgba(15, 19, 36, .96);
  z-index: 2;
  backdrop-filter: blur(6px);
  font-size: .88rem;
  text-transform: uppercase;
  letter-spacing: .1em;
}

.glossary-table tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, .02);
}

.glossary-table tbody tr:hover {
  background: rgba(122, 60, 255, .12);
}

.glossary-table[data-gate="locked"] {
  filter: blur(4px);
  pointer-events: none;
  user-select: none;
}

.glossary-cell-empty {
  opacity: .35;
}

.glossary-col-hidden {
  display: none !important;
}

.glossary-cell-action {
  white-space: nowrap;
}

.glossary-suggest {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(122, 60, 255, .18);
  color: var(--accent, #c7a2ff);
  text-decoration: none;
  font-size: .84rem;
  border: 1px solid rgba(122, 60, 255, .35);
  transition: background .2s ease, border-color .2s ease;
}

.glossary-suggest:hover,
.glossary-suggest:focus {
  background: rgba(122, 60, 255, .3);
  border-color: rgba(122, 60, 255, .6);
}

@media (max-width: 960px) {
  .glossary-table-scroll {
    max-height: none;
  }
}

@media (max-width: 600px) {
  .glossary-filter {
    justify-items: stretch;
  }

  .glossary-filter input[type="search"] {
    min-width: 0;
  }

  .glossary-table {
    min-width: 720px;
  }
}

body.glossary-gate-active {
  overflow: hidden;
}

.glossary-gate {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 24, .72);
  backdrop-filter: blur(12px);
  z-index: 2100;
  display: grid;
  place-items: center;
  padding: 24px;
}

.glossary-gate-card {
  max-width: 420px;
  width: min(100%, 420px);
  background: rgba(15, 19, 36, .95);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 24px;
  padding: 32px 28px;
  display: grid;
  gap: 18px;
  text-align: left;
  box-shadow: 0 48px 120px -60px rgba(0, 0, 0, .8);
}

.glossary-gate-card h2 {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: .02em;
}

.glossary-gate-card p {
  margin: 0;
  color: rgba(255, 255, 255, .7);
  font-size: .95rem;
}

.glossary-gate-label {
  display: grid;
  gap: 8px;
}

.glossary-gate-select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(14, 16, 29, .85);
  color: var(--text, #fff);
  font: inherit;
}

.glossary-gate-select:focus {
  border-color: rgba(122, 60, 255, .7);
  box-shadow: 0 0 0 3px rgba(122, 60, 255, .25);
  outline: none;
}

.glossary-gate-actions {
  display: grid;
  gap: 12px;
}

.glossary-gate-actions button {
  padding: 12px 18px;
  border-radius: 14px;
  border: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}

.glossary-gate-actions button.glossary-gate-confirm {
  background: linear-gradient(135deg, rgba(122, 60, 255, .9), rgba(78, 43, 184, .9));
  color: #fff;
  box-shadow: 0 14px 40px -16px rgba(122, 60, 255, .9);
}

.glossary-gate-actions button.glossary-gate-confirm:hover,
.glossary-gate-actions button.glossary-gate-confirm:focus {
  transform: translateY(-1px);
  box-shadow: 0 18px 48px -14px rgba(122, 60, 255, 1);
}

.glossary-gate-actions button.glossary-gate-all {
  background: rgba(15, 19, 36, .92);
  color: rgba(255, 255, 255, .85);
  border: 1px solid rgba(255, 255, 255, .14);
}

.glossary-gate-actions button.glossary-gate-all:hover,
.glossary-gate-actions button.glossary-gate-all:focus {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, .25);
}

.glossary-gate-error {
  color: #ff8a9d;
  font-size: .85rem;
  min-height: 1.2em;
}

@media (prefers-color-scheme: light) {
  .glossary-filter .glossary-language-select {
    background: rgba(255, 255, 255, .92);
    color: #15192b;
  }

  .glossary-gate-select {
    background: #ffffff;
    color: #15192b;
    border-color: rgba(21, 25, 43, .12);
  }

  .glossary-gate-actions button.glossary-gate-all {
    background: rgba(255, 255, 255, .9);
    color: #15192b;
    border-color: rgba(21, 25, 43, .18);
  }
}
