@font-face {
  font-family: "MyCustomFont";
  src: url("../assets/fonts/samarkan.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

/* === Base / Global === */
:root {
  --accent-fade-opacity-rest: 0.62;
  --accent-fade-filter-rest: grayscale(1) contrast(0.82);
  --accent-fade-opacity-active: 1;
  --accent-fade-filter-active: sepia(1) saturate(8) hue-rotate(-18deg) brightness(0.95) contrast(1.08);
  --accent-fade-transition: filter 0.2s ease, opacity 0.2s ease;
  --editorial-mark-brown: #86582b;
  --editorial-mark-brown-rgb: 134, 88, 43;
  --editorial-mark-brown-strong: #a56300;
  --title-content-indent: 1rem;
  --heading-major-line-height: 1.35;
  --heading-major-gap: 1.6rem;
  --ui-motion-standard: 0.32s cubic-bezier(0.22, 0.72, 0.18, 1);
}

body {
  margin: 0;
  padding: 0;
  font-family: sans-serif;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
  background-color: #f5f5f5;
}

mark {
  background-color: yellow;
}

.relation-highlight {
  color: #da7343ba;
  font-weight: 600;
  text-shadow:
    1px 1px 0 #f5cfcf,
    0 0 3px rgba(255, 196, 169, 0.834),
    0 0 5px rgba(15, 96, 194, 0.211);
  font-style: italic;
}

/* === Shared page titles === */
.page-kicker {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 1.1rem;
  font-weight: 700;
  color: #4c4034;
  line-height: var(--heading-major-line-height);
  margin: 0 0 var(--heading-major-gap);
}

.section-title {
  font-size: 1.2rem;
  margin-top: calc(var(--heading-major-gap) * 1.15);
  margin-bottom: calc(var(--heading-major-gap) * 0.55);
  line-height: var(--heading-major-line-height);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-title::after {
  content: "";
  display: block;
  margin-top: 0.5rem;
  width: 40%;
  height: 1px;
  background: linear-gradient(90deg, rgba(90, 74, 56, 0.6), transparent);
}

.section-title.is-small {
  font-size: 1.05rem;
  letter-spacing: 0.1em;
}

.hover-tooltip {
  position: relative;
}

.hover-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  top: calc(100% + 0.55rem);
  z-index: 20;
  width: max-content;
  max-width: min(24rem, calc(100vw - 2rem));
  padding: 0.28rem 0.48rem 0.32rem;
  color: #f8f5f2;
  background: rgba(49, 45, 45, 0.92);
  border-radius: 7px;
  box-shadow: 0 8px 18px rgba(45, 34, 24, 0.16);
  font-family: Georgia, serif;
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.15;
  text-align: left;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -0.18rem);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.hover-tooltip:hover::after,
.hover-tooltip:focus-within::after,
.hover-tooltip:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* === Header / Navigation === */
.site-header {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 1.5rem;
  padding: 0.8rem 1.3rem;
  height: auto;
  background-color: #312d2dc3;
  color: white;
  border-bottom: none;
  position: relative;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.logo-icon {
  height: 40px;
  width: auto;
}

.letter-logo {
  height: 26px;
  width: auto;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: bold;
  font-family: "samarkan", sans-serif;
  letter-spacing: 0.1em;
}

.site-nav {
  position: absolute;
  left: max(50%, 500px);
  transform: translateX(-50%);
  display: flex;
  gap: 1.5rem;
  min-width: 300px;
}

.site-nav a {
  margin-left: 1.5rem;
  color: white;
  text-decoration: none;
  font-family: Georgia, serif;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: color 0.2s ease;
}

.site-nav a:hover {
  text-decoration: underline;
  color: white;
}

.site-nav .nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.site-nav .nav-dropdown-trigger::after {
  content: "";
  display: inline-block;
  width: 0.36rem;
  height: 0.36rem;
  margin-left: 0.42rem;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: translateY(-0.12rem) rotate(45deg);
}

.site-nav .nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 0.62rem);
  left: 50%;
  z-index: 30;
  display: grid;
  min-width: 190px;
  padding: 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  background: rgba(18, 15, 12, 0.92);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -0.35rem);
  transition: opacity 160ms ease, transform 160ms ease;
}

.site-nav .nav-dropdown:hover .nav-dropdown-menu,
.site-nav .nav-dropdown:focus-within .nav-dropdown-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.site-nav .nav-dropdown-menu a {
  margin-left: 0;
  padding: 0.52rem 0.62rem;
  border-radius: 11px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.site-nav .nav-dropdown-menu a:hover {
  background: rgba(255, 255, 255, 0.12);
  text-decoration: none;
}

@media (max-width: 1000px) {
  .site-nav {
    left: 55%;
    gap: 1.1rem;
  }

  .site-nav a {
    font-size: 1rem;
    letter-spacing: 0.12em;
  }
}

@media (max-width: 820px) {
  .site-nav {
    left: 58%;
    gap: 0.9rem;
  }

  .site-nav a {
    font-size: 0.9rem;
    letter-spacing: 0.1em;
  }

  .letter-logo {
    display: none;
  }
}

@media (max-width: 700px) {
  .site-nav {
    left: 60%;
    gap: 0.7rem;
  }

  .site-nav a {
    font-size: 0.8rem;
    letter-spacing: 0.08em;
  }
}

/* === Home Page === */
body.home-floating-nav .site-header {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
}

body.home-floating-nav main {
  margin: 0;
  padding: 0;
}

.home-menu-toggle {
  position: fixed;
  right: 1rem;
  top: 1.9rem;
  z-index: 1500;
  width: 3.6rem;
  height: 3.6rem;
  border: none;
  border-radius: 0;
  background: rgba(56, 56, 56, 0.82);
  color: #f8f5f2;
  font-size: 1.95rem;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
  transition: background-color 0.18s ease, transform 0.18s ease;
}

.home-menu-toggle:hover {
  background: rgba(56, 56, 56, 0.96);
  transform: translateY(-1px);
}

.home-side-nav {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(360px, 82vw);
  background: rgba(24, 24, 24, 0.95);
  color: #f2eee8;
  transform: translateX(102%);
  transition: transform 0.28s cubic-bezier(.2, .7, .12, 1);
  z-index: 1450;
  padding-top: 5.2rem;
  box-shadow: -12px 0 28px rgba(0, 0, 0, 0.38);
}

.home-side-nav.open {
  transform: translateX(0);
}

.home-side-nav a {
  display: block;
  color: #f2eee8;
  text-decoration: none;
  padding: 1rem 1.2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 1.12rem;
  font-weight: 500;
  font-family: Georgia, serif;
}

.home-side-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
}

.home-nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1400;
}

.home-nav-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.hero {
  background-image: url("../assets/Chinese\ logotype\ ver1.svg");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  background-color: #222;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  height: 200px;
  min-height: 400px;
  padding: 4rem 1rem;
  margin-top: 0;
  box-shadow: inset 0 34px 62px -34px rgba(0, 0, 0, 0.44);
}

.hero h1 {
  font-size: 7rem;
  font-weight: 400;
  font-family: Georgia, "Times New Roman", serif;
  display: inline-block;
  margin-bottom: 0.5rem;
  margin: 0.5rem 0 0.3rem;
  color: #ffffff;
  letter-spacing: 0.09em;
  transform: scaleX(1.1) scaleY(0.8);
  transform-origin: center;
  text-shadow:
    0 0 10px rgba(245, 240, 230, 0.2),
    0 6px 22px rgba(10, 12, 18, 0.46),
    0 16px 44px rgba(8, 10, 14, 0.4),
    0 0 34px rgba(178, 194, 220, 0.14);
}

.hero p {
  font-size: 1.5rem;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  opacity: 0.92;
  margin: 0.5rem 0 0;
  letter-spacing: 0.12em;
  text-shadow:
    0 0 8px rgba(243, 237, 227, 0.16),
    0 4px 16px rgba(9, 11, 16, 0.42),
    0 0 18px rgba(166, 183, 210, 0.12);
}

.intro-text {
  font-family: Georgia, serif;
  font-size: 1.15rem;
  line-height: 1.8;
  max-width: 800px;
  margin: 4rem auto 1rem;
  padding: 0 2rem;
  text-align: center;
  color: #111;
}

.cta-button {
  display: inline-block;
  background-color: #444;
  color: white;
  padding: 0.7rem 1.2rem;
  border-radius: 5px;
  text-decoration: none;
  font-style: italic;
  font-weight: 400px;
  font-family: Georgia, serif;
  font-size: 1.1rem;
  margin-bottom: 6rem;
  margin-top: 3rem;
}

.cta-button:hover {
  background-color: #222;
}

/* === Visualization Page === */
.graph-shell {
  position: relative;
  height: 620px;
  margin: 3rem auto;
  max-width: 1100px;
  border-radius: 16px;
  background: #fffefb;
  border: 1px solid rgba(122, 96, 68, 0.15);
  box-shadow: 0 16px 32px rgba(31, 31, 31, 0.05);
  overflow: hidden;
}

.graph-canvas {
  height: 100%;
}

.graph-controls {
  position: absolute;
  right: 16px;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 2;
}

.graph-shell:hover .graph-controls {
  opacity: 1;
  transform: translateY(0);
}

.graph-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(122, 96, 68, 0.25);
  background: #fffdf9;
  color: #4b3b28;
  font-size: 1.1rem;
  box-shadow: 0 10px 20px rgba(31, 31, 31, 0.06);
  cursor: pointer;
}

.cudl-panel {
  padding: 0.9rem;
  border: 1px solid rgba(90, 74, 56, 0.22);
  border-radius: 10px;
  background: #f7efe3;
  height: fit-content;
  --panel-shadow-x: 0px;
  --panel-shadow-y: 14px;
  --panel-shadow-blur: 30px;
  --panel-shadow-alpha: 0.24;
  box-shadow:
    var(--panel-shadow-x) var(--panel-shadow-y) var(--panel-shadow-blur) rgba(35, 28, 20, var(--panel-shadow-alpha)),
    0 4px 10px rgba(35, 28, 20, 0.1);
  transition: box-shadow 0.12s ease-out;
}

.detail-panel {
  position: fixed;
  right: 1rem;
  top: 5.2rem;
  width: clamp(300px, 26vw, 620px);
  max-height: min(74vh, 780px);
  z-index: 2600;
  background: #f7f2e8;
  border: 1px solid rgba(74, 62, 48, 0.24);
  border-radius: 14px;
  box-shadow: 0 14px 32px rgba(39, 30, 20, 0.24);
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  opacity: 0;
  --detail-panel-enter-x: 110%;
  transform: translateX(var(--detail-panel-enter-x));
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.detail-panel.is-open {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.detail-panel.side-left {
  left: 1rem;
  right: auto;
  --detail-panel-enter-x: -110%;
}

.detail-panel.side-right {
  left: auto;
  right: 1rem;
  --detail-panel-enter-x: 110%;
}

.detail-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.56rem 0.72rem;
  border-bottom: 1px solid rgba(74, 62, 48, 0.18);
  background: rgba(239, 229, 213, 0.86);
  cursor: move;
}

.detail-panel-title {
  color: #4f3f2d;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.detail-panel-close {
  border: none;
  background: transparent;
  color: #5f4f3c;
  font-size: 1.18rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.1rem 0.35rem;
}

.detail-panel-body {
  max-height: min(62vh, 680px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.72rem 0.84rem 0.88rem;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.detail-panel-empty {
  margin: 0;
  color: #6c5a46;
  font-size: 0.92rem;
}

.entry-card {
  position: relative;
  padding: 0.82rem 0.88rem;
  background: #fffdfa;
  border: 1px solid rgba(74, 62, 48, 0.13);
  border-radius: 10px;
  box-sizing: border-box;
  color: #2f2a25;
  font-family: Georgia, serif;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.entry-card-title {
  display: block;
  margin: 0 1.6rem 0.56rem 0;
  font-size: 1rem;
  color: #3c2f22;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.entry-card-row {
  margin: 0.36rem 0;
  color: #4f402f;
  font-size: 0.9rem;
  line-height: 1.46;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.entry-card-row strong {
  color: #3c2f22;
}

.entry-card-note {
  margin: 0.65rem 0 0;
  color: #6a5742;
  font-size: 0.85rem;
}

.entry-card>.detail-panel-close {
  position: absolute;
  top: 0.42rem;
  right: 0.48rem;
}

.split-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 0fr;
  gap: 0;
  align-items: start;
  transition:
    grid-template-columns var(--ui-motion-standard),
    gap var(--ui-motion-standard);
}

.split-detail.is-open {
  grid-template-columns: minmax(0, 1fr) minmax(var(--split-detail-min, 260px), var(--split-detail-size, 0.56fr));
  gap: var(--split-detail-gap, 1rem);
}

.split-detail-main {
  min-width: 0;
  transition: transform var(--ui-motion-standard);
}

.split-detail.is-open .split-detail-main {
  transform: translateX(var(--split-detail-main-shift, -0.75rem));
}

.split-detail-side {
  min-width: 0;
  opacity: 0;
  transform: translateX(var(--split-detail-enter-x, 1rem));
  transition:
    opacity 0.24s ease,
    transform var(--ui-motion-standard);
}

.split-detail.is-open .split-detail-side:not(.is-entering):not(.is-exiting) {
  opacity: 1;
  transform: translateX(0);
}

.split-detail-side.is-entering {
  opacity: 0;
  transform: translateX(var(--split-detail-enter-x, 1rem));
}

.split-detail-side.is-exiting {
  opacity: 0;
  transform: translateX(var(--split-detail-exit-x, -0.75rem));
}

.records-table {
  width: 100%;
  border-collapse: collapse;
  color: #3c2f22;
  font-family: Georgia, serif;
  font-size: 0.92rem;
  line-height: 1.45;
}

.records-table th,
.records-table td {
  padding: 0.42rem 0.55rem;
  border-bottom: 1px solid rgba(92, 82, 70, 0.14);
  text-align: left;
  vertical-align: top;
}

.records-table th {
  color: #6a5742;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.records-table tbody tr:last-child td {
  border-bottom: 0;
}

/* === Shared Heatmap Components === */
.heat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 0.38rem;
  margin: 0.8rem 0 1.05rem;
  padding: 0.42rem;
  border-radius: 14px;
  background:
    radial-gradient(circle at 14% 20%, rgba(255, 255, 255, 0.86), transparent 34%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.68), rgba(244, 237, 226, 0.48)),
    #fbf8f1;
  border: 1px solid rgba(122, 96, 68, 0.1);
}

.heat-cell {
  --heat-color: #7c6f62;
  --heat-rgb: 124, 111, 98;
  --heat-alpha: 0.35;
  --heat-scale: 0.5;
  display: inline-flex;
  min-height: 2.1rem;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.42rem;
  border-radius: 10px;
  color: #2f241c;
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 255, 255, 0.7), transparent 32%),
    radial-gradient(circle at 76% 78%, rgba(var(--heat-rgb), calc(var(--heat-alpha) * 0.58)), transparent 46%),
    linear-gradient(
      90deg,
      rgba(var(--heat-rgb), calc(var(--heat-alpha) * 0.82)) 0%,
      rgba(var(--heat-rgb), calc(var(--heat-alpha) * 0.52)) calc(var(--heat-scale) * 100%),
      rgba(255, 255, 255, 0.52) calc(var(--heat-scale) * 100%)
    );
  border: 1px solid rgba(var(--heat-rgb), 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 1px 5px rgba(var(--heat-rgb), 0.08);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.035em;
  text-align: center;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.heat-text-mark {
  --heat-color: #7c6f62;
  --heat-rgb: 124, 111, 98;
  --heat-alpha: 0.45;
  padding: 0.07rem 0.13rem;
  border-radius: 0.38rem;
  color: inherit;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.72), transparent 38%),
    linear-gradient(90deg, rgba(var(--heat-rgb), calc(var(--heat-alpha) * 0.68)), rgba(var(--heat-rgb), calc(var(--heat-alpha) * 0.38)));
  box-shadow:
    inset 0 -0.08rem 0 rgba(var(--heat-rgb), calc(var(--heat-alpha) * 0.42)),
    0 0.04rem 0.26rem rgba(var(--heat-rgb), 0.08);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.heat-text-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.05em;
  height: 1.05em;
  margin-right: 0.16rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  color: #3a3128;
  font-size: 0.72em;
  font-weight: 700;
  line-height: 1;
  vertical-align: 0.08em;
}

/* === Search Page === */
.search-page {
  max-width: 1000px;
  margin: 2.4rem auto;
  padding: 0 2rem 3rem;
  font-family: Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.8;
  color: #2f2a25;
}

.filter-box {
  background: #fffdf9;
  border-radius: 16px;
  padding: var(--panel-padding, 1.8rem);
  box-shadow: 0 18px 32px rgba(31, 31, 31, 0.05);
}

.filter-box label {
  display: inline-block;
  margin: 0.5rem 1.5rem 0.5rem 0;
  font-size: 1.05rem;
  line-height: 1.8;
  vertical-align: middle;
  font-family: Georgia, serif;
}

.search-controls input[type="text"],
.search-controls select,
.search-controls button {
  font-family: Georgia, serif;
  font-size: 1rem;
  height: 2.6rem;
  padding: 0.6rem 1rem;
  border: 1px solid rgba(122, 96, 68, 0.25);
  border-radius: 8px;
  box-shadow:
    0 10px 20px rgba(31, 31, 31, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: box-shadow 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
  box-sizing: border-box;
}

.search-controls input[type="text"] {
  background-color: #fffefb;
  width: 260px;
}

.search-controls button,
.search-controls select {
  background-color: #444;
  color: white;
  border: none;
  font-weight: 500;
  text-align: center;
}

.search-controls button:hover,
.search-controls select:hover {
  background-color: #222;
  transform: translateY(-1px);
}

.search-controls select:focus,
.search-controls input[type="text"]:focus,
.search-controls button:focus {
  outline: none;
  box-shadow:
    0 12px 24px rgba(31, 31, 31, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.search-controls select option {
  font-family: Georgia, serif;
  font-size: 0.95rem;
  background-color: #444;
  color: white;
}

.search-page input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #6a4a2a;
}

.results-box {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  padding: 2rem;
  background-color: #fffdf9;
  border-radius: 12px;
}

.result-card {
  background: #fffefb;
  border-radius: 12px;
  border: 1px solid rgba(122, 96, 68, 0.12);
  border-left: 5px solid #c8a15a;
  padding: 1.4rem 1.6rem;
  margin-bottom: 1.6rem;
  box-shadow: 0 14px 28px rgba(31, 31, 31, 0.06);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  font-family: Georgia, serif;
}

.result-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 36px rgba(31, 31, 31, 0.1);
}

.result-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #4b3b28;
}

.result-divider {
  border: none;
  border-top: 1px solid #ddd;
  margin: 0.8rem 0;
}

.result-section {
  margin-bottom: 0.5rem;
  line-height: 1.6;
  font-size: 1.05rem;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  display: block;
}

.result-section strong {
  color: #6a4a2a;
}

.quote-box {
  border-left: 4px solid #c8a15a;
  background-color: #f8f3e8;
  font-style: italic;
  padding: 1.2rem 1.5rem 1.2rem 1.3rem;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  border-radius: 10px;
  box-shadow: 2px 4px 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  font-size: 1.05rem;
  color: #4b3b28;
}

.quote-box:hover {
  transform: translateY(-3px);
  box-shadow: 4px 6px 14px rgba(0, 0, 0, 0.16);
}

.quote-title {
  font-style: italic;
  font-size: 1.05rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid #d8c6a1;
  padding-bottom: 0.3rem;
  color: #6e543c;
}

.related-box strong {
  display: inline-block;
  margin-right: 0.5em;
}

.related-box ul {
  display: inline-block;
  margin-left: 1em;
}

.related-details {
  margin-top: 1.5rem;
}

/* === Pattern Lab === */
.pattern-lab-page {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 1.4rem;
  max-width: 1180px;
}

.pattern-lab-page > :not(.pattern-side-index) {
  grid-column: 2;
}

.pattern-side-index {
  position: sticky;
  top: 5rem;
  grid-column: 1;
  grid-row: 1 / span 6;
  align-self: start;
  display: grid;
  gap: 0.72rem;
  padding: 0.75rem 0.2rem 0.75rem 0.75rem;
  border-left: 1px solid rgba(122, 96, 68, 0.24);
  color: #6a5742;
  line-height: 1.55;
}

.pattern-side-index span {
  color: #8b735a;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pattern-side-index a {
  color: #4b3b28;
  font-size: 1.02rem;
  font-weight: 700;
  text-decoration: none;
}

.pattern-side-index a:hover {
  color: #15130f;
  text-decoration: underline;
  text-underline-offset: 0.22rem;
}

#pattern-lab,
#reference-alignment-lab {
  scroll-margin-top: 5.5rem;
}

@media (max-width: 1050px) {
  .pattern-lab-page {
    display: block;
    max-width: 1000px;
  }

  .pattern-side-index {
    position: static;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.9rem;
    margin-bottom: 1.2rem;
    padding: 0.65rem 0 0.65rem 0.75rem;
  }
}

.pattern-lab-note {
  max-width: 820px;
  color: #4f402f;
  line-height: 1.75;
}

.pattern-lab-note {
  margin: 1rem 0 0;
  font-size: 0.95rem;
}

.pattern-lab-controls input[type="text"] {
  flex: 1 1 360px;
  min-width: min(100%, 260px);
  width: auto;
}

.pattern-lab-controls select,
.pattern-lab-controls button {
  flex: 0 0 auto;
  width: auto;
}

.pattern-lab-summary {
  margin: 1.6rem 0 2rem;
}

.pattern-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.pattern-summary-card {
  min-height: 88px;
  padding: 1rem 1.08rem;
  border: 1px solid rgba(122, 96, 68, 0.16);
  border-radius: 18px;
  background:
    radial-gradient(circle at 82% 18%, rgba(242, 199, 107, 0.2), transparent 35%),
    rgba(255, 253, 248, 0.82);
  box-shadow: 0 14px 34px rgba(87, 64, 38, 0.06);
  color: #34291f;
}

.pattern-summary-card span {
  display: block;
  margin-top: 0.28rem;
  color: #75624e;
  font-family: Georgia, serif;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pattern-summary-value {
  display: block;
  color: #251d17;
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1;
}

.pattern-lab-section {
  margin-top: 2.4rem;
}

.pattern-browser,
.pattern-reference-lab {
  margin-bottom: 1.8rem;
}

.pattern-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.pattern-section-head .section-title {
  margin-top: 0;
}

.pattern-mode-switch {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  padding: 0.18rem;
  border: 1px solid rgba(122, 96, 68, 0.18);
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.76);
  overflow: hidden;
}

.pattern-mode-switch::before {
  content: "";
  position: absolute;
  inset: 0.18rem auto 0.18rem 0.18rem;
  width: calc((100% - 0.36rem) / 2);
  border-radius: 999px;
  background: #15130f;
  transform: translateX(0);
  transition: transform 220ms ease;
}

.pattern-mode-switch.is-pairs::before {
  transform: translateX(100%);
}

.pattern-mode-switch button {
  position: relative;
  z-index: 1;
  border: 0;
  border-radius: 999px;
  padding: 0.52rem 0.86rem;
  background: transparent;
  color: #6a5742;
  cursor: pointer;
  font-family: Georgia, serif;
  font-weight: 700;
}

.pattern-mode-switch button.is-active {
  background: transparent;
  color: #fffaf0;
}

.pattern-control-label {
  align-self: center;
  color: #6a5742;
  font-family: Georgia, serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pattern-secondary-action {
  flex: 0 0 auto;
  margin-top: 0.1rem;
  padding: 0.48rem 0.8rem;
  border: 1px solid rgba(122, 96, 68, 0.24);
  border-radius: 999px;
  background: #fffefb;
  color: #4b3b28;
  cursor: pointer;
  font-family: Georgia, serif;
  font-weight: 700;
}

.pattern-results-meta {
  margin-top: 0.2rem;
  color: #7a6651;
  font-size: 0.9rem;
}

.pattern-sort-toggles {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.pattern-sort-toggles {
  justify-content: flex-end;
}

.pattern-sort-toggles button {
  padding: 0.28rem 0.58rem;
  border: 1px solid rgba(122, 96, 68, 0.22);
  border-radius: 999px;
  background: #fffefb;
  color: #5d4a35;
  cursor: pointer;
  font-family: Georgia, serif;
  font-size: 0.82rem;
}

.pattern-sort-toggles button.is-active {
  background: #15130f;
  color: #fffaf0;
}

.pattern-lab-results {
  display: grid;
  gap: 1.4rem;
}

.pattern-record {
  padding: 1.2rem 0;
  border-top: 1px solid rgba(122, 96, 68, 0.16);
  color: #2f2a25;
  font-family: Georgia, serif;
}

.pattern-record:first-child {
  border-top: 0;
}

.pattern-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.pattern-card-kicker {
  color: #7a6651;
  font-size: 0.86rem;
  letter-spacing: 0.04em;
}

.pattern-comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.15rem;
}

.pattern-manual-compare {
  margin-top: 1.2rem;
}

.pattern-lab-controls button {
  min-width: 110px;
}

.pattern-similarity-criteria {
  margin-top: 1rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid rgba(122, 96, 68, 0.12);
  border-radius: 14px;
  background:
    radial-gradient(circle at 14% 10%, rgba(255, 255, 255, 0.82), transparent 34%),
    rgba(251, 248, 241, 0.72);
}

.pattern-similarity-criteria summary {
  cursor: pointer;
  color: #4b3b28;
  font-family: Georgia, serif;
  font-weight: 700;
}

.pattern-scoring-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.45rem 1rem;
  margin-top: 0.75rem;
  color: #4f402f;
  line-height: 1.6;
}

.pattern-scoring-grid p {
  margin: 0;
}

.match-joy-panel {
  display: grid;
  gap: 0.12rem;
  margin: 0.8rem 0 1rem;
  padding: 0.7rem 0.78rem;
  border: 1px solid rgba(122, 96, 68, 0.1);
  border-radius: 14px;
  background:
    radial-gradient(circle at 16% 12%, rgba(255, 255, 255, 0.85), transparent 34%),
    #fbf8f1;
}

.match-joy-title {
  margin-bottom: 0.2rem;
  color: #5f4d39;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.match-joy-row {
  border-bottom: 1px solid rgba(122, 96, 68, 0.08);
  padding: 0.04rem 0 0.1rem;
}

.match-joy-row:last-child {
  border-bottom: 0;
}

.match-joy-row summary {
  display: grid;
  grid-template-columns: minmax(150px, 0.85fr) minmax(420px, 1.75fr) minmax(150px, 0.85fr);
  gap: 0.8rem;
  align-items: center;
  min-height: 2rem;
  cursor: pointer;
  list-style: none;
}

.match-joy-row summary::-webkit-details-marker {
  display: none;
}

.match-joy-name {
  color: #4b3b28;
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.match-joy-wave {
  --joy-height: 22px;
  --joy-alpha: 0.24;
  --joy-hue: 180;
  --joy-fill: 50%;
  position: relative;
  display: block;
  height: 2.05rem;
  overflow: hidden;
  justify-self: center;
  width: min(100%, 430px);
}

.match-joy-wave::before {
  content: "";
  position: absolute;
  left: 0;
  right: calc(100% - var(--joy-fill));
  bottom: 0.16rem;
  height: var(--joy-height);
  min-width: 12px;
  border-radius: 50% 50% 8px 8px / 70% 70% 8px 8px;
  background:
    radial-gradient(ellipse at 50% 100%, hsla(var(--joy-hue), 68%, 70%, var(--joy-alpha)), transparent 70%),
    linear-gradient(180deg, hsla(var(--joy-hue), 74%, 72%, calc(var(--joy-alpha) * 0.88)), hsla(var(--joy-hue), 72%, 62%, calc(var(--joy-alpha) * 0.42)));
  border-bottom: 1px solid hsla(var(--joy-hue), 54%, 42%, 0.28);
}

.match-joy-wave::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.16rem;
  height: 1px;
  background: rgba(122, 96, 68, 0.18);
}

.match-joy-label {
  color: #6a5742;
  font-size: 0.72rem;
  font-weight: 400;
  text-align: right;
  text-transform: uppercase;
}

.match-strength-detail {
  margin: 0.55rem 0 0.3rem;
  padding: 0.68rem 0.78rem;
  border-radius: 10px;
  background: rgba(255, 253, 249, 0.78);
  color: #4f402f;
  font-size: 0.9rem;
}

.match-detail-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.35rem 0.75rem;
  margin: 0;
}

.match-detail-list dt {
  color: #6a4a2a;
  font-weight: 700;
}

.match-detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.pattern-text-pane {
  min-width: 0;
  padding: 0 0 0 0.85rem;
  border-left: 3px solid rgba(122, 96, 68, 0.18);
}

.pattern-text-pane strong {
  display: block;
  margin-bottom: 0.45rem;
  color: #4b3b28;
  font-size: 0.96rem;
}

.pattern-text-pane p,
.pattern-source-text {
  color: #2f2a25;
  line-height: 1.7;
}

.pattern-english-text,
.pattern-text-pane .pattern-english-text {
  margin-top: 0.45rem;
  padding-left: 0.78rem;
  border-left: 2px solid rgba(122, 96, 68, 0.16);
  color: #675846;
  font-size: 0.92rem;
  line-height: 1.62;
}

.pattern-feature-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.28rem 0.7rem;
  margin: 0.7rem 0 0;
  color: #4f402f;
  font-size: 0.92rem;
  line-height: 1.55;
}

.pattern-feature-list dt {
  color: #6a4a2a;
  font-weight: 700;
}

.pattern-feature-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.alignment-bridge {
  display: grid;
  gap: 0.4rem;
  margin: 1rem 0 0;
  padding: 0.78rem;
  border: 1px solid rgba(122, 96, 68, 0.12);
  border-radius: 14px;
  background: rgba(255, 253, 249, 0.82);
}

.alignment-bridge-title {
  margin: 0 0 0.35rem;
  color: #4b3b28;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.alignment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px minmax(0, 1fr);
  gap: 0.5rem;
  align-items: center;
  color: #3d3228;
  font-size: 0.9rem;
}

.alignment-side {
  padding: 0.42rem 0.55rem;
  border-radius: 10px;
  background: rgba(248, 243, 232, 0.86);
  border: 1px solid rgba(122, 96, 68, 0.12);
  overflow-wrap: anywhere;
}

.alignment-link {
  justify-self: center;
  min-width: 5.8rem;
  padding: 0.24rem 0.38rem;
  border: 1px solid rgba(122, 96, 68, 0.16);
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.84);
  color: #70583e;
  font-size: 0.74rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.03em;
}

.alignment-link::before,
.alignment-link::after {
  content: none;
}

.alignment-row.is-similar .alignment-side {
  background: rgba(248, 243, 232, 0.86);
}

.alignment-row.is-a-only .alignment-side:not(.is-empty) {
  background: rgba(248, 243, 232, 0.86);
}

.alignment-row.is-b-only .alignment-side:not(.is-empty) {
  background: rgba(248, 243, 232, 0.86);
}

.alignment-side.is-empty {
  color: #8a8177;
  background: rgba(210, 214, 220, 0.28);
  font-style: italic;
}

.pattern-evidence-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
}

.pattern-evidence-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 0.24rem 0.56rem;
  border-radius: 999px;
  border: 1px solid rgba(122, 96, 68, 0.28);
  color: #5a3e21;
  background: rgba(248, 243, 232, 0.72);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

/* === Transcriptions Library === */
.transcription-hero {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.8rem 2rem 1.6rem;
  background: transparent;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  font-family: Georgia, serif;
  max-width: 1000px;
  margin: 2.4rem auto 0;
}

.transcription-hero-text p {
  max-width: 620px;
  line-height: 1.7;
  margin: 0;
  color: #333;
}

.transcription-search {
  padding: 2rem;
  background: #fffdf9;
  font-family: Georgia, serif;
  max-width: 1000px;
  margin: 0 auto;
}

.search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

#manuscriptSearch {
  flex: 1 1 280px;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  border: 1px solid rgba(122, 96, 68, 0.25);
  font-size: 1rem;
  background: #fffefb;
  font-family: Georgia, serif;
  box-shadow:
    0 10px 20px rgba(31, 31, 31, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.search-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag-button {
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(122, 96, 68, 0.35);
  background: transparent;
  color: #6e4b22;
  cursor: pointer;
  font-family: Georgia, serif;
  box-shadow:
    0 8px 16px rgba(31, 31, 31, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.tag-button.is-active {
  background: #6a4a2a;
  color: #fff;
  box-shadow:
    0 10px 18px rgba(31, 31, 31, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.transcription-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  padding: 1rem 2rem 3rem;
  background: #fffdf9;
  font-family: Georgia, serif;
  max-width: 1000px;
  margin: 0 auto;
}

.manuscript-card {
  display: flex;
  flex-direction: column;
  background: #fffefb;
  border-radius: 16px;
  padding: 1.5rem;
  border: 1px solid rgba(122, 96, 68, 0.1);
  box-shadow: 0 14px 28px rgba(31, 31, 31, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.manuscript-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 38px rgba(31, 31, 31, 0.1);
}

.card-header h2 {
  margin: 0.4rem 0 0.2rem;
  font-size: 1.6rem;
  letter-spacing: 0.04em;
}

.card-subtitle {
  margin: 0;
  color: #6b6b6b;
  font-size: 0.95rem;
}

.card-body {
  margin-top: 1rem;
  color: #333;
}

.card-body p {
  margin: 0.45rem 0;
}

.card-body ul {
  margin: 0.15rem 0 0.55rem 1.2rem;
  padding: 0;
  list-style: disc;
}

.card-body ul li {
  margin: 0.2rem 0;
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.card-actions {
  margin-top: auto;
  padding-top: 1rem;
}

.card-link {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  background: #c8b8a6;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(35, 24, 15, 0.12);
}

.card-link.is-disabled {
  background: #c8b8a6;
  cursor: not-allowed;
}

/* === Manuscript Workspace === */
.manuscript-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 2rem;
  background: #f7f2e8;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  font-family: Georgia, serif;
}

.manuscript-subtitle {
  margin: 0.6rem 0 0;
  color: #4b4b4b;
}

.manuscript-meta {
  display: grid;
  gap: 0.4rem;
  font-size: 0.95rem;
  color: #2f2f2f;
}

.manuscript-workspace {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.2fr);
  gap: 2rem;
  padding: 2rem;
  background: #fffefb;
  font-family: Georgia, serif;
}

.folio-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.folio-toolbar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.tool-button {
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  border: 1px solid #c9bda9;
  background: #fff;
}

.tool-hint {
  font-size: 0.85rem;
  color: #7b6a55;
}

.folio-placeholder {
  background: #f2ebdf;
  border-radius: 16px;
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

.folio-placeholder-inner p {
  margin: 0.6rem 0 0;
  color: #5a4d3d;
}

.folio-caption {
  font-size: 0.9rem;
  color: #6b5b47;
}

.text-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.text-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.text-tabs .tab-button {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid #c6b196;
  background: transparent;
  cursor: pointer;
}

.text-tabs .tab-button.is-active {
  background: #6e4b22;
  color: #fff;
}

.tab-content {
  display: none;
}

.tab-content.is-active {
  display: block;
}

.line-map {
  background: #f7f3ea;
  padding: 1rem;
  border-radius: 12px;
}

.line-map-title {
  font-weight: 600;
}

.line-map-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.line-chip {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid #c9bda9;
  background: #fff;
}

.tei-panel {
  margin-top: 1rem;
}

.tei-raw {
  background: #2a2622;
  color: #f1e9dd;
  padding: 1rem;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.6;
}

.tei-embed-desc {
  margin: 0.4rem 0 0.9rem;
  color: #564738;
}

.tei-embed-frame {
  width: 100%;
  min-height: 820px;
  border: 1px solid rgba(122, 96, 68, 0.22);
  border-radius: 10px;
  background: #fff;
}

.empty-state {
  padding: 1.5rem;
  background: #f7f1e7;
  border-radius: 12px;
}

.transcription-notes {
  padding: 2rem;
  background: #fffdf9;
  font-family: Georgia, serif;
  max-width: 1000px;
  margin: 0 auto;
}

.transcription-notes h2 {
  margin-top: 0;
}

@media (max-width: 900px) {
  .transcription-hero {
    flex-direction: column;
  }

  .manuscript-workspace {
    grid-template-columns: 1fr;
  }
}

/* === About Page === */
.about-page {
  max-width: 1000px;
  margin: 3rem auto;
  padding: 0 2rem 4rem;
  color: #2c2c2c;
  font-family: Georgia, serif;
}

.about-hero {
  padding: 1.8rem 0 1.5rem;
}

.about-hero-text h1 {
  margin: 0.4rem 0 1rem;
  font-size: 2.4rem;
}

.about-hero .page-kicker {
  margin-top: -0.4rem;
  margin-bottom: 2.8rem;
}

.about-lead {
  position: relative;
  padding: 2rem 1.6rem 1rem;
  margin-top: 2.4rem;
  background: rgba(248, 243, 235, 0.7);
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(30, 22, 15, 0.08);
}

.about-lead p {
  margin: 0 0 1rem;
  line-height: 1.85;
  font-size: 1.05rem;
  color: #2f2a25;
}

.about-lead::before,
.about-lead::after {
  content: "";
  position: absolute;
  width: 70px;
  height: 22px;
  background:
    linear-gradient(90deg,
      rgba(210, 190, 165, 0.5) 0%,
      rgba(210, 190, 165, 0.62) 45%,
      rgba(210, 190, 165, 0.5) 100%);
  border: 1px solid rgba(120, 96, 68, 0.2);
  border-radius: 6px;
  top: -14px;
  -webkit-clip-path: inset(0 round 6px);
  clip-path: inset(0 round 6px);
}

.about-lead::before {
  left: 18px;
  transform: rotate(-3deg);
}

.about-lead::after {
  right: 22px;
  transform: rotate(3deg);
}

.about-section {
  margin-top: 2.5rem;
  padding: 0 0.5rem;
}

.about-section h2 {
  font-size: 1.6rem;
  margin: 0 0 0.8rem;
  position: relative;
  display: inline-block;
}

.about-section h2::after {
  content: "";
  display: block;
  margin-top: 0.5rem;
  width: 40%;
  height: 1px;
  background: linear-gradient(90deg, rgba(90, 74, 56, 0.6), transparent);
}

.about-section p {
  line-height: 1.8;
  margin: 0 0 1rem;
}

.about-section a {
  color: #6f4a12;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(111, 74, 18, 0.35);
  transition: color 0.18s ease, border-color 0.18s ease;
}

.about-section a:visited {
  color: #6f4a12;
}

.about-section a:hover,
.about-section a:focus-visible {
  color: var(--editorial-mark-brown-strong);
  border-bottom-color: rgba(var(--editorial-mark-brown-rgb), 0.72);
}

.about-list {
  margin: 1rem 0 1.2rem 1.2rem;
  padding: 0;
  line-height: 1.7;
}

.about-divider {
  margin: 3rem 0 2rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(90, 74, 56, 0.4), transparent);
}

.about-contact {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.contact-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  text-decoration: none;
  color: #3b2f22;
  background: transparent;
  outline-offset: 8px;
  transition: transform 0.2s ease;
}

.contact-pill img {
  width: 22px;
  height: 22px;
  opacity: var(--accent-fade-opacity-rest);
  filter: var(--accent-fade-filter-rest);
  transition: var(--accent-fade-transition);
}

.contact-pill:hover,
.contact-pill:focus-visible {
  transform: translateY(-1px);
}

.contact-pill:hover img,
.contact-pill:focus-visible img {
  opacity: var(--accent-fade-opacity-active);
  filter: var(--accent-fade-filter-active);
}

@media (max-width: 900px) {
  .about-hero {
    padding: 2.2rem 0 1.2rem;
  }
}

/* === Dataset Page === */
#dataset-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
  padding: 2rem;
}

.dataset-card {
  width: 300px;
  padding: 1.5rem;
  border-radius: 0.6rem;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
  color: white;
}

.chinese-card {
  background-color: #213b5e;
}

.sanskrit-card {
  background-color: #b85a28;
}

.number-card {
  background-color: #c69d3a;
}

.dataset-title {
  font-size: 1.2rem;
  margin-bottom: 0.8rem;
}

/* Relation Atlas */
.relation-atlas-page {
  color: #2f2a25;
}

.relation-atlas-hero {
  margin-bottom: 1.4rem;
}

.relation-stats {
  margin: 1.4rem 0 1.8rem;
}

.relation-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.relation-stat-card {
  min-height: 78px;
}

.relation-atlas-shell {
  padding: 1.1rem;
}

.relation-tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.1rem;
}

.relation-tab-bar button {
  flex: 0 0 auto;
  padding: 0.48rem 0.74rem;
  border: 1px solid rgba(122, 96, 68, 0.22);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.86);
  color: #5d4a35;
  cursor: pointer;
  font-family: Georgia, serif;
  font-weight: 700;
}

.relation-tab-bar button.is-active {
  background: #15130f;
  color: #fffaf0;
}

.relation-atlas-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.34fr);
  gap: 1rem;
  align-items: start;
}

.relation-main-panel,
.relation-inspector {
  min-width: 0;
}

.relation-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.relation-panel-head h2,
.relation-inspector h2 {
  margin: 0;
  color: #2c241d;
  font-family: Georgia, serif;
  font-size: 1.28rem;
}

.relation-panel-head p,
.relation-inspector p {
  margin: 0.3rem 0 0;
  color: #6a5742;
  line-height: 1.45;
}

.relation-panel-head > span {
  flex: 0 0 auto;
  padding: 0.3rem 0.56rem;
  border-radius: 999px;
  background: rgba(242, 199, 107, 0.18);
  color: #6b5332;
  font-size: 0.78rem;
  font-weight: 700;
}

.relation-concept-band {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.relation-concept-band button,
.relation-grammar-card > button,
.relation-mini-edges button,
.relation-card-head button,
.relation-chunk-title,
.relation-role-matrix button {
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  font-family: Georgia, serif;
}

.relation-concept-band button {
  display: grid;
  gap: 0.12rem;
  padding: 0.62rem 0.72rem;
  border: 1px solid rgba(122, 96, 68, 0.16);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.75);
  text-align: left;
}

.relation-concept-band strong,
.relation-grammar-card strong {
  color: #352a20;
}

.relation-concept-band span,
.relation-card-head span,
.relation-chunk-title span {
  color: #7b6650;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.relation-graph-stack {
  display: grid;
  gap: 1rem;
}

.relation-graph-card,
.relation-grammar-card,
.relation-chunk-card,
.relation-inspector {
  border: 1px solid rgba(122, 96, 68, 0.16);
  border-radius: 20px;
  background:
    radial-gradient(circle at 88% 8%, rgba(138, 200, 221, 0.14), transparent 28%),
    rgba(255, 253, 248, 0.8);
  box-shadow: 0 18px 42px rgba(87, 64, 38, 0.06);
}

.relation-graph-card,
.relation-chunk-card {
  padding: 1rem;
}

.relation-card-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.9rem;
}

.relation-card-head strong {
  display: block;
  color: #2f241c;
  font-size: 1rem;
}

.relation-card-head button {
  flex: 0 0 auto;
  padding: 0.35rem 0.58rem;
  border: 1px solid rgba(122, 96, 68, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: #5d4a35;
  font-size: 0.78rem;
}

.relation-flow {
  display: flex;
  gap: 0;
  overflow-x: auto;
  padding: 0.2rem 0.2rem 0.65rem;
}

.relation-flow-item {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.relation-step-node {
  display: grid;
  gap: 0.15rem;
  width: 168px;
  min-height: 128px;
  padding: 0.72rem;
  border: 1px solid rgba(122, 96, 68, 0.18);
  border-radius: 18px;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.72), transparent 34%),
    linear-gradient(135deg, rgba(183, 217, 139, 0.22), rgba(138, 200, 221, 0.16));
  color: #2f241c;
  text-align: left;
  box-shadow: 0 12px 26px rgba(87, 64, 38, 0.08);
}

.relation-step-order {
  width: max-content;
  min-width: 1.5rem;
  padding: 0.12rem 0.34rem;
  border-radius: 999px;
  background: #15130f;
  color: #fffaf0;
  font-size: 0.74rem;
  text-align: center;
}

.relation-step-node strong {
  color: #2f241c;
  font-size: 0.86rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.relation-step-node em {
  color: #4d3d2c;
  font-style: normal;
  line-height: 1.32;
}

.relation-step-node small {
  color: #76604a;
  font-size: 0.76rem;
}

.relation-flow-edge {
  position: relative;
  flex: 0 0 96px;
  height: 3.4rem;
  margin: 0 0.3rem;
}

.relation-flow-edge::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: rgba(122, 96, 68, 0.28);
}

.relation-flow-edge i {
  position: absolute;
  top: calc(50% - 0.22rem);
  left: 0;
  width: 0.44rem;
  height: 0.44rem;
  border-radius: 999px;
  background: #8ac8dd;
  box-shadow: 0 0 0 0.22rem rgba(138, 200, 221, 0.18);
  animation: relation-flow-dot 1800ms ease-in-out infinite;
}

.relation-flow-edge b {
  position: absolute;
  left: 50%;
  top: calc(50% + 0.34rem);
  max-width: 88px;
  padding: 0.08rem 0.24rem;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.92);
  color: #6a5742;
  font-size: 0.7rem;
  font-weight: 400;
  text-align: center;
  transform: translateX(-50%);
}

@keyframes relation-flow-dot {
  0% {
    transform: translateX(0);
    opacity: 0.2;
  }
  45%,
  70% {
    opacity: 1;
  }
  100% {
    transform: translateX(88px);
    opacity: 0.2;
  }
}

.relation-grammar-grid,
.relation-chunk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.9rem;
}

.relation-grammar-card {
  padding: 0.9rem;
}

.relation-grammar-card > button {
  display: flex;
  width: 100%;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: baseline;
  margin-bottom: 0.72rem;
  text-align: left;
}

.relation-grammar-card > button span {
  color: #76604a;
  font-size: 0.78rem;
}

.relation-mini-edges {
  display: grid;
  gap: 0.36rem;
}

.relation-mini-edges button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 0.38rem;
  align-items: center;
  padding: 0.38rem 0.42rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.48);
  text-align: left;
}

.relation-mini-edges span {
  overflow: hidden;
  color: #3d3127;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.relation-mini-edges i {
  color: #9b7d54;
  font-size: 0.68rem;
  font-style: normal;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.relation-matrix-wrap {
  max-height: 720px;
  overflow: auto;
  border: 1px solid rgba(122, 96, 68, 0.14);
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.68);
}

.relation-role-matrix {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
  font-family: Georgia, serif;
}

.relation-role-matrix th,
.relation-role-matrix td {
  padding: 0.42rem 0.48rem;
  border-bottom: 1px solid rgba(122, 96, 68, 0.1);
  color: #3a3028;
  text-align: center;
}

.relation-role-matrix thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fbf3e6;
  color: #6a5742;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.relation-role-matrix th:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff8ee;
  text-align: left;
}

.relation-role-matrix button {
  min-width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  background: rgba(143, 216, 198, 0.38);
  color: #2c564e;
  font-weight: 700;
}

.relation-chunk-card {
  display: grid;
  gap: 0.58rem;
}

.relation-chunk-title {
  display: grid;
  gap: 0.15rem;
  padding: 0;
  text-align: left;
}

.relation-chunk-title strong {
  color: #2c241d;
  font-size: 1rem;
}

.relation-summary-row {
  display: grid;
  gap: 0.16rem;
  margin: 0;
}

.relation-summary-row span {
  color: #866c50;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.relation-summary-row strong {
  color: #3a3028;
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.38;
}

.relation-inspector {
  position: sticky;
  top: 1rem;
  padding: 1rem;
}

.relation-inspector dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.38rem 0.62rem;
  margin: 0.75rem 0;
  font-family: Georgia, serif;
}

.relation-inspector dt {
  color: #866c50;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.relation-inspector dd {
  margin: 0;
  color: #352a20;
}

.relation-inspector blockquote {
  margin: 0.8rem 0 0;
  padding-left: 0.8rem;
  border-left: 3px solid rgba(138, 200, 221, 0.58);
  color: #4c3d2e;
  line-height: 1.5;
}

.relation-inspector-list {
  display: grid;
  gap: 0.38rem;
  max-height: 420px;
  overflow: auto;
}

.relation-inspector-list p {
  margin: 0;
  padding: 0.42rem 0.48rem;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.52);
}

@media (max-width: 920px) {
  .relation-atlas-grid {
    grid-template-columns: 1fr;
  }

  .relation-inspector {
    position: static;
  }

  .relation-panel-head {
    display: grid;
  }
}

/* Visual Grammar: demo-style relation visual grammar */
.relation-demo-app {
  --relation-bg: #f7f2e8;
  --relation-panel: #fffaf0;
  --relation-ink: #2d281f;
  --relation-muted: #776b5c;
  --relation-line: #c9bca6;
  --relation-astro: #315f83;
  --relation-param: #9a5a18;
  --relation-quantity: #6f5c9a;
  --relation-calc: #8b3b35;
  --relation-motion: #35735b;
  --relation-knowledge: #705583;
  --relation-authority: #7b5f2f;
  --relation-def: #7d3f49;
  --relation-loc: #455a8a;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
  color: var(--relation-ink);
  font-family: Georgia, "Noto Serif CJK SC", "Songti SC", serif;
}

.relation-demo-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  padding: 18px 0 12px;
}

.relation-demo-header h1 {
  margin: 0;
  color: #251d17;
  font-size: 30px;
  letter-spacing: 0.02em;
}

.relation-demo-subtitle,
.relation-demo-note {
  color: var(--relation-muted);
  line-height: 1.55;
}

.relation-demo-subtitle {
  max-width: 850px;
  margin: 0.55rem 0 0;
}

.relation-demo-note {
  font-size: 0.86rem;
}

.relation-demo-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(84px, 1fr));
  gap: 8px;
  min-width: 390px;
}

.relation-demo-stat {
  padding: 10px 12px;
  border: 1px solid rgba(122, 94, 47, 0.18);
  border-radius: 16px;
  background: rgba(255, 250, 240, 0.78);
  box-shadow: 0 4px 12px rgba(44, 32, 18, 0.05);
}

.relation-demo-stat strong {
  display: block;
  font-size: 22px;
}

.relation-demo-stat span {
  color: var(--relation-muted);
  font-size: 12px;
}

.relation-demo-tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
  padding: 10px 0;
  background: rgba(247, 242, 232, 0.86);
  backdrop-filter: blur(8px);
}

.relation-demo-tab,
.relation-demo-pill {
  border: 1px solid var(--relation-line);
  border-radius: 999px;
  background: #fff8ec;
  color: #3a3125;
  cursor: pointer;
  font-family: inherit;
}

.relation-demo-tab {
  padding: 9px 14px;
}

.relation-demo-tab.active,
.relation-demo-pill.active {
  border-color: #2f2920;
  background: #2f2920;
  color: #fff6e8;
}

.relation-demo-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.relation-demo-panel {
  overflow: hidden;
  border: 1px solid rgba(122, 94, 47, 0.22);
  border-radius: 22px;
  background: rgba(255, 250, 240, 0.82);
  box-shadow: 0 10px 28px rgba(44, 32, 18, 0.12);
}

.relation-demo-panel.pad {
  padding: 18px;
}

.relation-demo-view {
  display: none;
}

.relation-demo-view.active {
  display: block;
}

.relation-panel-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 0 0 12px;
}

.relation-panel-title h2 {
  margin: 0;
  font-size: 20px;
}

.relation-demo-inspector {
  position: sticky;
  top: 74px;
  max-height: calc(100vh - 96px);
  overflow: auto;
  padding: 16px;
}

.relation-demo-inspector h3 {
  margin: 0 0 6px;
  font-size: 20px;
}

.relation-detail-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(122, 94, 47, 0.2);
}

.relation-detail-block h4 {
  margin: 0 0 8px;
  color: var(--relation-muted);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.relation-kv {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 8px;
  margin: 6px 0;
  font-size: 14px;
}

.relation-kv b {
  color: var(--relation-muted);
  font-weight: 600;
}

.relation-demo-tag,
.relation-term-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
}

.relation-term-label {
  display: inline-grid;
  gap: 0.08rem;
  vertical-align: middle;
}

.relation-term-label small {
  color: var(--relation-muted);
  font-size: 0.72em;
  font-weight: 400;
  line-height: 1.15;
}

.relation-demo-tag {
  margin: 0 4px 4px 0;
  padding: 3px 8px;
}

.relation-term-chip {
  gap: 4px;
  margin: 5px 5px 0 0;
  padding: 4px 8px;
  cursor: pointer;
  font-family: inherit;
}

.type-ASTRO_TERM {
  border-color: rgba(49, 95, 131, 0.35);
  background: rgba(49, 95, 131, 0.08);
  color: var(--relation-astro);
}

.type-PARAMETER {
  border-color: rgba(154, 90, 24, 0.35);
  background: rgba(154, 90, 24, 0.09);
  color: var(--relation-param);
}

.type-QUANTITY {
  border-color: rgba(111, 92, 154, 0.35);
  background: rgba(111, 92, 154, 0.08);
  color: var(--relation-quantity);
}

.type-CALC_OP {
  border-color: rgba(139, 59, 53, 0.35);
  background: rgba(139, 59, 53, 0.08);
  color: var(--relation-calc);
}

.type-MOTION {
  border-color: rgba(53, 115, 91, 0.35);
  background: rgba(53, 115, 91, 0.08);
  color: var(--relation-motion);
}

.type-KNOWLEDGE_OP {
  border-color: rgba(112, 85, 131, 0.35);
  background: rgba(112, 85, 131, 0.08);
  color: var(--relation-knowledge);
}

.type-AUTHORITY {
  border-color: rgba(123, 95, 47, 0.35);
  background: rgba(123, 95, 47, 0.08);
  color: var(--relation-authority);
}

.relation-demo-legend,
.relation-demo-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 12px 0 16px;
}

.relation-demo-pill {
  padding: 7px 11px;
}

.relation-graph-wrap,
.relation-matrix-wrap {
  overflow: auto;
  border: 1px solid rgba(122, 94, 47, 0.18);
  border-radius: 18px;
  background: #fffdf7;
}

.relation-graph-wrap {
  padding: 8px;
}

.relation-graph-wrap svg {
  display: block;
  width: 100%;
  min-width: 920px;
  height: auto;
}

.relation-node rect {
  cursor: pointer;
  transition: all 0.16s ease;
}

.relation-node:hover rect {
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.18));
  transform: translateY(-1px);
}

.relation-node.selected rect {
  stroke: #1f1b16;
  stroke-width: 3;
}

.relation-edge {
  fill: none;
  stroke: #927f65;
  stroke-width: 2;
  opacity: 0.72;
}

.relation-edge-label {
  fill: #6d5f4b;
  font-size: 12px;
}

.relation-layer-label {
  fill: #8a7b68;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.relation-node-label {
  fill: #2f2920;
  font-size: 17px;
  font-weight: 700;
}

.relation-node-sub {
  fill: #655849;
  font-size: 12px;
}

.relation-node-tiny {
  fill: #7b6c59;
  font-size: 11px;
}

.relation-grammar-area {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.relation-demo-cards,
.relation-cluster-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.relation-demo-card,
.part-box,
.motion-card,
.frame-box,
.relation-hub-card {
  border: 1px solid rgba(122, 94, 47, 0.18);
  border-radius: 16px;
  background: #fffdf8;
  color: inherit;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all 0.14s ease;
}

.relation-demo-card {
  padding: 12px;
}

.relation-demo-card:hover,
.relation-step:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(44, 32, 18, 0.1);
}

.relation-demo-card h4 {
  margin: 0 0 8px;
}

.definition-card {
  border-left: 5px solid var(--relation-def);
}

.value-card {
  border-left: 5px solid var(--relation-param);
}

.part-box,
.motion-card,
.frame-box,
.relation-hub-card {
  padding: 14px;
}

.part-box {
  border-color: rgba(46, 110, 140, 0.28);
  background: rgba(46, 110, 140, 0.05);
}

.motion-card {
  border-left: 5px solid var(--relation-motion);
}

.frame-box {
  border-color: rgba(69, 90, 138, 0.28);
  background: rgba(69, 90, 138, 0.06);
}

.actor-card {
  border-left: 5px solid var(--relation-authority);
}

.relation-hub-card {
  border-color: rgba(112, 85, 131, 0.24);
  background: linear-gradient(145deg, rgba(112, 85, 131, 0.05), rgba(255, 255, 255, 0.72));
}

.relation-frame-note {
  margin: 0 0 0.75rem;
  color: var(--relation-muted);
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.relation-part-children {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.relation-arrow {
  margin: 6px 0;
  color: var(--relation-muted);
  font-family: ui-sans-serif, system-ui;
}

.relation-hub {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  border: 1px solid rgba(112, 85, 131, 0.2);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(112, 85, 131, 0.05), rgba(255, 255, 255, 0.7));
}

.relation-hub-center {
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  width: 130px;
  height: 130px;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(112, 85, 131, 0.35);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 10px 28px rgba(44, 32, 18, 0.12);
  font-size: 28px;
  transform: translate(-50%, -50%);
}

.relation-hub-item {
  position: absolute;
  padding: 8px 10px;
  border: 1px solid rgba(112, 85, 131, 0.25);
  border-radius: 999px;
  background: #fffdf8;
  box-shadow: 0 4px 10px rgba(44, 32, 18, 0.08);
  color: inherit;
  cursor: pointer;
  font-family: inherit;
}

.relation-flow {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 12px;
  border: 1px solid rgba(122, 94, 47, 0.18);
  border-radius: 18px;
  background: #fffdf8;
}

.relation-step {
  display: block;
  min-width: 190px;
  padding: 11px;
  border: 1px solid rgba(139, 59, 53, 0.22);
  border-radius: 16px;
  background: rgba(139, 59, 53, 0.04);
  color: inherit;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.relation-step strong {
  display: block;
  margin-bottom: 4px;
  color: var(--relation-muted);
  font-size: 13px;
}

.relation-step .phrase {
  margin-bottom: 8px;
  font-size: 17px;
}

.relation-step .op {
  color: var(--relation-calc);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.relation-cluster {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
  margin: 12px 0;
}

.relation-cluster-name {
  padding: 14px;
  border: 1px solid rgba(139, 59, 53, 0.22);
  border-radius: 16px;
  background: rgba(139, 59, 53, 0.06);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.relation-matrix {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

.relation-matrix th,
.relation-matrix td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(122, 94, 47, 0.14);
  text-align: center;
}

.relation-matrix th:first-child,
.relation-matrix td:first-child {
  position: sticky;
  left: 0;
  background: #fffdf8;
  text-align: left;
}

.relation-dot {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(45, 40, 31, 0.12);
  border-radius: 50%;
  cursor: pointer;
}

.relation-dot.type-ASTRO_TERM {
  background: var(--relation-astro);
}

.relation-dot.type-PARAMETER {
  background: var(--relation-param);
}

.relation-dot.type-QUANTITY {
  background: var(--relation-quantity);
}

.relation-dot.type-CALC_OP {
  background: var(--relation-calc);
}

.relation-dot.type-MOTION {
  background: var(--relation-motion);
}

.relation-dot.type-KNOWLEDGE_OP {
  background: var(--relation-knowledge);
}

.relation-dot.type-AUTHORITY {
  background: var(--relation-authority);
}

.relation-explorer-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 14px;
}

.relation-chunk-list {
  max-height: 720px;
  overflow: auto;
  padding: 10px;
}

.relation-chunk-button {
  display: block;
  width: 100%;
  margin: 6px 0;
  padding: 9px 10px;
  border: 1px solid rgba(122, 94, 47, 0.18);
  border-radius: 12px;
  background: #fffdf8;
  color: inherit;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.relation-chunk-button.active {
  background: #342e26;
  color: #fff4e4;
}

.relation-anchor-block {
  margin: 10px 0;
  padding: 12px;
  border: 1px solid rgba(122, 94, 47, 0.18);
  border-radius: 16px;
  background: #fffdf8;
}

.relation-anchor-text {
  font-size: 20px;
  line-height: 1.65;
}

.relation-inspector-phrase {
  font-size: 20px;
}

.relation-empty {
  color: var(--relation-muted);
  font-style: italic;
}

@media (max-width: 1050px) {
  .relation-demo-grid {
    grid-template-columns: 1fr;
  }

  .relation-demo-inspector {
    position: static;
    max-height: none;
  }

  .relation-demo-header {
    flex-direction: column;
  }

  .relation-demo-stats {
    min-width: 0;
    width: 100%;
  }

  .relation-explorer-grid,
  .relation-cluster {
    grid-template-columns: 1fr;
  }
}
