:root {
  --surface-page: #eef0f3;
  --surface-chrome: #eceef1;
  --surface-sunken: #f4f6f8;
  --surface-panel: #ffffff;
  --text: #14171c;
  --text-muted: #5b6270;
  --text-faint: #98a0ad;
  --line: #d5d9df;
  --line-strong: #b9c0ca;
  --accent: #185fa5;
  --accent-line: #85b7eb;
  --accent-bg: #f2f7fd;
  --accent-bg-strong: #dfeafa;
  --danger: #a32d2d;
  --danger-line: #e24b4a;
  --danger-bg: #fceceb;
  --attention: #ba7517;
  --attention-line: #ef9f27;
  --attention-bg: #faeeda;
  --shadow: rgb(20 23 28 / 18%);
  --font-verse: "EB Garamond", "Times New Roman", serif;
  --font-ui: system-ui, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
}
body {
  margin: 2rem auto;
  max-width: 82rem;
  padding: 0 1.25rem 3rem;
  background: var(--surface-page);
  color: var(--text);
  font-family: var(--font-ui);
}
#masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}
h1 {
  --metrice-title-size: 1.1rem;
  flex: 0 0 auto;
  font-family: var(--font-verse);
  font-weight: 500;
  font-size: var(--metrice-title-size);
  letter-spacing: 0.01em;
  margin: 0;
  text-decoration: underline;
}
.metrice-domain {
  color: inherit;
}
.metrice-domain-cosmetic {
  font-size: 0;
}
.metrice-domain-cosmetic::after {
  content: attr(data-display);
  font-size: var(--metrice-title-size);
}
.metrice-domain-suffix {
  color: var(--text-faint);
}
.hex-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2.25rem 19rem;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--line);
  background: var(--surface-panel);
  min-height: 8rem;
}
#editor {
  min-width: 0;
  border: none;
  background: transparent;
  min-height: 8rem;
}
#note-markers {
  position: relative;
  border-left: 1px solid var(--line);
  background: var(--surface-page);
}
.hex-note-marker {
  position: absolute;
  left: 50%;
  width: 1.4rem;
  height: 1.4rem;
  transform: translate(-50%, -50%);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-panel);
  color: var(--text-muted);
  padding: 0;
  font: 650 11px/1 var(--font-ui);
  cursor: pointer;
}
.hex-note-marker[data-priority="review"] {
  border-color: var(--attention-line);
  background: var(--attention-bg);
  color: var(--attention);
}
.hex-note-marker[data-priority="marked"] {
  border-color: var(--line-strong);
  background: var(--surface-panel);
  color: var(--text-muted);
}
/*
 * A rarity marker is a small ring, but it keeps the full 1.4rem hit target:
 * the button itself goes invisible and the ring is drawn decoratively, so the
 * thing a reader clicks stays the size every other marker is.
 */
.hex-note-marker[data-rarity] {
  border-color: transparent;
  background: transparent;
}
.hex-note-marker[data-rarity]::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  box-sizing: border-box;
  width: 0.72rem;
  height: 0.72rem;
  transform: translate(-50%, -50%);
  border: 1.5px solid var(--attention-line);
  border-radius: 999px;
  background: transparent;
}
.hex-note-marker[data-rarity="super-rare"]::after {
  border-color: var(--attention);
  background: var(--attention);
  box-shadow: 0 0 0 3px var(--attention-bg);
}
.hex-note-marker[data-severity="error"] {
  border-color: var(--danger-line);
  background: var(--danger-bg);
  color: var(--danger);
}
.hex-note-marker[data-scan-status="loading"] {
  border-style: dashed;
  color: var(--text-faint);
}
.hex-note-marker[data-scan-status="fallback"] {
  border-color: var(--text-faint);
  color: var(--text-faint);
}
.hex-note-marker[aria-current="true"] {
  box-shadow: 0 0 0 2px var(--surface-panel), 0 0 0 4px var(--accent);
}
.hex-note-marker:hover {
  border-color: var(--text-muted);
  box-shadow: 0 1px 3px var(--shadow);
}
/*
 * Hover and active-verse cues follow the ring rather than the invisible hit
 * target, and keep the super-rare halo instead of replacing it.
 */
.hex-note-marker[data-rarity]:hover,
.hex-note-marker[data-rarity][aria-current="true"] {
  border-color: transparent;
  box-shadow: none;
}
.hex-note-marker[data-rarity]:hover::after {
  border-color: var(--text-muted);
  box-shadow: 0 1px 3px var(--shadow);
}
.hex-note-marker[data-rarity="super-rare"]:hover::after {
  border-color: var(--attention);
  box-shadow: 0 0 0 3px var(--attention-bg), 0 1px 3px var(--shadow);
}
.hex-note-marker[data-rarity][aria-current="true"]::after {
  box-shadow: 0 0 0 2px var(--surface-panel), 0 0 0 4px var(--accent);
}
.hex-note-marker[data-rarity="super-rare"][aria-current="true"]::after {
  box-shadow:
    0 0 0 2px var(--surface-panel),
    0 0 0 4px var(--accent),
    0 0 0 7px var(--attention-bg);
}
.hex-note-marker:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
#feedback-rail {
  position: relative;
  min-width: 0;
  border-left: 1px solid var(--line);
  background: var(--surface-page);
  padding: 0.9rem 0.85rem 1rem;
}
#verse-feedback[hidden] {
  display: none;
}
.hex-diag {
  display: none;
}
@media (min-width: 851px) {
  #verse-feedback.is-tracking-active-verse {
    position: absolute;
    left: 0.85rem;
    right: 0.85rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
  }
}
#verse-feedback.is-tracking-active-verse #verse-feedback-title {
  flex: 0 0 auto;
}
#verse-feedback.is-tracking-active-verse #verse-feedback-content {
  min-height: 0;
  overflow-y: auto;
  overflow-x: clip;
  overscroll-behavior: contain;
  padding-right: 0.2rem;
}
#verse-feedback-title {
  margin: 0 0 0.75rem;
  color: var(--text-muted);
  font: 650 13px/1.25 var(--font-ui);
}
#verse-feedback-content {
  display: grid;
  align-content: start;
  gap: 0.65rem;
}
.hex-note {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  border-radius: 3px;
  padding: 0.15rem 0.25rem;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text);
  margin: 0;
}
.hex-note-copy {
  min-width: 0;
}
.hex-note.is-inspectable {
  cursor: pointer;
}
.hex-note.is-inspectable:hover {
  background: var(--surface-sunken);
}
.hex-note.is-pinned {
  background: var(--accent-bg-strong);
  box-shadow: inset 3px 0 var(--accent);
}
.hex-note.is-pinned:hover {
  background: var(--accent-bg-strong);
}
.hex-note.is-inspectable:focus-visible {
  border-radius: 3px;
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.hex-note-glossary {
  font-style: normal;
  text-decoration: underline dotted;
  text-underline-offset: 0.12rem;
  cursor: help;
}
.hex-note-glossary:focus-visible {
  border-radius: 2px;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.hex-note-glossary-tip {
  position: absolute;
  z-index: 4;
  left: 0;
  top: calc(100% + 0.3rem);
  display: none;
  box-sizing: border-box;
  width: min(18rem, 100%);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface-panel);
  box-shadow: 0 3px 10px var(--shadow);
  color: var(--text-muted);
  padding: 0.4rem 0.5rem;
  font-style: normal;
  font-weight: 400;
  line-height: 1.4;
  text-decoration: none;
}
.hex-note-glossary:hover .hex-note-glossary-tip,
.hex-note-glossary:focus .hex-note-glossary-tip {
  display: block;
}
.hex-note-details,
.hex-note-sources,
.hex-note-scope {
  grid-column: 1 / -1;
}
.hex-note-scope {
  color: var(--text-faint);
  font-size: 11px;
}
.hex-note-details {
  margin-top: 0.1rem;
}
.hex-note-details summary {
  justify-self: start;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}
.hex-note-details p {
  margin: 0.25rem 0 0;
}
.hex-note-sources {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.25rem;
}
.hex-note-source-work {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-faint);
}
.hex-note-source {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface-panel);
  color: var(--text-muted);
  padding: 0.05rem 0.3rem;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  cursor: pointer;
}
.hex-note-source:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
}
.hex-note-source:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.hex-feedback-empty {
  margin: 0;
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.45;
}
.hex-feedback-section {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-panel);
}
.hex-feedback-section + .hex-feedback-section {
  margin-top: 0.5rem;
}
.hex-feedback-section > summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--line);
  border-radius: 3px 3px 0 0;
  color: var(--text-muted);
  font: 650 11px/1.3 var(--font-ui);
  letter-spacing: 0.02em;
  cursor: pointer;
  list-style: none;
}
.hex-feedback-section > summary::-webkit-details-marker {
  display: none;
}
.hex-feedback-section > summary::before {
  content: "\203A";
  display: inline-block;
  width: 0.6rem;
  margin-right: 0.15rem;
  color: var(--text-faint);
  transition: transform 0.12s ease;
}
.hex-feedback-section[open] > summary::before {
  transform: rotate(90deg);
}
.hex-feedback-section:not([open]) > summary {
  border-bottom: 0;
  border-radius: 3px;
}
.hex-feedback-section > summary:hover {
  color: var(--text);
}
.hex-feedback-section > summary:focus-visible {
  border-radius: 2px;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.hex-feedback-section-name {
  flex: 1 1 auto;
}
.hex-feedback-section-count {
  flex: 0 0 auto;
  color: var(--text-faint);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.hex-feedback-section-body {
  display: grid;
  align-content: start;
  gap: 0;
  padding: 0.45rem 0.5rem;
}
.hex-note + .hex-note {
  border-top: 1px solid var(--line);
  margin-top: 0.45rem;
  padding-top: 0.45rem;
}
.hex-note[data-rarity] {
  margin-left: -0.5rem;
  margin-right: -0.5rem;
  padding-left: 0.45rem;
  padding-right: 0.5rem;
  border-left: 3px solid var(--attention-line);
}
.hex-note[data-rarity="super-rare"] {
  border-left-color: var(--attention);
  background: var(--attention-bg);
}
/*
 * Pinning has to keep changing a banded row's fill: the band rules come later
 * in the sheet and match with the same specificity, so say it again here.
 */
.hex-note.is-pinned[data-rarity],
.hex-note.is-pinned[data-rarity]:hover {
  background: var(--accent-bg-strong);
}
.hex-feedback-status {
  margin: 0;
  border-left: 3px solid var(--line-strong);
  padding: 0.35rem 0.5rem;
  background: var(--surface-page);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}
.hex-feedback-status.is-loading {
  border-left-style: dashed;
}
.hex-feedback-status.is-error {
  border-left-color: var(--danger);
  background: var(--danger-bg);
  color: var(--danger);
}
.cm-editor {
  font-family: var(--font-verse);
  font-size: 18px;
  line-height: 1.7;
}
.cm-content {
  font-family: inherit;
  padding: 1rem 1.25rem;
}
.hex-toggles {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1.25rem;
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}
.hex-toggles label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  user-select: none;
}
.hex-toggles select {
  font: inherit;
  color: inherit;
  background: var(--surface-panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
}
.hex-search-box {
  margin-left: auto;
  width: 17rem;
  flex-shrink: 0;
}
#lexicon-search {
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 13px;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-panel);
  color: var(--text);
}
#lexicon-search:focus {
  outline: 2px solid var(--line-strong);
  border-color: var(--line-strong);
}
.hex-lex-results {
  padding: 0.85rem 0.75rem;
  font-size: 13px;
  max-height: calc(100vh - 16rem);
  overflow-y: auto;
}
.hex-lex-item {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}
.hex-lex-header {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-family: var(--font-verse);
  font-size: 16px;
  margin-bottom: 0.2rem;
}
.hex-lex-lemma {
  font-weight: 600;
  color: var(--text);
}
.hex-lex-class {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-faint);
}
.hex-lex-gloss {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  line-height: 1.35;
}
.hex-lex-forms {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.hex-lex-form-btn {
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.25rem 0.45rem;
  cursor: pointer;
  font-size: 12px;
  text-align: left;
  color: var(--text);
  transition: background-color 0.1s ease;
}
.hex-lex-form-btn:hover {
  background: var(--accent-bg);
  border-color: var(--accent);
}
.hex-lex-form-marked {
  font-family: var(--font-verse);
  font-size: 14px;
  font-weight: 500;
}
.hex-lex-form-morph {
  font-size: 10px;
  color: var(--text-faint);
  margin-left: 0.25rem;
}
.hex-lex-empty, .hex-lex-error {
  padding: 0.85rem 0.75rem;
  font-size: 13px;
  color: var(--text-faint);
}
.hex-lex-error {
  color: var(--danger);
}
.hex-analysis-panel {
  margin-top: 1rem;
  border: 1px solid var(--line);
  background: var(--surface-panel);
}
#lower-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}
#feedback-panel,
#winbolt-panel,
#lupton-panel,
#postgate-panel {
  display: grid;
  grid-column: 1;
  grid-row: 2;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--surface-panel);
}
#feedback-panel[hidden] {
  display: none;
}
#feedback-panel {
  z-index: 3;
}
#winbolt-panel,
#lupton-panel,
#postgate-panel {
  z-index: 2;
}
#winbolt-panel.is-inactive,
#lupton-panel.is-inactive,
#postgate-panel.is-inactive {
  z-index: 1;
  pointer-events: none;
}
.hex-panel-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.45rem 0.6rem 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface-chrome);
}
.hex-panel-tab {
  margin-bottom: -1px;
  border: 1px solid transparent;
  border-bottom-color: var(--line);
  border-radius: 5px 5px 0 0;
  background: transparent;
  color: var(--text-muted);
  padding: 0.45rem 0.85rem;
  font: 650 13px var(--font-ui);
  cursor: pointer;
}
.hex-panel-tab:hover {
  background: var(--surface-sunken);
  color: var(--text);
}
.hex-panel-tab[aria-selected="true"] {
  border-color: var(--accent-line);
  border-bottom-color: var(--accent-bg);
  background: var(--accent-bg);
  color: var(--text);
}
.hex-panel-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  position: relative;
  z-index: 1;
}
.hex-analysis-column h2,
#lexicon-word-detail h3 {
  margin: 0;
  font-family: var(--font-verse);
  font-weight: 600;
}
.hex-scan-status {
  color: var(--text-muted);
  font-size: 12px;
  text-align: right;
}
#copy-macronized,
#reformat-verse {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  height: 1.85rem;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface-panel);
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}
#copy-macronized {
  width: 1.85rem;
  padding: 0;
}
#reformat-verse {
  width: auto;
  padding: 0 0.65rem;
  font-size: 13px;
}
#copy-macronized:hover:not(:disabled),
#reformat-verse:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-bg);
}
#copy-macronized:disabled,
#reformat-verse:disabled {
  cursor: default;
  opacity: 0.55;
}
.hex-scan-status.is-loading {
  color: var(--attention);
}
.hex-scan-status.is-error {
  color: var(--danger);
}
.source-reader-status {
  color: var(--text-muted);
  font-size: 12px;
  text-align: right;
}
.source-reader-status.is-loading {
  color: var(--attention);
}
.source-reader-status.is-error {
  color: var(--danger);
  font-weight: 650;
}
.bookreader-shell {
  width: 100%;
  min-height: 0;
  background: var(--surface-sunken);
}
.br-mode-2up__root.bookreader-scroll-extent-guard::after {
  display: block;
  width: var(--bookreader-scroll-extent-x, 0);
  height: var(--bookreader-scroll-extent-y, 0);
  content: " ";
  pointer-events: none;
}
.hex-analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(20rem, 0.9fr);
}
.hex-analysis-column {
  min-width: 0;
  padding: 1rem;
}
.hex-analysis-column + .hex-analysis-column {
  border-left: 1px solid var(--line);
}
.hex-analysis-column h2 {
  font-size: 1rem;
  margin-bottom: 0.65rem;
}
#lexicon-scans {
  display: grid;
  align-content: start;
  gap: 0.55rem;
  max-height: 31rem;
  overflow-y: auto;
  padding-right: 0.25rem;
}
.hex-scan-card {
  display: grid;
  align-content: start;
  gap: 0.45rem;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-panel);
  color: var(--text);
  padding: 0.65rem 0.75rem;
  text-align: left;
  cursor: pointer;
}
.hex-scan-card:hover {
  border-color: var(--line-strong);
  background: var(--accent-bg);
}
.hex-scan-card[aria-pressed="true"] {
  border-color: var(--accent-line);
  box-shadow: inset 3px 0 var(--accent-line);
  background: var(--accent-bg);
}
.hex-scan-card-head {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  color: var(--text-muted);
  font-size: 11px;
}
.hex-scan-card-head .hex-diag {
  margin-left: auto;
}
.hex-scan-card-head strong {
  color: var(--text);
  font-size: 13px;
  letter-spacing: 0.08em;
}
.hex-scan-rank,
.hex-realization-rank {
  color: var(--text-faint);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.04em;
}
.hex-scan-words {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.hex-scan-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.hex-scan-tag {
  border: 1px solid color-mix(in srgb, currentColor 35%, transparent);
  border-radius: 999px;
  padding: 0.08rem 0.42rem;
  font-size: 0.72rem;
  line-height: 1.35;
}
.hex-scan-tag.is-hypermetric-elision {
  color: var(--attention);
}
.hex-scan-roles {
  display: grid;
  gap: 0.2rem;
}
.hex-scan-roles:empty {
  display: none;
}
.hex-scan-role {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: baseline;
  gap: 0.45rem;
  color: var(--text-muted);
  font-size: 10px;
}
.hex-scan-role.is-provisional {
  color: var(--attention);
}
.hex-scan-role-label {
  font-weight: 650;
}
.hex-scan-role-details {
  color: var(--text-faint);
  overflow-wrap: anywhere;
  font-weight: 400;
}
.hex-scan-word {
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  border-radius: 3px;
  background: var(--surface-sunken);
  padding: 0.2rem 0.35rem;
}
.hex-scan-word-identical,
.hex-scan-meter-identical {
  opacity: 0.35;
}
.hex-scan-spelling {
  font-family: var(--font-verse);
  font-size: 15px;
  font-weight: 600;
}
.hex-scan-sound {
  color: var(--text-muted);
  font-size: 10px;
}
/* The scanner explaining itself (a sound adjustment, a weight explanation, a
   spelling-only recovery) is the most valuable text in the card (spec §4)
   and gets a bordered, attention-toned pill so it reads as a note, not a
   number. */
.hex-scan-note {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--attention-line);
  border-radius: 3px;
  background: var(--attention-bg);
  color: var(--attention);
  padding: 0.05rem 0.3rem;
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.02em;
}
/* The remaining `N analyses` count is raw telemetry, gated behind
   diagnostics — quiet and unbordered like the other diagnostics-only
   figures in this file, not shouting for attention it hasn't earned. */
.hex-scan-badge {
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 400;
}
.hex-scan-rules {
  background: var(--surface-sunken);
  color: var(--text-faint);
}
.hex-scan-represented {
  color: var(--text-faint);
  font-size: 10px;
}
#lexicon-words {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.8rem;
}
.hex-word-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-panel);
  color: var(--text);
  padding: 0.25rem 0.55rem;
  font-family: var(--font-verse);
  font-size: 14px;
  cursor: pointer;
}
.hex-word-tab span {
  display: inline-grid;
  place-items: center;
  min-width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  background: var(--surface-sunken);
  font-family: var(--font-ui);
  font-size: 9px;
}
.hex-word-tab[aria-pressed="true"] {
  border-color: var(--accent-line);
  background: var(--accent-bg);
}
#lexicon-word-detail {
  max-height: 25rem;
  overflow-y: auto;
  padding-right: 0.25rem;
}
#lexicon-word-detail h3 {
  margin-bottom: 0.45rem;
  font-size: 1.25rem;
}
.hex-analysis-card {
  border-top: 1px solid var(--line);
}
.hex-analysis-card.is-selected {
  background: var(--accent-bg);
  box-shadow: inset 3px 0 var(--accent-line);
}
.hex-analysis-choice {
  width: 100%;
  padding: 0.65rem 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.hex-analysis-card.is-selected .hex-analysis-choice {
  padding-left: 0.55rem;
  padding-right: 0.35rem;
}
.hex-analysis-choice:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.hex-analysis-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  font-family: var(--font-verse);
  font-size: 16px;
  font-weight: 600;
}
.hex-analysis-score {
  color: var(--text-faint);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 400;
}
.hex-analysis-record-count {
  color: var(--text-faint);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 400;
  white-space: nowrap;
}
.hex-analysis-lemma {
  margin: 0 0.55rem 0.7rem;
  padding: 0.55rem 0.65rem;
  border-left: 2px solid var(--line);
  background: var(--surface-panel);
}
.hex-analysis-lemma h4 {
  margin: 0 0 0.25rem;
  font-size: 13px;
}
.hex-analysis-reading {
  padding: 0.4rem 0;
  border-top: 1px solid var(--surface-sunken);
  color: var(--text-muted);
  font-size: 11px;
}
.hex-analysis-reading > div:first-child {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
}
.hex-analysis-reading-score {
  margin-left: auto;
  color: var(--text-faint);
  font-family: var(--font-ui);
  font-size: 10px;
}
.hex-analysis-provenance,
.hex-analysis-incomplete {
  color: var(--text-faint);
  font-size: 11px;
}
.hex-analysis-meaning {
  margin: 0.3rem 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}
.hex-analysis-articles {
  margin: 0.4rem 0 0;
  color: var(--text-faint);
  font-size: 11px;
}
.hex-analysis-articles > summary,
.hex-dictionary-article-source > summary {
  cursor: pointer;
}
.hex-dictionary-article-source {
  margin: 0.35rem 0 0 0.55rem;
  color: var(--text-muted);
}
.hex-dictionary-article {
  margin: 0.45rem 0 0.25rem;
  padding: 0.55rem 0.65rem;
  border-left: 2px solid var(--line-strong);
  background: var(--surface-sunken);
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  line-height: 1.55;
}
.hex-dictionary-article .gaffiot-article,
.hex-dictionary-article .gaffiot-paragraph {
  margin: 0;
}
.hex-dictionary-article .gaffiot-division {
  display: block;
  height: 0.35rem;
}
.hex-dictionary-article .gaffiot-sense,
.hex-dictionary-article .gaffiot-subsense,
.hex-dictionary-article .gaffiot-rubric {
  font-family: var(--font-ui);
  font-weight: 650;
}
.hex-dictionary-article .gaffiot-latin,
.hex-dictionary-article .gaffiot-variant,
.hex-dictionary-article .gaffiot-example {
  font-style: italic;
}
.hex-dictionary-article .gaffiot-greek,
.hex-dictionary-article .gaffiot-etymology {
  font-family: serif;
}
.hex-dictionary-article .gaffiot-author,
.hex-dictionary-article .gaffiot-work,
.hex-dictionary-article .gaffiot-reference {
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.92em;
}
.hex-analysis-usage {
  margin: 0.25rem 0 0;
  color: var(--text-faint);
  font-family: var(--font-ui);
  font-size: 10px;
  line-height: 1.35;
}
.hex-analysis-usage .hex-diag {
  font-family: var(--font-mono);
}
.hex-analysis-warning {
  margin: 0.3rem 0.55rem;
  color: var(--danger);
  font-size: 11px;
}
details.hex-analysis-meaning summary {
  cursor: pointer;
}
details.hex-analysis-meaning div {
  margin-top: 0.35rem;
}
.hex-analysis-provenance,
.hex-analysis-incomplete {
  margin: 0.45rem 0.55rem 0.65rem;
}
.hex-analysis-provenance summary,
.hex-analysis-incomplete summary {
  cursor: pointer;
}
.hex-analysis-provenance > .hex-analysis-source,
.hex-analysis-incomplete .hex-analysis-reading {
  padding: 0.15rem 0 0 0.7rem;
}
.hex-analysis-provenance > strong {
  display: block;
  padding: 0.45rem 0 0.1rem 0.7rem;
}
.hex-analysis-record {
  margin: 0.4rem 0 0 0.7rem;
  padding: 0.4rem 0;
  border-top: 1px solid var(--line);
}
.hex-analysis-record-heading {
  color: var(--text-muted);
  font-weight: 600;
}
.hex-analysis-record-identity {
  margin-top: 0.2rem;
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: 9px;
}
.hex-analysis-record-meanings,
.hex-analysis-record-warnings {
  margin-top: 0.2rem;
}
.hex-analysis-record-warning {
  color: var(--danger);
}
.hex-analysis-record-sources {
  margin-top: 0.25rem;
}
.hex-analysis-record-source {
  padding-top: 0.12rem;
}
.hex-analysis-empty {
  color: var(--text-faint);
  font-size: 12px;
}
.hex-quantity-group { border: 1px solid var(--line); background: var(--surface-panel); }
.hex-quantity-group + .hex-quantity-group { margin-top: 0.5rem; }
.hex-quantity-group.is-pinned { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.hex-quantity-head {
  display: flex; align-items: baseline; gap: 0.6rem; width: 100%;
  padding: 0.5rem 0.7rem; font: inherit; color: var(--text); cursor: pointer;
  background: var(--surface-sunken); border: 0; border-bottom: 1px solid var(--line);
}
.hex-quantity-head:hover { background: var(--accent-bg); }
.hex-quantity-head:focus-visible,
.hex-lemma-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.hex-quantity-group.is-pinned .hex-quantity-head { background: var(--accent-bg-strong); }
.hex-quantity-form { font-family: var(--font-verse); font-size: 1.35rem; }
.hex-quantity-pin {
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--accent);
}
.hex-quantity-count { margin-left: auto; font-size: 0.7rem; color: var(--text-muted); }
.hex-lemma + .hex-lemma { border-top: 1px solid var(--line); }
.hex-lemma-row {
  display: grid; grid-template-columns: minmax(8rem, 13rem) 1fr;
  gap: 0.1rem 0.9rem; width: 100%; padding: 0.5rem 0.7rem;
  font: inherit; color: var(--text); text-align: left;
  background: none; border: 0; cursor: pointer;
}
.hex-lemma-row:hover { background: var(--accent-bg); }
.hex-lemma-head { font-family: var(--font-verse); font-size: 1.02rem; }
.hex-lemma-pos { font-style: italic; font-size: 0.9em; color: var(--text-muted); }
.hex-lemma-meta {
  grid-column: 2; display: flex; flex-wrap: wrap; gap: 0.25rem;
  align-items: baseline; font-size: 0.74rem; color: var(--text-muted);
}
.hex-lemma-frequency {
  font-family: var(--font-mono); font-size: 0.65rem; font-variant-numeric: tabular-nums;
  padding: 0.05rem 0.4rem; border: 1px solid var(--line-strong);
  background: var(--surface-sunken);
}
.hex-lemma-preview {
  grid-column: 2; font-family: var(--font-verse); font-size: 0.96rem;
  color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hex-lemma-preview.is-empty {
  font-family: var(--font-ui); font-size: 0.78rem; font-style: italic; color: var(--text-faint);
}
.hex-preview-source {
  font-family: var(--font-ui); font-size: 0.62rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--attention);
  border: 1px solid var(--attention-line); padding: 0 0.25rem;
}
.hex-lemma-detail {
  display: flex; flex-direction: column; gap: 0.6rem;
  padding: 0 0.7rem 0.7rem; border-top: 1px dashed var(--line);
}
.hex-entry-block { display: flex; flex-direction: column; gap: 0.2rem; }
.hex-entry-heading {
  display: flex; gap: 0.4rem; align-items: baseline;
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-faint);
}
.hex-entry-count {
  font-family: var(--font-mono); font-weight: 400; letter-spacing: 0;
}
.hex-form-list { display: flex; flex-direction: column; }
.hex-form-row {
  display: flex; align-items: baseline; gap: 0.6rem;
  padding: 0.12rem 0; border-bottom: 1px dotted var(--line);
}
.hex-form-row:last-child { border-bottom: 0; }
.hex-form-cell { font-size: 0.82rem; }
.hex-form-frequency {
  margin-left: auto; font-family: var(--font-mono); font-size: 0.7rem;
  font-variant-numeric: tabular-nums; color: var(--accent); white-space: nowrap;
}
.hex-form-frequency.is-absent { color: var(--text-faint); }
.hex-gloss-body {
  font-family: var(--font-verse); font-size: 0.98rem;
  max-height: 11rem; overflow-y: auto; padding-right: 0.3rem;
}
.hex-gloss-body:focus-visible,
.hex-article:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.hex-article {
  max-height: 20rem; overflow: auto; padding: 0.55rem 0.7rem;
  border: 1px solid var(--line); background: var(--surface-sunken);
  font-family: var(--font-verse); font-size: 0.98rem; line-height: 1.6;
}
.hex-article .gaffiot-article p { margin: 0 0 0.5rem; }
.hex-article .gaffiot-descriptor { font-style: italic; }
.hex-article .gaffiot-grammar { font-style: italic; color: var(--text-muted); }
.hex-article .gaffiot-rubric {
  display: inline-block; min-width: 1.1em; color: var(--accent);
  font-family: var(--font-ui); font-size: 0.78rem; font-weight: 700;
}
.hex-article .gaffiot-author,
.hex-article .gaffiot-work {
  font-style: normal; font-size: 0.88em; color: var(--text-muted);
}
.hex-article .gaffiot-reference {
  font-size: 0.85em; color: var(--text-faint); font-variant-numeric: tabular-nums;
}
.hex-article .gaffiot-example { font-style: italic; quotes: none; }
.hex-entry-identity {
  font-family: var(--font-mono); font-size: 0.66rem; word-break: break-all;
}
@media (max-width: 850px) {
  body { margin-top: 1rem; }
  .hex-workspace {
    grid-template-columns: minmax(0, 1fr) 2.25rem;
  }
  #feedback-rail {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  #verse-feedback.is-tracking-active-verse {
    position: static;
    max-height: none !important;
  }
  #verse-feedback.is-tracking-active-verse #verse-feedback-content {
    overflow-y: visible;
    padding-right: 0;
  }
  .hex-analysis-grid { grid-template-columns: 1fr; }
  .hex-analysis-column + .hex-analysis-column {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .hex-scan-status { text-align: left; }
  .source-reader-status { text-align: left; }
  #winbolt-panel:not(.is-inactive),
  #lupton-panel:not(.is-inactive),
  #postgate-panel:not(.is-inactive) {
    grid-template-rows: auto clamp(24rem, 70dvh, 38rem);
  }
  .bookreader-shell {
    height: 100%;
  }
}
@media (min-width: 851px) {
  body {
    margin: 0;
    max-width: none;
    padding: 0;
    height: 100dvh;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
  }
  #masthead {
    padding: 0.5rem 1.25rem 0.5rem;
  }
  #workspace {
    min-height: 0;
    display: grid;
    grid-template-rows: var(--split-top, 55%) auto minmax(6rem, 1fr);
  }
  .hex-workspace {
    min-height: 0;
    overflow-y: auto;
    border-width: 1px 0;
    /* An `auto` row freezes at the container's free space, which would leave the
       marker lane and feedback rail as short as the visible box while the editor
       scrolls past them. A `max-content` base lets the row span the whole
       scrollable content; the `1fr` maximum still fills the box for a short
       document. */
    grid-template-rows: minmax(max-content, 1fr);
  }
  #split-handle {
    height: 0.6rem;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: var(--surface-page);
    cursor: row-resize;
  }
  #split-handle:hover {
    background: var(--line);
  }
  #split-handle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
  }
  #lower-panel {
    min-height: 0;
    margin-top: 0;
    border-width: 0 0 1px;
  }
  #feedback-panel,
  #winbolt-panel,
  #lupton-panel,
  #postgate-panel {
    min-height: 0;
  }
  /* Same reason, for the tracking `display: flex` above: `#verse-feedback[hidden]`
     ties with `#verse-feedback.is-tracking-active-verse` on specificity, so the
     later rule has to be the one that hides it. */
  #verse-feedback[hidden] {
    display: none;
  }
  .hex-analysis-grid {
    min-height: 0;
  }
  .hex-analysis-column {
    min-height: 0;
    display: flex;
    flex-direction: column;
    /* `#lexicon-words` sits between the heading and the scrolling detail pane and
       cannot shrink below its wrapped tag rows, so in a short panel the column's
       own minimums exceed its height. Scrolling here keeps that overflow inside
       the column instead of letting it spill onto the document. */
    overflow-y: auto;
  }
  #lexicon-scans,
  #lexicon-word-detail {
    flex: 1 1 auto;
    /* A floor rather than 0: these two are the panes that shrink, and at a short
       viewport a `min-height: 0` pane collapses to nothing while still holding
       its content. */
    min-height: 3rem;
    max-height: none;
  }
  .bookreader-shell {
    height: auto;
    min-height: 0;
  }
}
