:root {
  --hhe-bg: #0e1114;
  --hhe-panel: #171c20;
  --hhe-panel-2: #20272c;
  --hhe-text: #f4f1e8;
  --hhe-muted: #b8b7ae;
  --hhe-line: #3b454d;
  --hhe-accent: #f0c84b;
  --hhe-accent-2: #8bd3c7;
  --hhe-danger: #f2a97f;
}

.hh-encyclopedia-page,
.hh-encyclopedia-hub {
  margin: 0;
  background: var(--hhe-bg);
  color: var(--hhe-text);
  font-family: "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  line-height: 1.75;
}

.hh-encyclopedia-page a,
.hh-encyclopedia-hub a,
.hh-encyclopedia-entry-point a {
  color: inherit;
}

.hh-encyclopedia-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem max(1rem, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--hhe-line);
  background: rgba(14, 17, 20, 0.96);
}

.hh-encyclopedia-header > a {
  display: grid;
  text-decoration: none;
  line-height: 1.15;
}

.hh-encyclopedia-header > a span {
  color: var(--hhe-accent);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
}

.hh-encyclopedia-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
}

.hh-encyclopedia-header nav a,
.hh-encyclopedia-breadcrumb a {
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}

.hh-encyclopedia-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-width: 1180px;
  margin: 0 auto;
  padding: 1rem;
  color: var(--hhe-muted);
  font-size: 0.86rem;
}

.hh-encyclopedia-main {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1rem 0 5rem;
}

.hh-encyclopedia-main > article {
  width: min(900px, 100%);
  margin: 0 auto;
}

.hh-encyclopedia-hero,
.hh-encyclopedia-hub-hero {
  padding: clamp(2rem, 6vw, 5rem) clamp(1.2rem, 4vw, 3.6rem);
  border: 1px solid var(--hhe-line);
  border-radius: 1rem;
  background: linear-gradient(135deg, #20272c, #111518 68%);
}

.hh-encyclopedia-hero > p:first-child,
.hh-encyclopedia-hub-hero > p:first-child {
  margin: 0 0 0.7rem;
  color: var(--hhe-accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.15em;
}

.hh-encyclopedia-hero h1,
.hh-encyclopedia-hub-hero h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 4.4rem);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.hh-encyclopedia-hero h1 + p,
.hh-encyclopedia-hub-hero h1 + p {
  max-width: 56rem;
  margin: 1.2rem 0 0;
  color: var(--hhe-muted);
}

.hh-encyclopedia-section,
.hh-encyclopedia-review,
.hh-encyclopedia-related,
.hh-encyclopedia-controls,
.hh-encyclopedia-group {
  margin-top: 1.3rem;
  padding: clamp(1.2rem, 3vw, 2rem);
  border: 1px solid var(--hhe-line);
  border-radius: 0.8rem;
  background: var(--hhe-panel);
}

.hh-encyclopedia-section h2,
.hh-encyclopedia-review h2,
.hh-encyclopedia-related h2,
.hh-encyclopedia-controls h2,
.hh-encyclopedia-group h2 {
  margin-top: 0;
  line-height: 1.35;
}

.hh-encyclopedia-review {
  border-color: var(--hhe-danger);
  background: #2b201c;
}

.hh-encyclopedia-meta {
  width: 100%;
  margin-top: 1.5rem;
  border-collapse: collapse;
}

.hh-encyclopedia-meta caption {
  margin-bottom: 0.7rem;
  text-align: left;
  color: var(--hhe-muted);
}

.hh-encyclopedia-meta th,
.hh-encyclopedia-meta td {
  padding: 0.8rem;
  border-top: 1px solid var(--hhe-line);
  vertical-align: top;
  text-align: left;
  overflow-wrap: anywhere;
}

.hh-encyclopedia-meta th {
  width: 12rem;
  color: var(--hhe-accent-2);
}

.hh-encyclopedia-sources {
  padding-left: 1.3rem;
  overflow-wrap: anywhere;
}

.hh-encyclopedia-sources li {
  margin-block: 0.65rem;
}

.hh-encyclopedia-sources small {
  display: block;
  color: var(--hhe-muted);
}

.hh-reference-facets {
  margin-top: 1.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--hhe-line);
}

.hh-reference-facets h3 {
  margin-bottom: 0.4rem;
}

.hh-reference-facets ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.hh-reference-facets li {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--hhe-line);
  border-radius: 999px;
  background: var(--hhe-panel-2);
  font-size: 0.84rem;
}

.hh-reference-facets li strong,
.hh-nen-type-links strong {
  color: var(--hhe-accent-2);
}

.hh-nen-type-links a {
  text-underline-offset: 0.22em;
}

.hh-encyclopedia-related > div {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.8rem;
}

.hh-encyclopedia-related > div a,
.hh-encyclopedia-back {
  display: grid;
  padding: 1rem;
  border: 1px solid var(--hhe-line);
  border-radius: 0.6rem;
  background: var(--hhe-panel-2);
  text-decoration: none;
}

.hh-encyclopedia-related small {
  color: var(--hhe-accent-2);
}

.hh-encyclopedia-back {
  margin-top: 0.8rem;
  text-align: center;
}

.hh-encyclopedia-controls > div {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
}

.hh-encyclopedia-controls label:first-child {
  grid-column: span 2;
}

.hh-encyclopedia-controls label {
  display: grid;
  gap: 0.35rem;
  color: var(--hhe-muted);
  font-size: 0.86rem;
}

.hh-encyclopedia-controls input,
.hh-encyclopedia-controls select {
  min-height: 3rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--hhe-line);
  border-radius: 0.5rem;
  background: #0e1114;
  color: var(--hhe-text);
  font: inherit;
}

.hh-encyclopedia-groups {
  display: grid;
  gap: 1rem;
}

.hh-encyclopedia-group header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 0 1rem;
}

.hh-encyclopedia-group header p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--hhe-accent-2);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
}

.hh-encyclopedia-group header h2,
.hh-encyclopedia-group header span {
  margin-bottom: 0;
}

.hh-encyclopedia-group ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.55rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.hh-encyclopedia-group li a {
  display: grid;
  gap: 0.3rem;
  min-height: 100%;
  padding: 0.9rem;
  border: 1px solid var(--hhe-line);
  border-radius: 0.55rem;
  background: var(--hhe-panel-2);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.hh-encyclopedia-group li a:hover,
.hh-encyclopedia-group li a:focus-visible,
.hh-encyclopedia-related a:hover,
.hh-encyclopedia-related a:focus-visible {
  border-color: var(--hhe-accent);
}

.hh-encyclopedia-group li span {
  color: var(--hhe-muted);
  font-size: 0.8rem;
}

.hh-review-badge {
  color: var(--hhe-danger);
}

.hh-encyclopedia-footer {
  padding: 2rem max(1rem, calc((100vw - 1180px) / 2));
  border-top: 1px solid var(--hhe-line);
  color: var(--hhe-muted);
}

.hh-encyclopedia-entry-point {
  margin: 2rem 0;
  padding: clamp(1.2rem, 3vw, 2rem);
  border: 1px solid currentColor;
  border-radius: 0.8rem;
}

.hh-encyclopedia-entry-point h2 {
  margin-top: 0;
}

[hidden] {
  display: none !important;
}

@media (max-width: 680px) {
  .hh-encyclopedia-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .hh-encyclopedia-controls > div {
    grid-template-columns: 1fr;
  }

  .hh-encyclopedia-controls label:first-child {
    grid-column: auto;
  }

  .hh-encyclopedia-meta th,
  .hh-encyclopedia-meta td {
    display: block;
    width: auto;
  }

  .hh-encyclopedia-meta td {
    padding-top: 0;
    border-top: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
