:root {
  --obsidian: #05070c;
  --obsidian-soft: #090e16;
  --navy: #0b1728;
  --navy-2: #101f34;
  --navy-3: #142945;
  --gold: #d9b76a;
  --gold-bright: #f2d992;
  --gold-muted: #9e8244;
  --blue: #48c7ff;
  --ink: #f7f1df;
  --muted: #b5bdc9;
  --line: rgba(217, 183, 106, 0.28);
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.38);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(72, 199, 255, 0.13), transparent 30rem),
    radial-gradient(circle at 15% 20%, rgba(217, 183, 106, 0.11), transparent 22rem),
    linear-gradient(135deg, #020307 0%, var(--obsidian) 48%, #07101b 100%);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background-image:
    linear-gradient(rgba(217, 183, 106, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(217, 183, 106, 0.03) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at 50% 20%, black, transparent 72%);
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.intro {
  display: grid;
  grid-template-columns: 164px minmax(0, 1fr);
  gap: 28px;
  align-items: center;
  min-height: 290px;
  padding: 28px 0 24px;
}

.sigil {
  position: relative;
  width: 150px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow:
    inset 0 0 36px rgba(72, 199, 255, 0.1),
    0 0 36px rgba(72, 199, 255, 0.12);
}

.sigil::before,
.sigil::after,
.sigil span {
  position: absolute;
  inset: 22px;
  content: "";
  border: 1px solid rgba(217, 183, 106, 0.62);
}

.sigil::before {
  transform: rotate(45deg);
}

.sigil::after {
  border-radius: 50%;
}

.sigil span:nth-child(1) {
  inset: 42px;
  border-color: rgba(72, 199, 255, 0.46);
  transform: rotate(30deg);
}

.sigil span:nth-child(2) {
  inset: 55px;
  border-radius: 50%;
  border-color: rgba(242, 217, 146, 0.72);
}

.sigil span:nth-child(3) {
  inset: 70px;
  border: 0;
  border-radius: 50%;
  background: var(--gold-bright);
  box-shadow: 0 0 24px rgba(72, 199, 255, 0.42);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold-bright);
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: Cinzel, Georgia, serif;
  line-height: 1.08;
  letter-spacing: 0;
}

h1 {
  max-width: 820px;
  font-size: clamp(2.55rem, 7vw, 5.8rem);
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.subtitle {
  max-width: 710px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
}

.search-panel,
.glossary-stage {
  border: 1px solid rgba(217, 183, 106, 0.2);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(16, 31, 52, 0.92), rgba(6, 12, 22, 0.94)),
    var(--navy);
  box-shadow: var(--shadow);
}

.search-panel {
  position: sticky;
  top: 14px;
  z-index: 5;
  padding: 22px;
  backdrop-filter: blur(18px);
}

.search-label {
  display: block;
  margin: 0 0 8px;
  color: var(--gold-bright);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.search-row {
  position: relative;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 15px;
  width: 22px;
  height: 22px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--gold-bright);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  opacity: 0.88;
  pointer-events: none;
}

#glossary-search {
  width: 100%;
  min-height: 56px;
  padding: 0 18px 0 48px;
  border: 1px solid rgba(217, 183, 106, 0.32);
  border-radius: var(--radius);
  outline: 0;
  background: rgba(3, 8, 15, 0.76);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(72, 199, 255, 0.06);
}

#glossary-search:focus {
  border-color: var(--gold-bright);
  box-shadow:
    inset 0 0 0 1px rgba(242, 217, 146, 0.14),
    0 0 24px rgba(72, 199, 255, 0.16);
}

#glossary-search::placeholder {
  color: #7f8a99;
}

.filter-header {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 12px;
}

#result-count {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
}

.reset-button,
.alphabet-filter button {
  min-height: 38px;
  border: 1px solid rgba(217, 183, 106, 0.28);
  border-radius: 999px;
  background: rgba(5, 12, 22, 0.72);
  color: var(--ink);
  cursor: pointer;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.reset-button {
  padding: 0 16px;
  color: var(--gold-bright);
  font-weight: 700;
}

.alphabet-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.alphabet-filter button {
  min-width: 40px;
  padding: 0 13px;
  font-size: 0.9rem;
  font-weight: 700;
}

.reset-button:hover,
.alphabet-filter button:hover {
  border-color: var(--gold-bright);
  color: var(--gold-bright);
  transform: translateY(-1px);
}

.alphabet-filter button.is-active {
  border-color: rgba(242, 217, 146, 0.85);
  background: linear-gradient(135deg, rgba(217, 183, 106, 0.26), rgba(72, 199, 255, 0.13));
  color: var(--gold-bright);
  box-shadow: 0 0 18px rgba(72, 199, 255, 0.14);
}

.glossary-stage {
  margin-top: 26px;
  padding: 28px;
}

.section-heading {
  display: flex;
  gap: 22px;
  align-items: end;
  justify-content: space-between;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(217, 183, 106, 0.18);
}

.glossary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.term-card {
  position: relative;
  min-height: 245px;
  padding: 20px;
  overflow: hidden;
  border: 1px solid rgba(217, 183, 106, 0.18);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(20, 41, 69, 0.72), rgba(5, 10, 19, 0.82)),
    var(--navy-2);
}

.term-card::before {
  position: absolute;
  top: 0;
  left: 18px;
  right: 18px;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.term-card::after {
  position: absolute;
  right: -40px;
  bottom: -56px;
  width: 120px;
  aspect-ratio: 1;
  content: "";
  border: 1px solid rgba(72, 199, 255, 0.18);
  border-radius: 50%;
}

.term-category {
  display: inline-flex;
  max-width: 100%;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(72, 199, 255, 0.26);
  border-radius: 999px;
  color: #bcecff;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.term-card h3 {
  margin-top: 15px;
  color: var(--gold-bright);
  font-size: 1.34rem;
}

.term-card p {
  margin: 12px 0 0;
  color: #d3d9e2;
  font-size: 0.97rem;
}

.empty-state {
  margin: 24px 0 0;
  padding: 28px;
  border: 1px solid rgba(217, 183, 106, 0.22);
  border-radius: var(--radius);
  background: rgba(4, 9, 17, 0.65);
  color: var(--gold-bright);
  text-align: center;
}

@media (max-width: 920px) {
  .intro {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 18px;
  }

  .sigil {
    width: 112px;
  }

  .glossary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 24px, 1180px);
    padding-top: 18px;
  }

  .intro {
    gap: 18px;
  }

  .search-panel {
    position: static;
    padding: 16px;
  }

  .filter-header,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .alphabet-filter button {
    min-width: 38px;
  }

  .glossary-stage {
    padding: 18px;
  }

  .glossary-grid {
    grid-template-columns: 1fr;
  }

  .term-card {
    min-height: 0;
  }
}
