* {
  box-sizing: border-box;
}

body {
  background-image: linear-gradient(rgba(62, 64, 68, 0.55), rgba(53, 55, 59, 0.75)), url('img/BGbg.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: #f0ebd8;
  font-family: Arial, Helvetica, sans-serif;
  margin: 0;
  min-height: 100vh;
}

.panel {
  background: rgba(15, 18, 24, 0.8);
  border: 1px solid rgba(215, 169, 79, 0.35);
  border-radius: 18px;
  margin: 40px auto;
  max-width: 980px;
  padding: 28px;
}

.panel h1 {
  margin-top: 0;
}

.home {
  align-items: center;
  background: rgba(20, 25, 30, 0.9);
  border-bottom: 1px solid rgba(215, 169, 79, 0.35);
  display: flex;
  gap: 24px;
  justify-content: center;
  margin: 0 auto 28px;
  padding: 16px 24px;
}

.home a {
  color: #f0ebd8;
  font-weight: 700;
  text-decoration: none;
  transition: color 160ms ease, transform 160ms ease;
}

.home a:hover,
.home a.selected {
  color: #d7a94f;
  transform: translateY(-1px);
}

.controls {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(200px, 1fr));
  margin-bottom: 20px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 700;
}

select,
button {
  border: 1px solid rgba(215, 169, 79, 0.35);
  border-radius: 8px;
  font: inherit;
  padding: 10px 12px;
}

button {
  background: #d7a94f;
  color: #1d1f22;
  cursor: pointer;
  font-weight: 700;
  margin-bottom: 22px;
}

.result,
.family-legend {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 18px 20px;
}

.result {
  margin-bottom: 20px;
}

.character-images {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 16px 0;
}

.character-image-card {
  margin: 0;
  text-align: center;
}

.character-image {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(215, 169, 79, 0.35);
  border-radius: 8px;
  display: block;
  height: 200px;
  object-fit: contain;
  width: 150px;
}

.character-image-card figcaption {
  color: #dfe3d3;
  font-size: 0.9rem;
  margin-top: 8px;
}

.family-legend h2 {
  margin-top: 0;
}

.family-legend table {
  border-collapse: collapse;
  width: 100%;
}

.family-legend th,
.family-legend td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 8px;
  text-align: left;
}

.family-legend tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

@media (max-width: 700px) {
  .topbar {
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    pointer-events: auto;
  }

  .site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding-top: 12px;
    position: relative;
    z-index: 1;
  }

  .site-nav.is-open {
    display: flex;
  }

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

  .home {
    flex-wrap: wrap;
    gap: 12px 18px;
  }
}

.topbar {
  align-items: center;
  background: rgba(20, 25, 30, 0.85);
  display: flex;
  justify-content: space-between;
  padding: 20px 8%;
  position: relative;
}

.title,
.site-nav a {
  color: #f0ebd8;
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 20px;
}

.site-nav a:hover,
.site-nav .selected {
  color: #d7a94f;
}

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid rgba(240, 235, 216, 0.6);
  border-radius: 6px;
  color: #f0ebd8;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  padding: 6px 10px;
}

.overview-page {
  margin: 0 auto;
  max-width: 1200px;
  padding: 48px 24px 80px;
}

.hero {
  background: rgba(15, 18, 24, 0.72);
  border: 1px solid rgba(215, 169, 79, 0.4);
  border-radius: 18px;
  display: grid;
  gap: 24px;
  grid-template-columns: 2fr 1fr;
  margin-bottom: 32px;
  padding: 32px;
}

.hero-copy h1 {
  font-size: clamp(2.2rem, 4vw, 3.6rem);
  line-height: 1.1;
  margin: 0 0 16px;
}

.eyebrow {
  color: #d7a94f;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  margin: 0 0 12px;
  text-transform: uppercase;
}

.hero-copy p,
.info-card p,
.region-text,
.character-role {
  color: #dfe3d3;
  line-height: 1.7;
}

.hero-stats {
  display: grid;
  gap: 18px;
}

.hero-stats div {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 18px 16px;
}

.stat-label {
  color: #c2c5b8;
  display: block;
  font-size: 0.8rem;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.info-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(4, minmax(200px, 1fr));
  margin-bottom: 40px;
}

.info-card,
.region-item,
.character-card,
.overview-section {
  background: rgba(15, 18, 24, 0.72);
  border: 1px solid rgba(215, 169, 79, 0.25);
  border-radius: 16px;
}

.info-card {
  padding: 24px 20px;
}

.info-card h2,
.section-heading h2 {
  margin-top: 0;
}

.overview-section {
  padding: 28px 24px;
}

.section-heading {
  margin-bottom: 20px;
}

.region-list {
  display: grid;
  gap: 18px;
}

.region-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 20px;
}

.region-name {
  color: #f0ebd8;
  font-size: 1.1rem;
  font-weight: 700;
}

.character-list {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.character-card {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 8px;
  padding: 6px 18px;
}

.character-name {
  color: #f0ebd8;
  font-size: 1.12rem;
  font-weight: 700;
}

footer {
  bottom: 0;
  display: flex;
  justify-content: space-between;
  padding: 20px 8%;
  position: fixed;
  width: 84%;
}

@media (max-width: 900px) {
  .hero,
  .info-grid,
  .character-list {
    grid-template-columns: 1fr 1fr;
  }

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

/* @media (max-width: 640px) {
  .topbar,
  nav,
  footer {
    align-items: center;
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .info-grid,
  .character-list {
    grid-template-columns: 1fr;
  }

  .overview-page {
    padding-top: 24px;
  }
} */

@media (max-width: 700px) {
  .topbar {
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding-top: 12px;
  }

  .site-nav.is-open {
    display: flex;
  }

  .story-container {
    grid-template-columns: 1fr;
  }
}
.nav-toggle:hover,
.nav-toggle:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(240, 235, 216, 0.9);
}

.nav-toggle:active,
.nav-toggle.is-active {
  background: rgba(215, 169, 79, 0.18);
  border-color: rgba(215, 169, 79, 0.8);
  box-shadow: 0 0 0 2px rgba(215, 169, 79, 0.25);
  transform: translateY(1px) scale(0.99);
}
