:root {
  --bg-top: #f7f1e8;
  --bg-bottom: #e5ecf5;
  --text-primary: #20242b;
  --text-secondary: #3f4b5a;
  --text-tertiary: #5b6472;
  --heading: #171c24;
  --link: #1e4d84;
  --link-hover: #163a66;
  --link-visited: #6a4a2e;
  --link-active: #123b63;
  --focus-ring: #a8582f;
  --border-strong: rgba(32, 36, 43, 0.28);
  --tag-base-bg: rgba(32, 36, 43, 0.09);
  --tag-base-border: rgba(32, 36, 43, 0.2);
  --tag-person-bg: rgba(172, 78, 55, 0.24);
  --tag-person-border: rgba(172, 78, 55, 0.42);
  --tag-music-bg: rgba(47, 93, 138, 0.22);
  --tag-music-border: rgba(47, 93, 138, 0.4);
  --tag-instrument-bg: rgba(46, 122, 98, 0.22);
  --tag-instrument-border: rgba(46, 122, 98, 0.4);
  --tag-technique-bg: rgba(92, 84, 164, 0.22);
  --tag-technique-border: rgba(92, 84, 164, 0.4);
  --tag-school-bg: rgba(141, 95, 41, 0.23);
  --tag-school-border: rgba(141, 95, 41, 0.4);
  --tag-event-bg: rgba(154, 70, 48, 0.24);
  --tag-event-border: rgba(154, 70, 48, 0.42);
  --surface-soft: rgba(255, 255, 255, 0.9);
  --surface-emphasis: rgba(255, 255, 255, 0.97);
  --surface-band-1: rgba(47, 93, 138, 0.06);
  --surface-band-2: rgba(168, 88, 47, 0.06);
  --panel-shadow: 0 10px 24px rgba(23, 28, 36, 0.08);
  --space-chapter-sm: 0.62rem;
  --space-chapter-md: 1.4rem;
  --space-chapter-lg: 2.5rem;
  --space-block-sm: 0.5rem;
  --space-block-md: 0.95rem;
  --space-block-lg: 1.25rem;
  --body-leading: 1.84;
  --body-tracking: 0.012em;
  /* 1 line blank space between minimal paragraph blocks */
  --paragraph-gap: calc(1em * var(--body-leading));
  --font-heading: "Hiragino Mincho ProN", "Yu Mincho", serif;
  --font-body: "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  --fs-h1: clamp(1.62rem, 3.2vw, 2.28rem);
  --fs-h2: clamp(1.24rem, 2.2vw, 1.46rem);
  --fs-h3: clamp(1.05rem, 1.6vw, 1.18rem);
  --fs-body: 1rem;
  --fs-meta: 0.96rem;
  --fs-note: 0.92rem;
  --fw-h1: 760;
  --fw-h2: 730;
  --fw-h3: 680;
  --fw-body: 470;
  --fw-meta: 520;
  --fw-note: 440;
  --page-shell-max: 1320px;
  --desktop-shell-max: 1460px;
  /* Task17: unify text width constraints to one source-of-truth. */
  --content-line-max: 92ch;
  --desktop-content-max: var(--content-line-max);
  --desktop-list-max: 1160px;
  --desktop-panel-pad-x: clamp(1.25rem, 2vw, 2rem);
  --list-line-max: 1200px;
  --table-col-min: 9.5rem;
  --timeline-date-col: 8.4rem;
  --readable-max: var(--content-line-max);
  /* Heading/body indentation lanes.
     Fixed step model to enforce visible nesting on all devices:
     h2 < h3 < h4 < h5 < body */
  --indent-h2: clamp(0.32rem, 0.7vw, 0.6rem);
  --indent-step: clamp(0.72rem, 1.5vw, 1.25rem);
  --indent-h3: calc(var(--indent-h2) + var(--indent-step));
  --indent-h4: calc(var(--indent-h3) + var(--indent-step));
  --indent-h5: calc(var(--indent-h4) + var(--indent-step));
  --indent-body: calc(var(--indent-h5) + var(--indent-step));
  /* Compatibility aliases. Keep existing selectors stable until task23+. */
  --ink: var(--text-primary);
  --muted: var(--text-tertiary);
  --card: var(--surface-soft);
  --line: rgba(32, 36, 43, 0.2);
  --accent: #a8582f;
  --accent-2: #2f5d8a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg-top), var(--bg-bottom));
  min-height: 100vh;
}

.skip-link {
  position: fixed;
  left: 0.72rem;
  top: 0.72rem;
  z-index: 120;
  display: inline-block;
  padding: 0.46rem 0.62rem;
  border: 1px solid rgba(32, 36, 43, 0.36);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  color: var(--heading);
  font-size: 0.9rem;
  font-weight: 680;
  text-decoration: none;
  box-shadow: 0 5px 14px rgba(23, 28, 36, 0.14);
  transform: translateY(-180%);
  transition: transform 120ms ease;
}

.skip-link:focus-visible {
  transform: translateY(0);
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

#main-content:focus-visible {
  outline: 2px dashed rgba(47, 93, 138, 0.44);
  outline-offset: 3px;
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(10px);
  pointer-events: none;
}

body::before {
  width: 30rem;
  height: 30rem;
  top: -9rem;
  right: -9rem;
  background: radial-gradient(circle, rgba(168, 88, 47, 0.1), transparent 72%);
}

body::after {
  width: 26rem;
  height: 26rem;
  bottom: -9rem;
  left: -8rem;
  background: radial-gradient(circle, rgba(47, 93, 138, 0.08), transparent 72%);
}

.wrap {
  width: 100%;
  margin: 0;
  padding: 0;
}

.page-shell {
  width: min(var(--page-shell-max), 96vw);
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.readable {
  width: 100%;
  max-inline-size: none;
}

.list-wide {
  max-inline-size: none;
  width: 100%;
}

.hero {
  padding: 1.6rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, var(--surface-emphasis), var(--surface-soft));
  box-shadow: var(--panel-shadow);
  backdrop-filter: none;
}

.title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: var(--fs-h1);
  font-weight: var(--fw-h1);
  letter-spacing: 0.028em;
  color: var(--heading);
}

.hero :is(.title, .lead, .subtitle) {
  max-inline-size: var(--readable-max);
}

.scope-list {
  margin: 0.62rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.42rem;
  max-inline-size: var(--readable-max);
}

.scope-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.44rem;
  padding: 0.3rem 0.52rem;
  border-radius: 10px;
  border: 1px solid rgba(32, 36, 43, 0.22);
  background: rgba(255, 255, 255, 0.62);
}

.scope-label {
  display: inline-block;
  min-width: 4.8rem;
  font-size: 0.8rem;
  font-weight: 760;
  letter-spacing: 0.01em;
  color: var(--heading);
}

.scope-value {
  font-size: 0.9rem;
  font-weight: 540;
  color: var(--text-secondary);
}

.subtitle {
  margin: 0.55rem 0 0;
  font-family: var(--font-body);
  font-size: var(--fs-note);
  font-weight: var(--fw-note);
  color: var(--muted);
  line-height: 1.76;
}

.term,
.term-major {
  display: inline;
  padding: 0 0.24em;
  margin: 0 0.02em;
  border-radius: 0.32em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--heading);
  text-decoration: none;
}

.term {
  background: linear-gradient(180deg, rgba(47, 93, 138, 0.16), rgba(47, 93, 138, 0.1));
  border: 1px solid rgba(47, 93, 138, 0.24);
  box-shadow: inset 0 -0.06em 0 rgba(47, 93, 138, 0.2);
}

.term-major {
  background: linear-gradient(180deg, rgba(168, 88, 47, 0.3), rgba(168, 88, 47, 0.18));
  border: 1px solid rgba(168, 88, 47, 0.42);
  box-shadow: inset 0 -0.08em 0 rgba(168, 88, 47, 0.26), 0 1px 2px rgba(32, 36, 43, 0.08);
  font-weight: 780;
}

/* Task14: Shared `tag-*` emphasis system with fixed attribute colors. */
.tag-attr,
.tag-person,
.tag-instrument,
.tag-music,
.tag-concept,
.tag-technique,
.tag-event,
.tag-school {
  display: inline;
  padding: 0 0.22em;
  margin: 0 0.02em;
  border-radius: 0.3em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--heading);
  text-decoration: none;
  border: 1px solid transparent;
}

.tag-attr {
  background: linear-gradient(180deg, var(--tag-base-bg), rgba(32, 36, 43, 0.06));
  border-color: var(--tag-base-border);
  box-shadow: inset 0 -0.06em 0 rgba(32, 36, 43, 0.12);
}

.tag-person,
.tag-attr.tag-person {
  background: linear-gradient(180deg, var(--tag-person-bg), rgba(172, 78, 55, 0.15));
  border-color: var(--tag-person-border);
  box-shadow: inset 0 -0.06em 0 rgba(172, 78, 55, 0.26);
}

.tag-instrument,
.tag-attr.tag-instrument {
  background: linear-gradient(180deg, var(--tag-instrument-bg), rgba(46, 122, 98, 0.14));
  border-color: var(--tag-instrument-border);
  box-shadow: inset 0 -0.06em 0 rgba(46, 122, 98, 0.24);
}

.tag-music,
.tag-attr.tag-music {
  background: linear-gradient(180deg, var(--tag-music-bg), rgba(47, 93, 138, 0.14));
  border-color: var(--tag-music-border);
  box-shadow: inset 0 -0.06em 0 rgba(47, 93, 138, 0.24);
}

.tag-concept,
.tag-attr.tag-concept {
  background: linear-gradient(180deg, var(--tag-technique-bg), rgba(92, 84, 164, 0.13));
  border-color: var(--tag-technique-border);
  box-shadow: inset 0 -0.06em 0 rgba(92, 84, 164, 0.24);
}

.tag-technique,
.tag-attr.tag-technique {
  background: linear-gradient(180deg, var(--tag-technique-bg), rgba(92, 84, 164, 0.13));
  border-color: var(--tag-technique-border);
  box-shadow: inset 0 -0.06em 0 rgba(92, 84, 164, 0.24);
}

.tag-school,
.tag-attr.tag-school {
  background: linear-gradient(180deg, var(--tag-school-bg), rgba(141, 95, 41, 0.14));
  border-color: var(--tag-school-border);
  box-shadow: inset 0 -0.06em 0 rgba(141, 95, 41, 0.24);
}

.tag-event,
.tag-attr.tag-event {
  background: linear-gradient(180deg, var(--tag-event-bg), rgba(154, 70, 48, 0.15));
  border-color: var(--tag-event-border);
  box-shadow: inset 0 -0.06em 0 rgba(154, 70, 48, 0.24);
}

/* Non-attribute emphasis: bold only. */
.tag-other-strong {
  font-weight: 740;
  letter-spacing: 0.006em;
  color: var(--heading);
  text-decoration: none;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
}

/* Task003: heading scopes must not render tag/background emphasis. */
:where(h1, h2, h3, h4, h5, h6):is([class^="tag-"], [class*=" tag-"]),
:where(h1, h2, h3, h4, h5, h6) :is([class^="tag-"], [class*=" tag-"], strong, b) {
  color: inherit;
  background: none;
  font-weight: inherit;
  border: 0;
  box-shadow: none;
  padding: 0;
  margin: 0;
  border-radius: 0;
  letter-spacing: inherit;
  text-decoration: inherit;
  box-decoration-break: slice;
  -webkit-box-decoration-break: slice;
}

/* Task681: top title and page TOC must not show []-derived tag emphasis. */
.hero .title :is([class^="tag-"], [class*=" tag-"]),
.toc-panel :is([class^="tag-"], [class*=" tag-"]) {
  color: inherit;
  background: none;
  font-weight: inherit;
  border: 0;
  box-shadow: none;
  padding: 0;
  margin: 0;
  border-radius: 0;
  letter-spacing: inherit;
  text-decoration: inherit;
  box-decoration-break: slice;
  -webkit-box-decoration-break: slice;
}

.wrap a:not(.nav-btn) {
  color: var(--link);
  font-weight: 550;
  text-decoration-line: underline;
  text-decoration-thickness: 0.09em;
  text-underline-offset: 0.18em;
  text-decoration-color: currentColor;
}

.wrap a:not(.nav-btn):visited {
  color: var(--link-visited);
}

.wrap a:not(.nav-btn):hover {
  color: var(--link-hover);
  text-decoration-thickness: 0.12em;
}

.wrap a:not(.nav-btn):focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  color: var(--link-hover);
  text-decoration-thickness: 0.12em;
}

.wrap a:not(.nav-btn):active {
  color: var(--link-active);
  text-decoration-thickness: 0.12em;
}

/* Keep heading anchors visually identical to heading text, except underline. */
.wrap :is(h1, h2, h3, h4, h5, h6) a:not(.nav-btn),
.wrap :is(h1, h2, h3, h4, h5, h6) a:not(.nav-btn):visited,
.wrap :is(h1, h2, h3, h4, h5, h6) a:not(.nav-btn):hover,
.wrap :is(h1, h2, h3, h4, h5, h6) a:not(.nav-btn):focus-visible,
.wrap :is(h1, h2, h3, h4, h5, h6) a:not(.nav-btn):active {
  color: inherit;
  font-weight: inherit;
}

/* Supplemental term links for task11-15: compact, low-noise inline chips. */
.term-supp-wrap {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.26em;
  margin-left: 0.28em;
  vertical-align: baseline;
}

.term-supp-link {
  display: inline-block;
  padding: 0.05em 0.5em;
  border: 1px solid rgba(32, 36, 43, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text-tertiary);
  font-size: 0.83em;
  font-weight: 520;
  letter-spacing: 0;
  text-decoration: none;
  text-underline-offset: 0;
}

.term-supp-link:visited {
  color: var(--text-tertiary);
}

.term-supp-link:hover {
  color: var(--link-hover);
  border-color: rgba(30, 77, 132, 0.38);
  background: rgba(255, 255, 255, 0.9);
}

.term-supp-link:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.term-supp-link:active {
  color: var(--link-active);
  border-color: rgba(18, 59, 99, 0.46);
}

.nav {
  margin-top: 1.1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.6rem;
}

.nav-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 0.7rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  color: var(--text-primary);
  background: var(--surface-soft);
  box-shadow: 0 1px 0 rgba(32, 36, 43, 0.08);
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease, box-shadow 140ms ease;
  font-weight: 600;
  font-size: 0.95rem;
}

.nav-btn:visited {
  color: var(--text-primary);
}

.nav-btn:hover {
  transform: translateY(-1px);
  border-color: var(--link);
  color: var(--link-hover);
  background: var(--surface-emphasis);
  box-shadow: 0 3px 12px rgba(30, 77, 132, 0.14);
}

.nav-btn:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-color: var(--link);
  color: var(--link-hover);
  background: var(--surface-emphasis);
}

.nav-btn:active {
  transform: translateY(0);
  border-color: var(--link-hover);
  color: var(--link-active);
  background: linear-gradient(120deg, rgba(47, 93, 138, 0.18), rgba(168, 88, 47, 0.14));
  box-shadow: inset 0 1px 2px rgba(23, 28, 36, 0.12);
}

.nav-btn.active {
  border-color: var(--link-hover);
  color: var(--heading);
  box-shadow: inset 0 0 0 1px rgba(47, 93, 138, 0.26), 0 2px 8px rgba(30, 77, 132, 0.12);
  background: linear-gradient(120deg, rgba(47, 93, 138, 0.16), rgba(168, 88, 47, 0.12));
}

.nav-btn.active[aria-current="page"] {
  font-weight: 700;
}

/* Nav labels must not use []-derived tag emphasis. */
.nav-btn :is([class^="tag-"], [class*=" tag-"]) {
  color: inherit;
  background: none;
  font-weight: inherit;
  border: 0;
  box-shadow: none;
  padding: 0;
  margin: 0;
  border-radius: 0;
  letter-spacing: inherit;
  text-decoration: inherit;
  box-decoration-break: slice;
  -webkit-box-decoration-break: slice;
}

.back-to-top {
  position: fixed;
  right: clamp(0.7rem, 2.2vw, 1.35rem);
  bottom: calc(0.7rem + env(safe-area-inset-bottom, 0px));
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  min-height: 2.35rem;
  padding: 0.48rem 0.66rem;
  border: 1px solid rgba(32, 36, 43, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 680;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(23, 28, 36, 0.16);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(0.5rem);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  border-color: var(--link);
  background: var(--surface-emphasis);
  color: var(--link-hover);
}

.back-to-top:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-color: var(--link);
}

.back-to-top:active {
  color: var(--link-active);
  border-color: var(--link-hover);
}

.back-to-top__icon {
  font-size: 1.05rem;
  line-height: 1;
}

.section-jump {
  margin-top: var(--space-block-md);
  padding-top: 0.62rem;
  border-top: 1px dashed rgba(32, 36, 43, 0.2);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  max-inline-size: min(100%, var(--list-line-max));
}

.section-jump__link {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.16rem;
  min-height: 2.48rem;
  padding: 0.44rem 0.56rem;
  border-radius: 10px;
  border: 1px solid rgba(32, 36, 43, 0.16);
  background: rgba(255, 255, 255, 0.84);
  color: var(--text-primary);
  text-decoration: none;
}

.section-jump__label {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.015em;
  line-height: 1.15;
  color: var(--text-secondary);
}

.section-jump__text {
  font-size: 0.88rem;
  font-weight: 590;
  line-height: 1.36;
}

.section-jump__link:hover {
  border-color: rgba(47, 93, 138, 0.42);
  background: rgba(255, 255, 255, 0.95);
  color: var(--link-hover);
  box-shadow: 0 2px 10px rgba(30, 77, 132, 0.08);
}

.section-jump__link:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.section-jump__link:active {
  color: var(--link-active);
}

.toc-panel {
  border-left-color: rgba(47, 93, 138, 0.42);
}

.toc-panel .toc-nav {
  margin-top: var(--space-block-sm);
}

.toc-panel .toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12.8rem, 1fr));
  gap: 0.5rem 0.62rem;
  max-inline-size: min(100%, var(--list-line-max));
}

.toc-panel .toc-list li {
  margin: 0;
  padding: 0;
}

.toc-panel .toc-list a {
  display: block;
  min-height: 2.3rem;
  padding: 0.46rem 0.62rem;
  border-radius: 10px;
  border: 1px solid rgba(32, 36, 43, 0.16);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text-primary);
  font-size: 0.93rem;
  font-weight: 560;
  line-height: 1.42;
  text-decoration: none;
  text-underline-offset: 0;
}

.toc-panel .toc-list a:visited {
  color: var(--text-primary);
}

.toc-panel .toc-list a:hover {
  border-color: rgba(47, 93, 138, 0.4);
  background: rgba(255, 255, 255, 0.95);
  color: var(--link-hover);
  box-shadow: 0 2px 10px rgba(30, 77, 132, 0.08);
  text-decoration: none;
}

.toc-panel .toc-list a.is-current,
.toc-panel .toc-list a[aria-current="location"] {
  border-color: rgba(47, 93, 138, 0.52);
  background: linear-gradient(120deg, rgba(47, 93, 138, 0.2), rgba(168, 88, 47, 0.12));
  color: var(--heading);
  box-shadow: inset 0 0 0 1px rgba(47, 93, 138, 0.28), 0 2px 10px rgba(30, 77, 132, 0.12);
  font-weight: 700;
}

.toc-panel .toc-list a:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-color: rgba(47, 93, 138, 0.48);
}

.toc-panel .toc-list a:active {
  color: var(--link-active);
  background: rgba(240, 246, 252, 0.95);
}

@media (prefers-reduced-motion: reduce) {
  .nav-btn {
    transition: none;
  }

  .back-to-top {
    transition: none;
  }

  .section-jump__link {
    transition: none;
  }

  .nav-btn:hover,
  .nav-btn:active {
    transform: none;
  }
}

.panel {
  position: relative;
  margin-top: var(--space-chapter-md);
  padding: var(--space-block-lg) 1.35rem;
  border: 1px solid var(--line);
  border-left: 4px solid rgba(47, 93, 138, 0.3);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--surface-emphasis), var(--surface-soft));
  box-shadow: var(--panel-shadow);
}

.panel:nth-of-type(even) {
  border-left-color: rgba(168, 88, 47, 0.3);
  background: linear-gradient(180deg, var(--surface-soft), var(--surface-emphasis));
}

main.wrap > .panel + .panel {
  position: relative;
}

main.wrap > .panel + .panel::before {
  content: "";
  position: absolute;
  left: 0.3rem;
  right: 0.3rem;
  top: calc(var(--space-chapter-md) * -0.52);
  height: 1px;
  background: linear-gradient(
    90deg,
    rgba(32, 36, 43, 0),
    rgba(47, 93, 138, 0.22) 34%,
    rgba(168, 88, 47, 0.22) 66%,
    rgba(32, 36, 43, 0)
  );
  pointer-events: none;
}

.era-divider {
  display: flex;
  align-items: center;
  gap: 0.72rem;
  margin: var(--space-chapter-lg) 0 var(--space-chapter-sm);
}

.era-divider::before,
.era-divider::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(
    90deg,
    rgba(32, 36, 43, 0),
    rgba(47, 93, 138, 0.32) 30%,
    rgba(168, 88, 47, 0.32) 70%,
    rgba(32, 36, 43, 0)
  );
}

.era-divider__label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.24rem 0.72rem 0.2rem;
  border-radius: 999px;
  border: 1px solid rgba(32, 36, 43, 0.2);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.9));
  color: var(--heading);
  font-size: 0.84rem;
  font-weight: 750;
  letter-spacing: 0.015em;
  line-height: 1;
  box-shadow: 0 2px 10px rgba(23, 28, 36, 0.08);
  white-space: nowrap;
}

.era-divider + .panel {
  margin-top: var(--space-chapter-sm);
}

.era-divider--ancient .era-divider__label {
  border-color: rgba(47, 93, 138, 0.36);
}

.era-divider--middle .era-divider__label {
  border-color: rgba(91, 74, 46, 0.36);
}

.era-divider--renaissance .era-divider__label {
  border-color: rgba(122, 63, 83, 0.34);
}

.era-divider--baroque .era-divider__label {
  border-color: rgba(138, 63, 31, 0.34);
}

.era-divider--classical .era-divider__label {
  border-color: rgba(31, 106, 100, 0.34);
}

.era-divider--romantic .era-divider__label {
  border-color: rgba(95, 62, 138, 0.34);
}

.era-divider--twentieth .era-divider__label {
  border-color: rgba(47, 93, 138, 0.34);
}

.era-divider--profiles .era-divider__label {
  border-color: rgba(168, 88, 47, 0.34);
}

/* Task003: define one baseline lane for headings/body in normal rules. */
.panel :is(h2, h3, h4, h5),
.panel.readable p {
  margin-left: 0;
}

.panel h2 {
  padding-left: var(--indent-h2);
}

.panel h2 {
  margin: 0 0 var(--space-chapter-sm);
  padding-bottom: 0.38rem;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-h2);
  font-family: var(--font-heading);
  font-weight: var(--fw-h2);
  letter-spacing: 0.01em;
  color: var(--heading);
}

.panel h3 {
  position: relative;
  margin: var(--space-block-md) 0 var(--space-block-sm);
  padding-left: var(--indent-h3);
  border-left: none;
  font-size: var(--fs-h3);
  font-family: var(--font-heading);
  font-weight: var(--fw-h3);
  letter-spacing: 0.009em;
  color: var(--heading);
  line-height: 1.52;
}

.panel h3::before {
  content: "";
  position: absolute;
  left: max(0px, calc(var(--indent-h3) - 0.52rem));
  top: 0.1em;
  bottom: 0.1em;
  width: 3px;
  border-radius: 999px;
  background: rgba(47, 93, 138, 0.35);
}

.panel:nth-of-type(even) h3 {
  border-left-color: transparent;
}

.panel:nth-of-type(even) h3::before {
  background: rgba(168, 88, 47, 0.35);
}

.panel h4 {
  margin: var(--space-block-sm) 0 0.3rem;
  padding-left: var(--indent-h4);
  font-size: calc(var(--fs-h3) * 0.95);
  font-family: var(--font-body);
  font-weight: 640;
  letter-spacing: 0.008em;
  color: var(--heading);
  line-height: 1.5;
}

.panel h5 {
  margin: 0.34rem 0 0.24rem;
  padding-left: var(--indent-h5);
  font-size: calc(var(--fs-h3) * 0.9);
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: 0.007em;
  color: var(--text-secondary);
  line-height: 1.5;
}

.panel.readable p {
  margin: 0;
  padding-left: var(--indent-body);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: var(--fw-body);
  color: var(--text-primary);
  line-height: var(--body-leading);
  letter-spacing: var(--body-tracking);
  max-inline-size: var(--readable-max);
}

.panel.readable p + p {
  margin-top: 0;
}

.panel.readable p:last-child {
  margin-bottom: 0;
}

/* Country summary page: stabilize nested unit blocks generated from s3 output. */
.panel.readable[data-big-section] > :is(h2, h3, h4, h5, .unit) {
  max-inline-size: var(--readable-max);
  margin-inline: auto;
}

.panel.readable[data-big-section] > .unit {
  margin-top: 0.36rem;
  margin-bottom: 0.9rem;
}

.panel.readable[data-big-section] > .unit:empty {
  display: none;
}

.panel.readable[data-big-section] .unit > br {
  display: none;
}

.panel.readable[data-big-section] .unit > :is(p, ul, ol, table, .keyword-table, .list-wide) {
  max-inline-size: 100%;
  margin: 0;
}

.panel.readable[data-big-section] .unit > :is(p, ul, ol, table, .keyword-table, .list-wide) + :is(p, ul, ol, table, .keyword-table, .list-wide) {
  margin-top: 0.55rem;
}

.hero .lead,
.panel p.lead {
  margin-top: var(--space-block-sm);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  color: var(--text-secondary);
  font-weight: 520;
  line-height: 1.75;
}

.hero .page-purpose {
  margin-top: 0.42rem;
}

.update-meta {
  margin-top: 0.74rem;
  padding: 0.5rem 0.56rem;
  border-radius: 10px;
  border: 1px solid rgba(32, 36, 43, 0.23);
  background: rgba(255, 255, 255, 0.7);
  max-inline-size: var(--readable-max);
  display: grid;
  gap: 0.3rem;
}

.update-item {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.44rem;
}

.update-label {
  display: inline-block;
  min-width: 4.2rem;
  font-size: 0.79rem;
  font-weight: 760;
  letter-spacing: 0.01em;
  color: var(--heading);
}

.update-value {
  font-size: 0.89rem;
  font-weight: 540;
  color: var(--text-secondary);
}

.role-meta {
  margin-top: 0.68rem;
  padding: 0.52rem 0.58rem;
  border-radius: 10px;
  border: 1px solid rgba(32, 36, 43, 0.23);
  background: rgba(255, 255, 255, 0.74);
  max-inline-size: var(--readable-max);
  display: grid;
  gap: 0.3rem;
}

.role-item {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.44rem;
}

.role-label {
  display: inline-block;
  min-width: 4.2rem;
  font-size: 0.79rem;
  font-weight: 760;
  letter-spacing: 0.01em;
  color: var(--heading);
}

.role-value {
  font-size: 0.89rem;
  font-weight: 540;
  color: var(--text-secondary);
}

.panel p.meta {
  margin-top: var(--space-block-sm);
  font-family: var(--font-body);
  color: var(--text-secondary);
  font-size: var(--fs-meta);
  font-weight: var(--fw-meta);
  line-height: 1.75;
}

.panel p.summary {
  font-weight: 520;
}

.panel p.summary .term {
  font-weight: 680;
}

.panel p.summary .term-major {
  font-weight: 800;
  letter-spacing: 0.015em;
}

.info-label {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  margin-right: 0.4rem;
  margin-bottom: 0.1rem;
  padding: 0.16rem 0.5rem 0.14rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.78rem;
  line-height: 1;
  font-weight: 740;
  letter-spacing: 0.01em;
  vertical-align: baseline;
  white-space: nowrap;
}

.info-label .label-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55rem;
  padding: 0.04rem 0.22rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 0.64rem;
  font-weight: 760;
  line-height: 1;
  letter-spacing: 0.02em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.info-label .label-text {
  display: inline-block;
}

.info-label.label-context {
  color: #2f5d8a;
  background: rgba(47, 93, 138, 0.13);
  border-color: rgba(47, 93, 138, 0.28);
}

.info-label.label-person {
  color: #7a3f53;
  background: rgba(122, 63, 83, 0.12);
  border-color: rgba(122, 63, 83, 0.28);
}

.info-label.label-work {
  color: #6f4b16;
  background: rgba(169, 126, 42, 0.12);
  border-color: rgba(169, 126, 42, 0.28);
}

.info-label.label-technique {
  color: #5f3e8a;
  background: rgba(95, 62, 138, 0.12);
  border-color: rgba(95, 62, 138, 0.28);
}

.info-label.label-term {
  color: #1f6a64;
  background: rgba(31, 106, 100, 0.12);
  border-color: rgba(31, 106, 100, 0.28);
}

.info-label.label-instrument {
  color: #8a3f1f;
  background: rgba(138, 63, 31, 0.12);
  border-color: rgba(138, 63, 31, 0.28);
}

.info-label.label-overview {
  color: #5b4a2e;
  background: rgba(91, 74, 46, 0.12);
  border-color: rgba(91, 74, 46, 0.26);
}

.panel p.keyword-list {
  margin-top: var(--space-block-sm);
  font-family: var(--font-body);
  color: var(--text-secondary);
  font-size: var(--fs-note);
  font-weight: 500;
  line-height: 1.78;
  word-break: break-word;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(32, 36, 43, 0.12);
  border-radius: 12px;
  padding: 0.58rem 0.7rem;
  max-inline-size: none;
  width: 100%;
  max-inline-size: min(100%, var(--list-line-max));
  overflow-x: auto;
  overflow-y: hidden;
  text-wrap: pretty;
  column-width: 14.5rem;
  column-gap: 0.94rem;
  column-fill: balance;
}

.panel p.note {
  margin-top: var(--space-block-sm);
  font-family: var(--font-body);
  color: var(--text-tertiary);
  font-size: var(--fs-note);
  font-weight: var(--fw-note);
  line-height: 1.84;
}

.panel :is(ul, ol, table, .keyword-table, .panel-fold, .list-wide) {
  max-inline-size: none;
  width: 100%;
}

/* Align body lists to the same text lane as paragraph body ("q baseline"). */
.panel.readable > :is(ul, ol),
.panel.readable[data-big-section] .unit > :is(ul, ol) {
  margin: 0;
  padding-inline-start: var(--indent-body);
  list-style-position: outside;
  max-inline-size: var(--readable-max);
}

/* Task59: dedicated list/table/timeline rendering rules. */
.panel :is(.list-scroll, .table-scroll, .timeline-scroll) {
  width: 100%;
  max-inline-size: min(100%, var(--list-line-max));
  margin-top: var(--space-block-sm);
  margin-inline: auto;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border: 1px solid rgba(32, 36, 43, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
}

.panel :is(.list-scroll, .table-scroll, .timeline-scroll) > :is(table, .keyword-table, .timeline-table) {
  width: max(100%, 44rem);
  border-collapse: collapse;
  table-layout: fixed;
  margin: 0;
}

.panel :is(.list-scroll, .table-scroll, .timeline-scroll) th,
.panel :is(.list-scroll, .table-scroll, .timeline-scroll) td {
  min-width: var(--table-col-min);
  padding: 0.5rem 0.56rem;
  border-bottom: 1px solid rgba(32, 36, 43, 0.12);
  text-align: left;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
}

.panel :is(.list-scroll, .table-scroll, .timeline-scroll) tr:last-child td {
  border-bottom: none;
}

.panel .timeline-scroll .col-date {
  width: var(--timeline-date-col);
  min-width: var(--timeline-date-col);
  font-weight: 650;
}

.panel-dense {
  border-left-width: 5px;
}

.panel-fold {
  margin-top: var(--space-block-sm);
  padding: 0.52rem 0.64rem 0.6rem;
  border: 1px dashed rgba(32, 36, 43, 0.22);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
}

.panel-fold > summary {
  cursor: pointer;
  color: var(--heading);
  font-size: 0.92rem;
  font-weight: 680;
  letter-spacing: 0.01em;
  list-style: none;
}

.panel-fold > summary::-webkit-details-marker {
  display: none;
}

.panel-fold > summary::before {
  content: "＋ ";
  color: var(--accent-2);
  font-weight: 760;
}

.panel-fold[open] > summary {
  margin-bottom: var(--space-block-sm);
}

.panel-fold[open] > summary::before {
  content: "− ";
  color: var(--accent);
}

.panel-fold--keywords {
  border-style: solid;
  border-color: rgba(31, 106, 100, 0.26);
  background: rgba(255, 255, 255, 0.88);
}

.panel-fold--keywords > summary {
  color: #1f6a64;
}

.panel-fold--note {
  border-color: rgba(91, 100, 114, 0.26);
}

@media (min-width: 1200px) {
  .page-shell {
    width: min(var(--desktop-shell-max), 94vw);
    padding-inline: clamp(1rem, 2.4vw, 2.2rem);
  }

  .panel {
    padding-inline: var(--desktop-panel-pad-x);
  }

  .panel.readable > :is(h2, h3, h4, h5, p, .panel-fold, ul, ol, table, .keyword-table, .list-wide) {
    margin-inline: auto;
  }

  .panel.readable > :is(h2, h3, h4, h5, p, .meta, .summary, .lead, .note) {
    /* Keep one shared lane origin on wide screens to prevent heading depth inversion. */
    width: 100%;
    max-width: var(--desktop-content-max);
    margin-inline: 0;
  }

  .panel.readable > :is(ul, ol, .panel-fold) {
    max-inline-size: min(100%, var(--desktop-content-max));
    width: min(100%, var(--desktop-content-max));
  }

  .panel.readable > .panel-fold.panel-fold--keywords {
    max-inline-size: min(100%, var(--desktop-list-max));
    width: min(100%, var(--desktop-list-max));
  }

  .panel.readable > :is(table, .keyword-table, .list-wide, p.keyword-list) {
    max-inline-size: min(100%, var(--desktop-list-max));
    width: min(100%, var(--desktop-list-max));
  }

  /* Optional two-lane layout for future side notes on wide screens. */
  .panel.readable.layout-two-lane {
    display: grid;
    grid-template-columns: minmax(0, var(--desktop-content-max)) minmax(220px, 1fr);
    column-gap: clamp(1rem, 1.7vw, 1.6rem);
    align-items: start;
  }

  .panel.readable.layout-two-lane > * {
    grid-column: 1;
    margin-inline: 0;
  }

  .panel.readable.layout-two-lane > .aside-note {
    grid-column: 2;
    align-self: start;
    margin-top: 0;
  }
}

@media (max-width: 840px) {
  :root {
    --space-chapter-md: 1.25rem;
    --space-chapter-lg: 2.15rem;
    --paragraph-gap: 0.7rem;
    --fs-h1: clamp(1.5rem, 4.3vw, 2rem);
    --fs-h2: clamp(1.16rem, 2.7vw, 1.35rem);
    --fs-h3: clamp(1.02rem, 2.1vw, 1.12rem);
    --fs-meta: 0.94rem;
    --fs-note: 0.9rem;
  }

  body::before,
  body::after {
    opacity: 0.45;
    filter: blur(12px);
  }

  .nav {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .toc-panel .toc-list {
    grid-template-columns: repeat(2, minmax(10.8rem, 1fr));
  }

  .hero,
  .panel {
    background: rgba(255, 255, 255, 0.95);
  }

  .panel p.keyword-list {
    background: rgba(255, 255, 255, 0.93);
    column-width: 12.6rem;
    column-gap: 0.72rem;
  }

  main.wrap > .panel + .panel::before {
    left: 0.18rem;
    right: 0.18rem;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .page-shell {
    width: min(98vw, 1120px);
    padding-inline: clamp(0.62rem, 1.6vw, 1.08rem);
  }

  .hero {
    padding: 1.24rem 1.08rem;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.52rem;
  }

  .nav-btn {
    min-height: 2.72rem;
    padding: 0.52rem 0.44rem;
    font-size: 0.9rem;
    line-height: 1.32;
    white-space: normal;
    text-wrap: balance;
  }

  .panel {
    padding: 1.02rem 1rem;
  }

  .panel.readable > :is(h2, h3, h4, h5, p, .meta, .summary, .lead, .note, ul, ol, table, .keyword-table, .panel-fold, .list-wide) {
    inline-size: 100%;
    max-inline-size: 100%;
  }

  .panel h2,
  .panel h3,
  .panel h4,
  .panel h5 {
    text-wrap: balance;
    overflow-wrap: anywhere;
  }

  .panel p.meta,
  .panel p.note,
  .panel p.keyword-list {
    overflow-wrap: anywhere;
  }

  .era-divider {
    gap: 0.56rem;
  }

  .era-divider__label {
    font-size: 0.8rem;
    padding: 0.22rem 0.62rem 0.18rem;
  }
}

@media (max-width: 480px) {
  .page-shell {
    width: 100%;
    padding-inline: 0.38rem;
  }

  .hero {
    padding: 1rem 0.82rem;
    border-radius: 14px;
  }

  .panel {
    margin-top: 0.96rem;
    padding: 0.86rem 0.74rem;
    border-radius: 13px;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.42rem;
  }

  .toc-panel .toc-list {
    grid-template-columns: 1fr;
    gap: 0.42rem;
  }

  .section-jump {
    grid-template-columns: 1fr;
    gap: 0.42rem;
  }

  .section-jump__link {
    min-height: 2.24rem;
    padding: 0.4rem 0.5rem;
  }

  .back-to-top {
    right: 0.56rem;
    bottom: calc(0.56rem + env(safe-area-inset-bottom, 0px));
    min-height: 2.16rem;
    padding: 0.42rem 0.58rem;
    font-size: 0.82rem;
  }

  .toc-panel .toc-list a {
    min-height: 2.14rem;
    padding: 0.42rem 0.52rem;
    font-size: 0.9rem;
  }

  .nav-btn {
    min-height: 2.54rem;
    padding: 0.46rem 0.38rem;
    font-size: 0.86rem;
    line-height: 1.28;
    white-space: normal;
    text-wrap: balance;
    overflow-wrap: anywhere;
  }

  .panel.readable > :is(h2, h3, h4, h5, p, .meta, .summary, .lead, .note, ul, ol, table, .keyword-table, .panel-fold, .list-wide) {
    max-inline-size: 100%;
    width: 100%;
  }

  .panel h2,
  .panel h3,
  .panel h4,
  .panel h5,
  .panel.readable p,
  .panel p.meta,
  .panel p.note,
  .panel p.keyword-list,
  .info-label {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .panel p.keyword-list {
    margin-top: 0.46rem;
    padding: 0.5rem 0.56rem;
    line-height: 1.82;
    letter-spacing: 0.002em;
    column-width: auto;
    columns: 1;
  }

  .panel :is(table, .keyword-table) {
    display: block;
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }

  .panel.readable > :is(ul, ol),
  .panel.readable[data-big-section] .unit > :is(ul, ol) {
    padding-inline-start: var(--indent-body);
  }

  .panel :is(.list-scroll, .table-scroll, .timeline-scroll) > :is(table, .keyword-table, .timeline-table) {
    width: max(100%, 34rem);
  }

  .panel :is(.list-scroll, .table-scroll, .timeline-scroll) th,
  .panel :is(.list-scroll, .table-scroll, .timeline-scroll) td {
    min-width: 7.6rem;
  }

  .era-divider {
    gap: 0.4rem;
  }

  .era-divider__label {
    max-width: 100%;
    text-wrap: balance;
  }
}

@media (max-width: 430px) {
  :root {
    --space-chapter-sm: 0.5rem;
    --space-chapter-md: 1.05rem;
    --space-chapter-lg: 1.8rem;
    --space-block-sm: 0.42rem;
    --space-block-md: 0.8rem;
    --space-block-lg: 1.05rem;
    --body-leading: 1.8;
    --body-tracking: 0.009em;
    --paragraph-gap: 0.64rem;
    --fs-h1: clamp(1.35rem, 6vw, 1.72rem);
    --fs-h2: clamp(1.08rem, 4.7vw, 1.25rem);
    --fs-h3: clamp(0.98rem, 4.1vw, 1.08rem);
    --fs-body: 0.98rem;
    --fs-meta: 0.91rem;
    --fs-note: 0.88rem;
  }

  body::before,
  body::after {
    display: none;
  }

  .panel p.note {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.92);
    border-radius: 10px;
    padding: 0.44rem 0.56rem;
  }

  .scope-list li {
    padding: 0.28rem 0.44rem;
    gap: 0.34rem;
  }

  .scope-label {
    min-width: 4.3rem;
    font-size: 0.75rem;
  }

  .scope-value {
    font-size: 0.84rem;
  }

  .update-meta {
    margin-top: 0.62rem;
    padding: 0.42rem 0.48rem;
    gap: 0.24rem;
  }

  .update-label {
    min-width: 3.9rem;
    font-size: 0.74rem;
  }

  .update-value {
    font-size: 0.82rem;
  }

  .panel p.summary .term,
  .panel p.summary .term-major {
    padding: 0 0.18em;
  }

  .panel :is(.tag-attr, .tag-person, .tag-instrument, .tag-music, .tag-concept, .tag-technique, .tag-event, .tag-school) {
    padding: 0 0.16em;
    border-radius: 0.24em;
  }

  .panel .tag-other-strong {
    font-weight: 720;
  }

  .info-label {
    font-size: 0.72rem;
    padding: 0.13rem 0.42rem 0.12rem;
    gap: 0.28rem;
  }

  .info-label .label-icon {
    min-width: 1.35rem;
    font-size: 0.6rem;
  }

  .era-divider {
    margin: var(--space-chapter-lg) 0 var(--space-chapter-sm);
    gap: 0.48rem;
  }

  .era-divider__label {
    padding: 0.2rem 0.56rem 0.17rem;
    font-size: 0.76rem;
  }
}

.tag-uncertain {
  font-weight: 650;
  color: inherit;
  background: transparent;
  border: 1px solid rgba(32, 36, 43, 0.28);
  border-radius: 0.24em;
  padding: 0 0.18em;
  box-shadow: none;
  text-decoration: none;
}

/* Glossary page visual refinement: term/description side-by-side cards. */
#glossary-root .glossary-list {
  display: grid;
  grid-template-columns: minmax(11rem, 14rem) minmax(0, 1fr);
  column-gap: 0.8rem;
  row-gap: 0.62rem;
  margin-top: 0.9rem;
  align-items: stretch;
}

#glossary-root .glossary-list dt,
#glossary-root .glossary-list dd {
  margin: 0;
}

#glossary-root .glossary-list dt {
  display: flex;
  align-items: center;
  padding: 0.46rem 0.62rem;
  border-radius: 10px;
  border: 1px solid rgba(31, 48, 74, 0.14);
  border-left: 4px solid rgba(31, 48, 74, 0.42);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 250, 255, 0.96));
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.5;
}

#glossary-root .glossary-list dd {
  padding: 0.48rem 0.72rem;
  border-radius: 10px;
  border: 1px solid rgba(31, 48, 74, 0.12);
  background: rgba(255, 255, 255, 0.94);
  color: var(--text-primary);
  line-height: 1.85;
}

#glossary-root .glossary-list dt:hover,
#glossary-root .glossary-list dd:hover {
  border-color: rgba(31, 48, 74, 0.24);
}

/* Flash the targeted glossary term when arriving via hash link. */
#glossary-root .glossary-list dt[id] {
  scroll-margin-top: 1rem;
}

#glossary-root .glossary-list dt:target {
  animation: glossary-target-flash-term 2.2s ease-out 1;
}

#glossary-root .glossary-list dt:target + dd {
  animation: glossary-target-flash-desc 2.2s ease-out 1;
}

@keyframes glossary-target-flash-term {
  0% {
    border-color: rgba(245, 158, 11, 0.96);
    border-left-color: rgba(245, 158, 11, 0.96);
    background: linear-gradient(180deg, rgba(255, 251, 235, 0.98), rgba(255, 247, 218, 0.98));
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
  }
  30% {
    border-color: rgba(245, 158, 11, 0.98);
    border-left-color: rgba(245, 158, 11, 0.98);
    background: linear-gradient(180deg, rgba(255, 251, 235, 0.98), rgba(255, 247, 218, 0.98));
    box-shadow: 0 0 0 0.52rem rgba(245, 158, 11, 0.22);
  }
  100% {
    border-color: rgba(31, 48, 74, 0.14);
    border-left-color: rgba(31, 48, 74, 0.42);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 250, 255, 0.96));
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
  }
}

@keyframes glossary-target-flash-desc {
  0% {
    border-color: rgba(245, 158, 11, 0.9);
    background: rgba(255, 251, 235, 0.96);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
  }
  30% {
    border-color: rgba(245, 158, 11, 0.95);
    background: rgba(255, 251, 235, 0.96);
    box-shadow: 0 0 0 0.42rem rgba(245, 158, 11, 0.16);
  }
  100% {
    border-color: rgba(31, 48, 74, 0.12);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  #glossary-root .glossary-list dt:target,
  #glossary-root .glossary-list dt:target + dd {
    animation: none;
    border-color: rgba(245, 158, 11, 0.72);
  }
}

@media (max-width: 860px) {
  #glossary-root .glossary-list {
    grid-template-columns: 1fr;
    row-gap: 0.38rem;
  }

  #glossary-root .glossary-list dt {
    margin-top: 0.32rem;
  }

  #glossary-root .glossary-list dd {
    margin-bottom: 0.4rem;
  }
}

/* Task004: final guard - no emphasis decorations inside headings on any breakpoint. */
.panel :is(h1, h2, h3, h4, h5, h6):is([class^="tag-"], [class*=" tag-"]),
.panel :is(h1, h2, h3, h4, h5, h6) :is([class^="tag-"], [class*=" tag-"], strong, b) {
  color: inherit;
  background: none;
  font-weight: inherit;
  border: 0;
  box-shadow: none;
  padding: 0;
  margin: 0;
  border-radius: 0;
  letter-spacing: inherit;
  text-decoration: inherit;
  box-decoration-break: slice;
  -webkit-box-decoration-break: slice;
}

/* TASK55: inline instrument gallery shown below first-occurrence paragraphs. */
.instrument-inline-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 0.72rem;
  margin: 0.52rem 0 0.92rem;
  align-items: flex-start;
}

.instrument-inline-card {
  margin: 0;
  padding: 0.34rem;
  border-radius: 12px;
  border: 1px solid rgba(32, 36, 43, 0.16);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 3px 10px rgba(23, 28, 36, 0.08);
}

.instrument-inline-card a {
  display: inline-block;
  color: inherit;
  text-decoration: none;
}

.instrument-inline-card img {
  display: block;
  width: 176px;
  height: 118px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(32, 36, 43, 0.18);
}

.instrument-inline-card figcaption {
  margin-top: 0.34rem;
  text-align: center;
  font-size: 0.86rem;
  font-weight: 620;
  line-height: 1.4;
  color: var(--text-primary);
}

@media (min-width: 768px) and (max-width: 1024px) {
  .instrument-inline-card img {
    width: 152px;
    height: 102px;
  }
}

@media (max-width: 767px) {
  .instrument-inline-gallery {
    gap: 0.58rem;
  }

  .instrument-inline-card {
    width: 100%;
    max-width: 320px;
    margin-inline: auto;
  }

  .instrument-inline-card img {
    width: 100%;
    max-width: 320px;
    height: auto;
  }
}

/* Final guard: keep bullet lines on the same lane as body paragraphs on all viewports.
   Exclude TOC panel lists (navigation layout). */
.panel.readable:not(.toc-panel) ul,
.panel.readable[data-big-section] .unit ul {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: var(--readable-max);
  list-style: none;
}

.panel.readable:not(.toc-panel) ul > li,
.panel.readable[data-big-section] .unit ul > li {
  margin: 0;
  padding-inline-start: var(--indent-body);
  line-height: var(--body-leading);
  letter-spacing: var(--body-tracking);
}

.panel.readable:not(.toc-panel) ul > li::before,
.panel.readable[data-big-section] .unit ul > li::before {
  content: "・ ";
}
