:root {
  --bg: #fdf7ea;
  --bg-2: #fcf6e7;
  --panel: #fffdf8;
  --panel-soft: #fbf4e8;
  --border: #d4b26b;
  --border-soft: #eadbc0;
  --text: #4c1f22;
  --muted: #7b5d48;
  --gold: #b88737;
  --gold-2: #d9b56e;
  --burgundy: #6d1f24;
  --red: #c62828;
  --amber: #d97706;
  --green: #2e7d32;
  --focus: #c9962f;
  --shadow: rgba(72, 34, 17, 0.10);
  --container: 1680px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0.5rem;
  z-index: 100;
  background: var(--focus);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
}

.skip-link:focus { left: 0.5rem; }

.site-header {
  max-width: var(--container);
  margin: 0 auto;
  padding: 1.25rem 1.4rem 1.2rem;
  text-align: center;
  background: var(--bg);
}

.brand-mark {
  width: min(100%, 520px);
  height: auto;
  display: block;
  margin: 0 auto 0.35rem;
  mix-blend-mode: normal;
}

h1 {
  margin: 0;
  font-family: "Cinzel", "Cormorant Garamond", "EB Garamond", Georgia, serif;
  font-size: clamp(1.75rem, 3.25vw, 3.25rem);
  line-height: 1.05;
  font-weight: 500;
  letter-spacing: 0.075em;
  color: var(--burgundy);
  text-transform: none;
}

.hero-subtitle {
  margin: 0.7rem 0 0;
  color: var(--gold);
  font-family: "EB Garamond", Georgia, serif;
  font-size: clamp(1.2rem, 2.4vw, 1.9rem);
}

.control-panel {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(253, 247, 234, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 10px 20px var(--shadow);
}

.filters {
  max-width: var(--container);
  margin: 0 auto;
  padding: 1rem 1.4rem;
  display: grid;
  grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(160px, 1fr));
  gap: 0.9rem;
  align-items: end;
}

.field,
.checkbox-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field span,
.checkbox-field span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field-rule { grid-column: span 2; }

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  min-height: 3rem;
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 0.7rem;
  padding: 0.8rem 0.85rem;
  outline: none;
}

input:focus,
select:focus,
button:focus-visible {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(201, 150, 47, 0.18);
}

.checkbox-field {
  justify-content: center;
  flex-direction: row;
  align-items: center;
  min-height: 3rem;
  padding: 0.3rem 0;
}

.checkbox-field input {
  width: 1rem;
  min-height: auto;
  accent-color: var(--gold);
}

.button-row {
  display: flex;
  gap: 0.6rem;
}

button {
  min-height: 3rem;
  border: 1px solid var(--gold);
  border-radius: 0.7rem;
  padding: 0.8rem 1rem;
  color: #fff;
  background: linear-gradient(180deg, #7d2228 0%, #61191d 100%);
  cursor: pointer;
  font-weight: 700;
}

button:hover { filter: brightness(1.05); }
button:disabled { opacity: 0.55; cursor: wait; }

.button-secondary {
  border-color: var(--border);
  background: #f8f0e1;
  color: var(--burgundy);
}

.status-strip,
.results,
.load-more-wrap {
  max-width: var(--container);
  margin: 0 auto;
}

.status-strip {
  padding: 1rem 1.4rem 0;
  color: var(--muted);
}

.status-strip p { margin: 0; }

.results {
  padding: 0.4rem 1.4rem 2.6rem;
  display: grid;
  gap: 1.15rem;
}

.result-card {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  border: 1px solid var(--border);
  border-radius: 1.1rem;
  overflow: hidden;
  background: var(--panel);
  box-shadow: 0 10px 22px var(--shadow);
}

.source-panel,
.bible-panel {
  padding: clamp(1.25rem, 2vw, 1.85rem);
  min-width: 0;
}

.source-panel {
  border-right: 1px solid var(--border-soft);
  font-family: "Amiri Quran", "Scheherazade New", serif;
  background: #fffdf9;
}

.bible-panel {
  background: var(--panel-soft);
  font-family: "EB Garamond", Georgia, serif;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.8rem;
  color: var(--gold);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.84rem;
}

.source-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  /* Match the Bible result text size so both columns read evenly. */
  font-size: clamp(1rem, 1.2vw, 1.16rem);
  line-height: 1.85;
  color: var(--text);
}

.source-arabic-wrap {
  margin-top: 0.85rem;
}

.source-arabic-toggle {
  min-height: 2.25rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f8f0e1;
  color: var(--burgundy);
  box-shadow: none;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.84rem;
  font-weight: 800;
}

.source-arabic-toggle:hover,
.source-arabic-toggle[aria-expanded="true"] {
  background: #efe1ca;
}

.source-arabic-panel {
  margin-top: 0.8rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border-soft);
  border-radius: 0.8rem;
  background: #fbf5e9;
}

.source-arabic-panel[hidden] {
  display: none;
}

.source-arabic-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: "Amiri Quran", "Noto Naskh Arabic", "Scheherazade New", serif;
  font-size: clamp(0.81rem, 1.0125vw, 0.96rem);
  line-height: 2;
  text-align: right;
  direction: rtl;
  unicode-bidi: plaintext;
  color: var(--text);
}

.bible-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: clamp(1rem, 1.2vw, 1.16rem);
  line-height: 1.62;
  color: var(--text);
}

.tags {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.tag {
  border-radius: 999px;
  padding: 0.28rem 0.72rem;
  color: #fff;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.35;
}

.tag-red { background: var(--red); }
.tag-amber { background: var(--amber); }
.tag-green { background: var(--green); }

.load-more-wrap {
  padding: 0 1.4rem 3rem;
  display: flex;
  justify-content: center;
}

@media (max-width: 980px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .field-rule { grid-column: auto; }
}

@media (max-width: 860px) {
  .result-card { grid-template-columns: 1fr; }
  .source-panel {
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
  }
  .filters { grid-template-columns: 1fr; }
  .brand-mark {
  width: min(100%, 520px);
  height: auto;
  display: block;
  margin: 0 auto 0.35rem;
  mix-blend-mode: normal;
}
}


.panel-heading {
  margin: 0 0 0.45rem;
  color: var(--gold);
  font-family: "Cinzel", "Cormorant Garamond", Georgia, serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.source-link,
.inline-link {
  color: var(--burgundy);
  text-decoration-color: rgba(109, 31, 36, 0.36);
  text-underline-offset: 0.18em;
  font-weight: 700;
}

.source-link:hover,
.inline-link:hover {
  text-decoration-color: var(--burgundy);
}

.reference-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  margin-top: 0.8rem;
  align-items: center;
  font-size: 0.9rem;
  line-height: 1.5;
}

.reference-label {
  color: var(--muted);
  font-weight: 700;
  margin-right: 0.12rem;
}

.catechism-block {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border-soft);
}

.catechism-text {
  margin-top: 0.55rem;
  font-size: clamp(0.96rem, 1.08vw, 1.08rem);
  line-height: 1.58;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tag {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}


/* Mobile: let the search/filter panel scroll away so results get more screen space. */
@media (max-width: 860px) {
  .control-panel {
    position: static;
    top: auto;
  }
}


.search-hit {
  background: rgba(216, 181, 110, 0.45);
  color: inherit;
  border-radius: 0.18rem;
  padding: 0.02em 0.08em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}


.expandable-text-wrap {
  position: relative;
}

.collapsible-text {
  position: relative;
  overflow: hidden;
}

.collapsible-text.is-collapsed {
  max-height: 16rem;
}

.source-text.collapsible-text.is-collapsed {
  max-height: 18rem;
}

.source-arabic-text.collapsible-text.is-collapsed {
  max-height: 18rem;
}

.bible-text.collapsible-text.is-collapsed,
.catechism-text.collapsible-text.is-collapsed {
  max-height: 14rem;
}

.collapsible-text.is-expanded {
  max-height: none;
  overflow: visible;
}

.collapsible-text.is-collapsed::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4.2rem;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 253, 249, 0), #fffdf9 82%);
}

.bible-panel .collapsible-text.is-collapsed::after {
  background: linear-gradient(180deg, rgba(251, 244, 232, 0), var(--panel-soft) 82%);
}

.source-arabic-panel .collapsible-text.is-collapsed::after {
  background: linear-gradient(180deg, rgba(251, 245, 233, 0), #fbf5e9 82%);
}

.expand-toggle {
  min-height: 2.35rem;
  margin-top: 0.75rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.88rem;
  border-radius: 999px;
  background: #f8f0e1;
  color: var(--burgundy);
  border: 1px solid var(--border);
  box-shadow: none;
}

.expand-toggle:hover {
  filter: brightness(0.98);
}

@media (max-width: 860px) {
  .source-text.collapsible-text.is-collapsed,
  .source-arabic-text.collapsible-text.is-collapsed,
  .bible-text.collapsible-text.is-collapsed,
  .catechism-text.collapsible-text.is-collapsed {
    max-height: 12.5rem;
  }
}


.tag-sin-code {
  background: var(--burgundy);
}

.tag-deadly-sin {
  background: #8a5a1f;
}

.tag-catechism-breach {
  background: #5f4a2b;
}

.tag-sin-code,
.tag-deadly-sin,
.tag-catechism-breach {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}


/* Interactive clothing-tag style */
.tags {
  align-items: center;
}

button.tag,
.tag {
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2rem;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
  border-radius: 0.45rem 0.25rem 0.25rem 0.45rem;
  padding: 0.32rem 0.72rem 0.32rem 1.05rem;
  border: 1px solid rgba(76, 31, 34, 0.35);
  background: #fff9ee;
  color: var(--burgundy);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.25;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255,255,255,0.75) inset, 0 2px 5px rgba(72, 34, 17, 0.08);
}

button.tag::before,
.tag.clothing-tag::before {
  content: "";
  position: absolute;
  left: 0.38rem;
  top: 50%;
  width: 0.32rem;
  height: 0.32rem;
  transform: translateY(-50%);
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid currentColor;
  opacity: 0.8;
}

button.tag::after,
.tag.clothing-tag::after {
  content: "";
  position: absolute;
  right: -0.39rem;
  top: 50%;
  width: 0.72rem;
  height: 0.72rem;
  transform: translateY(-50%) rotate(45deg);
  background: inherit;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  opacity: 0.85;
}

button.tag:hover {
  transform: translateY(-1px);
  filter: brightness(1.02);
}

button.tag:focus-visible {
  outline: 3px solid rgba(201, 150, 47, 0.28);
  outline-offset: 2px;
}

/* Seven Deadly Sins colours */
.tag-pride {
  background: #f2e8ff;
  color: #5b2485;
  border-color: #9b6cc0;
}

.tag-greed {
  background: #e8f5ec;
  color: #176b3a;
  border-color: #65a87d;
}

.tag-lust {
  background: #fde8ef;
  color: #9d174d;
  border-color: #cf6b95;
}

.tag-envy {
  background: #e3f8f3;
  color: #0f766e;
  border-color: #5bb7aa;
}

.tag-gluttony {
  background: #fff0dc;
  color: #9a4a00;
  border-color: #dc9a42;
}

.tag-wrath {
  background: #fee2e2;
  color: #991b1b;
  border-color: #ef7777;
}

.tag-sloth {
  background: #e8edf5;
  color: #334155;
  border-color: #94a3b8;
}

.tag-sin-code {
  background: #fff9ee;
  color: var(--burgundy);
  border-color: var(--border);
}

.tag-ccc {
  background: #fff8e4;
  color: #7a4f12;
  border-color: #d2aa57;
}

@media (max-width: 860px) {
  button.tag,
  .tag {
    font-size: 0.72rem;
    padding-right: 0.65rem;
  }
}


/* Final tag layout + pastel Seven Deadly Sin colours */
.result-card .source-panel {
  display: flex;
  flex-direction: column;
}

.result-card .tags {
  margin-top: auto;
  padding-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.45rem 0.55rem;
}

.result-card button.tag,
.result-card .tag {
  margin: 0;
  border-width: 1px;
  border-style: solid;
  box-shadow: 0 1px 0 rgba(255,255,255,0.78) inset, 0 2px 5px rgba(72, 34, 17, 0.07);
}

/* Sin code and CCC tags remain neutral parchment/gold */
.result-card .tag-sin-code {
  background: #fff9ee;
  color: #5a2f24;
  border-color: #d8c6a4;
}

.result-card .tag-ccc {
  background: #fff6d8;
  color: #6d4a12;
  border-color: #d7b85f;
}

/* Pastel Seven Deadly Sins */
.result-card .tag-pride {
  background: #eadcf8;
  color: #5b2b7a;
  border-color: #c7a6df;
}

.result-card .tag-greed {
  background: #fff2b8;
  color: #72560a;
  border-color: #ddc25d;
}

.result-card .tag-lust {
  background: #ffddea;
  color: #8a2754;
  border-color: #e7a5c2;
}

.result-card .tag-envy {
  background: #d9f3df;
  color: #1f6635;
  border-color: #9ad4a6;
}

.result-card .tag-gluttony {
  background: #ffe0bd;
  color: #86500f;
  border-color: #e2a968;
}

.result-card .tag-wrath {
  background: #ffd6d6;
  color: #8f1d1d;
  border-color: #eba0a0;
}

.result-card .tag-sloth {
  background: #dcecf7;
  color: #315a75;
  border-color: #a7c8dd;
}

/* Keep the clothing-tag triangle in the same pastel colour as the tag body. */
.result-card button.tag::after,
.result-card .tag.clothing-tag::after {
  background: inherit;
}

/* Mobile: keep spacing comfortable but compact. */
@media (max-width: 860px) {
  .result-card .tags {
    gap: 0.4rem 0.5rem;
    padding-top: 0.85rem;
  }

  .result-card button.tag,
  .result-card .tag {
    min-height: 1.9rem;
  }
}


/* True clothing-tag shape refinement */
.result-card .tags {
  margin-top: auto;
  padding-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem 0.65rem;
}

.result-card button.tag,
.result-card .tag {
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 2.2rem;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
  padding: 0.42rem 1.3rem 0.42rem 0.95rem;
  border: 1px solid transparent;
  border-radius: 0;
  background-clip: padding-box;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.2;
  box-shadow: none;
  cursor: pointer;

  /* clothing tag shape */
  -webkit-clip-path: polygon(0% 0%, 78% 0%, 100% 50%, 78% 100%, 0% 100%, 0% 0%);
  clip-path: polygon(0% 0%, 78% 0%, 100% 50%, 78% 100%, 0% 100%, 0% 0%);
}

.result-card button.tag::before,
.result-card .tag::before {
  content: "";
  position: absolute;
  right: 0.62rem;
  top: 50%;
  width: 0.42rem;
  height: 0.42rem;
  transform: translateY(-50%);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid currentColor;
  z-index: 2;
}

.result-card button.tag::after,
.result-card .tag::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid currentColor;
  z-index: 1;
  pointer-events: none;
  -webkit-clip-path: polygon(0% 0%, 78% 0%, 100% 50%, 78% 100%, 0% 100%, 0% 0%);
  clip-path: polygon(0% 0%, 78% 0%, 100% 50%, 78% 100%, 0% 100%, 0% 0%);
}

.result-card button.tag:hover {
  filter: brightness(1.01);
  transform: translateY(-1px);
}

.result-card button.tag:focus-visible {
  outline: 3px solid rgba(201, 150, 47, 0.24);
  outline-offset: 2px;
}

/* keep neutral utility tags */
.result-card .tag-sin-code {
  background: #fff9ee;
  color: #5a2f24;
  border-color: #d8c6a4;
}

.result-card .tag-ccc {
  background: #fff6d8;
  color: #6d4a12;
  border-color: #d7b85f;
}

/* Seven deadly sins pastel colours */
.result-card .tag-pride {
  background: #eadcf8;
  color: #5b2b7a;
  border-color: #c7a6df;
}

.result-card .tag-greed {
  background: #fff2b8;
  color: #72560a;
  border-color: #ddc25d;
}

.result-card .tag-lust {
  background: #ffddea;
  color: #8a2754;
  border-color: #e7a5c2;
}

.result-card .tag-envy {
  background: #d9f3df;
  color: #1f6635;
  border-color: #9ad4a6;
}

.result-card .tag-gluttony {
  background: #ffe0bd;
  color: #86500f;
  border-color: #e2a968;
}

.result-card .tag-wrath {
  background: #ffd6d6;
  color: #8f1d1d;
  border-color: #eba0a0;
}

.result-card .tag-sloth {
  background: #dcecf7;
  color: #315a75;
  border-color: #a7c8dd;
}

@media (max-width: 860px) {
  .result-card .tags {
    gap: 0.42rem 0.55rem;
  }

  .result-card button.tag,
  .result-card .tag {
    min-height: 2rem;
    font-size: 0.72rem;
    padding: 0.38rem 1.15rem 0.38rem 0.82rem;
  }

  .result-card button.tag::before,
  .result-card .tag::before {
    right: 0.54rem;
    width: 0.38rem;
    height: 0.38rem;
  }
}


/* Final clothing-tag outline and hole-position fix */
.result-card button.tag,
.result-card .tag {
  position: relative;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0.42rem 1.45rem 0.42rem 0.92rem;

  /* slightly longer body with pointed right end */
  -webkit-clip-path: polygon(0% 0%, 82% 0%, 100% 50%, 82% 100%, 0% 100%);
  clip-path: polygon(0% 0%, 82% 0%, 100% 50%, 82% 100%, 0% 100%);
}

.result-card button.tag::after,
.result-card .tag::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;

  /* black outline, slightly thicker */
  border: 1.6px solid #231f20;
  -webkit-clip-path: polygon(0% 0%, 82% 0%, 100% 50%, 82% 100%, 0% 100%);
  clip-path: polygon(0% 0%, 82% 0%, 100% 50%, 82% 100%, 0% 100%);
}

.result-card button.tag::before,
.result-card .tag::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: 50%;

  /* move the hole toward the point, like the reference image */
  right: 0.34rem;
  width: 0.46rem;
  height: 0.46rem;
  transform: translateY(-50%);
  border-radius: 999px;
  background: #231f20;
  border: none;
  box-shadow: none;
}

@media (max-width: 860px) {
  .result-card button.tag,
  .result-card .tag {
    padding: 0.38rem 1.25rem 0.38rem 0.8rem;
  }

  .result-card button.tag::before,
  .result-card .tag::before {
    right: 0.3rem;
    width: 0.42rem;
    height: 0.42rem;
  }
}

/* --------------------------------------------------------------------------
   2026-07-01 tag visual correction
   Reference: attached black clothing tag image.
   Scope: visual styling for website tags only.
   - left angled end
   - rectangular right end
   - hole on the left side
   - black outline on every tag, regardless of tag colour
   -------------------------------------------------------------------------- */

.tags {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem 0.65rem;
}

button.tag,
.tag,
.result-card button.tag,
.result-card .tag {
  --tag-bg: #fff9ee;
  --tag-text: #5a2f24;
  --tag-outline: #231f20;

  appearance: none;
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.18rem;
  max-width: 100%;
  margin: 0;
  padding: 0.42rem 0.95rem 0.42rem 2.65rem;

  color: var(--tag-text) !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline-offset: 2px;

  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;

  -webkit-clip-path: none !important;
  clip-path: none !important;
}

/* Outer black tag silhouette/outline. */
button.tag::before,
.tag::before,
.result-card button.tag::before,
.result-card .tag::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background: var(--tag-outline);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  transform: none;
  opacity: 1;
  width: auto;
  height: auto;

  -webkit-clip-path: polygon(22% 0, 100% 0, 100% 100%, 22% 100%, 0 70%, 0 30%);
  clip-path: polygon(22% 0, 100% 0, 100% 100%, 22% 100%, 0 70%, 0 30%);
}

/* Coloured inner tag body plus the punched hole. */
button.tag::after,
.tag::after,
.result-card button.tag::after,
.result-card .tag::after {
  content: "";
  position: absolute;
  inset: 2px;
  z-index: -1;
  pointer-events: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  transform: none;
  opacity: 1;
  width: auto;
  height: auto;

  background:
    radial-gradient(
      circle at 13% 50%,
      #fff 0 0.245rem,
      var(--tag-outline) 0.255rem 0.34rem,
      transparent 0.35rem
    ),
    var(--tag-bg);

  -webkit-clip-path: polygon(22% 0, 100% 0, 100% 100%, 22% 100%, 0 70%, 0 30%);
  clip-path: polygon(22% 0, 100% 0, 100% 100%, 22% 100%, 0 70%, 0 30%);
}

button.tag:hover,
.result-card button.tag:hover {
  transform: translateY(-1px);
  filter: brightness(1.01);
}

button.tag:focus-visible,
.result-card button.tag:focus-visible {
  outline: 3px solid rgba(201, 150, 47, 0.28);
}

/* Neutral and utility tags. */
.tag-sin-code,
.result-card .tag-sin-code {
  --tag-bg: #fff9ee;
  --tag-text: #5a2f24;
}

.tag-ccc,
.tag-catechism-breach,
.result-card .tag-ccc,
.result-card .tag-catechism-breach {
  --tag-bg: #fff6d8;
  --tag-text: #6d4a12;
}

.tag-deadly-sin,
.result-card .tag-deadly-sin {
  --tag-bg: #f2e8d8;
  --tag-text: #5f3c18;
}

.tag-neutral,
.result-card .tag-neutral {
  --tag-bg: #f8f0e1;
  --tag-text: #5a2f24;
}

/* Confidence tags. */
.tag-red,
.result-card .tag-red {
  --tag-bg: #ffd6d6;
  --tag-text: #8f1d1d;
}

.tag-amber,
.result-card .tag-amber {
  --tag-bg: #fff2b8;
  --tag-text: #72560a;
}

.tag-green,
.result-card .tag-green {
  --tag-bg: #d9f3df;
  --tag-text: #1f6635;
}

/* Seven Deadly Sins colours.  The black outline remains constant. */
.tag-pride,
.result-card .tag-pride {
  --tag-bg: #eadcf8;
  --tag-text: #5b2b7a;
}

.tag-greed,
.result-card .tag-greed {
  --tag-bg: #fff2b8;
  --tag-text: #72560a;
}

.tag-lust,
.result-card .tag-lust {
  --tag-bg: #ffddea;
  --tag-text: #8a2754;
}

.tag-envy,
.result-card .tag-envy {
  --tag-bg: #d9f3df;
  --tag-text: #1f6635;
}

.tag-gluttony,
.result-card .tag-gluttony {
  --tag-bg: #ffe0bd;
  --tag-text: #86500f;
}

.tag-wrath,
.result-card .tag-wrath {
  --tag-bg: #ffd6d6;
  --tag-text: #8f1d1d;
}

.tag-sloth,
.result-card .tag-sloth {
  --tag-bg: #dcecf7;
  --tag-text: #315a75;
}

@media (max-width: 860px) {
  button.tag,
  .tag,
  .result-card button.tag,
  .result-card .tag {
    min-height: 2rem;
    padding: 0.38rem 0.82rem 0.38rem 2.35rem;
    font-size: 0.72rem;
  }

  button.tag::after,
  .tag::after,
  .result-card button.tag::after,
  .result-card .tag::after {
    background:
      radial-gradient(
        circle at 13% 50%,
        #fff 0 0.22rem,
        var(--tag-outline) 0.23rem 0.305rem,
        transparent 0.315rem
      ),
      var(--tag-bg);
  }
}


/* -------------------------------------------------------------------------
   FINAL TAG/BUTTON VISUAL FIX
   The clickable button itself is now the clothing tag. The pastel colour is
   applied directly to button.tag/.tag, the black outline is rendered by
   drop-shadows around the clipped button shape, and the only pseudo-element
   left is the tag hole. This prevents a separate "button visual" and "tag
   visual" from fighting each other in DevTools/computed styles.
   ------------------------------------------------------------------------- */

button.tag,
.tag,
.result-card button.tag,
.result-card .tag {
  --tag-bg: #fff9ee;
  --tag-text: #5a2f24;
  --tag-outline: #231f20;

  appearance: none !important;
  -webkit-appearance: none !important;
  position: relative !important;
  isolation: isolate !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  min-height: 2.18rem !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0.42rem 0.95rem 0.42rem 2.65rem !important;

  background: var(--tag-bg) !important;
  color: var(--tag-text) !important;
  border: 0 !important;
  border-radius: 0 !important;
  outline-offset: 3px !important;

  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  font-size: 0.76rem !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  text-align: left !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  cursor: pointer !important;

  -webkit-clip-path: polygon(22% 0, 100% 0, 100% 100%, 22% 100%, 0 70%, 0 30%) !important;
  clip-path: polygon(22% 0, 100% 0, 100% 100%, 22% 100%, 0 70%, 0 30%) !important;

  box-shadow: none !important;
  filter:
    drop-shadow(1.4px 0 0 var(--tag-outline))
    drop-shadow(-1.4px 0 0 var(--tag-outline))
    drop-shadow(0 1.4px 0 var(--tag-outline))
    drop-shadow(0 -1.4px 0 var(--tag-outline)) !important;
}

/* The visible hole belongs to the same button/tag object. */
button.tag::before,
.tag::before,
.result-card button.tag::before,
.result-card .tag::before {
  content: "" !important;
  position: absolute !important;
  left: 0.72rem !important;
  top: 50% !important;
  z-index: 2 !important;
  width: 0.48rem !important;
  height: 0.48rem !important;
  transform: translateY(-50%) !important;
  border-radius: 999px !important;
  background: #fffdf8 !important;
  border: 2px solid var(--tag-outline) !important;
  box-shadow: none !important;
  opacity: 1 !important;
  pointer-events: none !important;
}

/* Disable the previous pseudo-tag body. The body is now the button itself. */
button.tag::after,
.tag::after,
.result-card button.tag::after,
.result-card .tag::after {
  content: none !important;
  display: none !important;
}

button.tag:hover,
.result-card button.tag:hover {
  transform: translateY(-1px) !important;
  filter:
    drop-shadow(1.4px 0 0 var(--tag-outline))
    drop-shadow(-1.4px 0 0 var(--tag-outline))
    drop-shadow(0 1.4px 0 var(--tag-outline))
    drop-shadow(0 -1.4px 0 var(--tag-outline)) !important;
}

button.tag:focus-visible,
.result-card button.tag:focus-visible {
  outline: 3px solid rgba(201, 150, 47, 0.32) !important;
}

/* Neutral and utility tag colours. */
.tag-sin-code,
.result-card .tag-sin-code {
  --tag-bg: #fff9ee;
  --tag-text: #5a2f24;
}

.tag-ccc,
.tag-catechism-breach,
.result-card .tag-ccc,
.result-card .tag-catechism-breach {
  --tag-bg: #fff6d8;
  --tag-text: #6d4a12;
}

.tag-deadly-sin,
.result-card .tag-deadly-sin,
.tag-neutral,
.result-card .tag-neutral {
  --tag-bg: #f8f0e1;
  --tag-text: #5a2f24;
}

/* Confidence tags. */
.tag-red,
.result-card .tag-red {
  --tag-bg: #ffd6d6;
  --tag-text: #8f1d1d;
}

.tag-amber,
.result-card .tag-amber {
  --tag-bg: #fff2b8;
  --tag-text: #72560a;
}

.tag-green,
.result-card .tag-green {
  --tag-bg: #d9f3df;
  --tag-text: #1f6635;
}

/* Seven Deadly Sins pastel colours. The outline remains black on every tag. */
.tag-pride,
.result-card .tag-pride {
  --tag-bg: #eadcf8;
  --tag-text: #5b2b7a;
}

.tag-greed,
.result-card .tag-greed {
  --tag-bg: #fff2b8;
  --tag-text: #72560a;
}

.tag-lust,
.result-card .tag-lust {
  --tag-bg: #ffddea;
  --tag-text: #8a2754;
}

.tag-envy,
.result-card .tag-envy {
  --tag-bg: #d9f3df;
  --tag-text: #1f6635;
}

.tag-gluttony,
.result-card .tag-gluttony {
  --tag-bg: #ffe0bd;
  --tag-text: #86500f;
}

.tag-wrath,
.result-card .tag-wrath {
  --tag-bg: #ffd6d6;
  --tag-text: #8f1d1d;
}

.tag-sloth,
.result-card .tag-sloth {
  --tag-bg: #dcecf7;
  --tag-text: #315a75;
}

@media (max-width: 860px) {
  button.tag,
  .tag,
  .result-card button.tag,
  .result-card .tag {
    min-height: 2rem !important;
    padding: 0.38rem 0.82rem 0.38rem 2.35rem !important;
    font-size: 0.72rem !important;
  }

  button.tag::before,
  .tag::before,
  .result-card button.tag::before,
  .result-card .tag::before {
    left: 0.64rem !important;
    width: 0.42rem !important;
    height: 0.42rem !important;
  }
}

/* -------------------------------------------------------------------------
   FINAL HARD FIX: visible black outline on the actual tag button
   DevTools confirmed the live elements are:
   <button class="tag clothing-tag ...">

   The button itself is now the black outer clothing-tag shape. The pastel tag
   colour is drawn inside it with ::before, leaving a real black border around
   every edge, including the angled left side. The hole is drawn with ::after.
   ------------------------------------------------------------------------- */

button.tag.clothing-tag,
.result-card button.tag.clothing-tag,
.tag.clothing-tag,
.result-card .tag.clothing-tag {
  --tag-outline: #000 !important;

  appearance: none !important;
  -webkit-appearance: none !important;
  position: relative !important;
  isolation: isolate !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-start !important;

  min-height: 2.18rem !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0.42rem 0.95rem 0.42rem 2.65rem !important;

  background: var(--tag-outline) !important;
  color: var(--tag-text) !important;
  border: 0 !important;
  border-radius: 0 !important;
  outline-offset: 3px !important;
  box-shadow: none !important;
  filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.32)) !important;

  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  font-size: 0.76rem !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  text-align: left !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  cursor: pointer !important;

  -webkit-clip-path: polygon(22% 0, 100% 0, 100% 100%, 22% 100%, 0 70%, 0 30%) !important;
  clip-path: polygon(22% 0, 100% 0, 100% 100%, 22% 100%, 0 70%, 0 30%) !important;
}

/* Pastel inner body. This sits inside the black outer button, creating the
   visible black outline instead of relying on a subtle drop-shadow. */
button.tag.clothing-tag::before,
.result-card button.tag.clothing-tag::before,
.tag.clothing-tag::before,
.result-card .tag.clothing-tag::before {
  content: "" !important;
  position: absolute !important;
  inset: 2px !important;
  left: 2px !important;
  top: 2px !important;
  right: 2px !important;
  bottom: 2px !important;
  width: auto !important;
  height: auto !important;
  transform: none !important;
  z-index: -1 !important;

  background: var(--tag-bg) !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  opacity: 1 !important;
  pointer-events: none !important;

  -webkit-clip-path: polygon(22% 0, 100% 0, 100% 100%, 22% 100%, 0 70%, 0 30%) !important;
  clip-path: polygon(22% 0, 100% 0, 100% 100%, 22% 100%, 0 70%, 0 30%) !important;
}

/* Hole on the same button/tag object. */
button.tag.clothing-tag::after,
.result-card button.tag.clothing-tag::after,
.tag.clothing-tag::after,
.result-card .tag.clothing-tag::after {
  content: "" !important;
  display: block !important;
  position: absolute !important;
  left: 0.72rem !important;
  top: 50% !important;
  z-index: 2 !important;
  width: 0.48rem !important;
  height: 0.48rem !important;
  transform: translateY(-50%) !important;
  border-radius: 999px !important;
  background: #fffdf8 !important;
  border: 2px solid var(--tag-outline) !important;
  box-shadow: none !important;
  opacity: 1 !important;
  pointer-events: none !important;
}

button.tag.clothing-tag:hover,
.result-card button.tag.clothing-tag:hover {
  transform: translateY(-1px) !important;
  filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.32)) !important;
}

@media (max-width: 860px) {
  button.tag.clothing-tag,
  .result-card button.tag.clothing-tag,
  .tag.clothing-tag,
  .result-card .tag.clothing-tag {
    min-height: 2rem !important;
    padding: 0.38rem 0.82rem 0.38rem 2.35rem !important;
    font-size: 0.72rem !important;
  }

  button.tag.clothing-tag::after,
  .result-card button.tag.clothing-tag::after,
  .tag.clothing-tag::after,
  .result-card .tag.clothing-tag::after {
    left: 0.64rem !important;
    width: 0.42rem !important;
    height: 0.42rem !important;
  }
}


/* ==========================================================================
   FINAL FORCED TAG/BUTTON CLOTHING-LABEL FIX
   Confirmed live markup:
   <button class="tag clothing-tag ..." type="button">...</button>

   This rule intentionally comes LAST. It makes the actual button the visual
   clothing tag, keeps the pastel sin colours, places the hole on the left,
   removes the old right-side diamond/tag visuals, and forces a visible black
   outline around the clipped clothing-tag shape.
   ========================================================================== */

button.tag.clothing-tag,
.result-card button.tag.clothing-tag,
.tags button.tag.clothing-tag {
  --tag-outline: #000000 !important;

  appearance: none !important;
  -webkit-appearance: none !important;
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  box-sizing: border-box !important;

  min-height: 2.18rem !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0.42rem 0.95rem 0.42rem 2.65rem !important;

  background: var(--tag-bg, #fff9ee) !important;
  color: var(--tag-text, #5a2f24) !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline-offset: 3px !important;

  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  font-size: 0.76rem !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  text-align: left !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  cursor: pointer !important;

  -webkit-clip-path: polygon(22% 0, 100% 0, 100% 100%, 22% 100%, 0 70%, 0 30%) !important;
  clip-path: polygon(22% 0, 100% 0, 100% 100%, 22% 100%, 0 70%, 0 30%) !important;

  /* The visible black outline. Repeated drop-shadows outline the clipped shape. */
  -webkit-filter:
    drop-shadow(2px 0 0 var(--tag-outline))
    drop-shadow(-2px 0 0 var(--tag-outline))
    drop-shadow(0 2px 0 var(--tag-outline))
    drop-shadow(0 -2px 0 var(--tag-outline))
    drop-shadow(1.5px 1.5px 0 var(--tag-outline))
    drop-shadow(-1.5px 1.5px 0 var(--tag-outline))
    drop-shadow(1.5px -1.5px 0 var(--tag-outline))
    drop-shadow(-1.5px -1.5px 0 var(--tag-outline)) !important;
  filter:
    drop-shadow(2px 0 0 var(--tag-outline))
    drop-shadow(-2px 0 0 var(--tag-outline))
    drop-shadow(0 2px 0 var(--tag-outline))
    drop-shadow(0 -2px 0 var(--tag-outline))
    drop-shadow(1.5px 1.5px 0 var(--tag-outline))
    drop-shadow(-1.5px 1.5px 0 var(--tag-outline))
    drop-shadow(1.5px -1.5px 0 var(--tag-outline))
    drop-shadow(-1.5px -1.5px 0 var(--tag-outline)) !important;
}

/* Hole on the left side of the same button. */
button.tag.clothing-tag::before,
.result-card button.tag.clothing-tag::before,
.tags button.tag.clothing-tag::before {
  content: "" !important;
  display: block !important;
  position: absolute !important;
  left: 0.72rem !important;
  top: 50% !important;
  width: 0.48rem !important;
  height: 0.48rem !important;
  transform: translateY(-50%) !important;
  border-radius: 999px !important;
  background: #fffdf8 !important;
  border: 2px solid #000000 !important;
  box-shadow: none !important;
  opacity: 1 !important;
  pointer-events: none !important;
}

/* Remove the older right-side diamond/extra tag visual. */
button.tag.clothing-tag::after,
.result-card button.tag.clothing-tag::after,
.tags button.tag.clothing-tag::after {
  content: none !important;
  display: none !important;
  background: none !important;
  border: 0 !important;
  box-shadow: none !important;
}

button.tag.clothing-tag:hover,
.result-card button.tag.clothing-tag:hover,
.tags button.tag.clothing-tag:hover {
  transform: translateY(-1px) !important;
}

/* Pastel colours retained. */
button.tag.clothing-tag.tag-sin-code,
.result-card button.tag.clothing-tag.tag-sin-code {
  --tag-bg: #fff9ee !important;
  --tag-text: #5a2f24 !important;
}

button.tag.clothing-tag.tag-ccc,
.result-card button.tag.clothing-tag.tag-ccc {
  --tag-bg: #fff6d8 !important;
  --tag-text: #6d4a12 !important;
}

button.tag.clothing-tag.tag-pride,
.result-card button.tag.clothing-tag.tag-pride {
  --tag-bg: #eadcf8 !important;
  --tag-text: #5b2b7a !important;
}

button.tag.clothing-tag.tag-greed,
.result-card button.tag.clothing-tag.tag-greed {
  --tag-bg: #fff2b8 !important;
  --tag-text: #72560a !important;
}

button.tag.clothing-tag.tag-lust,
.result-card button.tag.clothing-tag.tag-lust {
  --tag-bg: #ffddea !important;
  --tag-text: #8a2754 !important;
}

button.tag.clothing-tag.tag-envy,
.result-card button.tag.clothing-tag.tag-envy {
  --tag-bg: #d9f3df !important;
  --tag-text: #1f6635 !important;
}

button.tag.clothing-tag.tag-gluttony,
.result-card button.tag.clothing-tag.tag-gluttony {
  --tag-bg: #ffe0bd !important;
  --tag-text: #86500f !important;
}

button.tag.clothing-tag.tag-wrath,
.result-card button.tag.clothing-tag.tag-wrath {
  --tag-bg: #ffd6d6 !important;
  --tag-text: #8f1d1d !important;
}

button.tag.clothing-tag.tag-sloth,
.result-card button.tag.clothing-tag.tag-sloth {
  --tag-bg: #dcecf7 !important;
  --tag-text: #315a75 !important;
}

@media (max-width: 860px) {
  button.tag.clothing-tag,
  .result-card button.tag.clothing-tag,
  .tags button.tag.clothing-tag {
    min-height: 2rem !important;
    padding: 0.38rem 0.82rem 0.38rem 2.35rem !important;
    font-size: 0.72rem !important;
  }

  button.tag.clothing-tag::before,
  .result-card button.tag.clothing-tag::before,
  .tags button.tag.clothing-tag::before {
    left: 0.64rem !important;
    width: 0.42rem !important;
    height: 0.42rem !important;
  }
}

/* ==========================================================================
   FINAL TRUE BORDER TAG/BUTTON FIX
   The live elements are buttons: <button class="tag clothing-tag ...">.
   This version uses real inner elements created by app.js:
   .tag-fill = pastel inner body
   .tag-hole = white/black punched hole
   .tag-label = visible text
   The button itself is the black clipped clothing tag, so the outline is real.
   ========================================================================== */

button.tag.clothing-tag,
.result-card button.tag.clothing-tag,
.tags button.tag.clothing-tag {
  --tag-outline: #000000 !important;

  appearance: none !important;
  -webkit-appearance: none !important;
  position: relative !important;
  isolation: isolate !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  box-sizing: border-box !important;

  min-height: 2.22rem !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0.44rem 0.95rem 0.44rem 2.72rem !important;

  background: var(--tag-outline) !important;
  color: var(--tag-text, #5a2f24) !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  filter: none !important;
  outline-offset: 3px !important;

  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  font-size: 0.76rem !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  text-align: left !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  cursor: pointer !important;

  -webkit-clip-path: polygon(22% 0, 100% 0, 100% 100%, 22% 100%, 0 70%, 0 30%) !important;
  clip-path: polygon(22% 0, 100% 0, 100% 100%, 22% 100%, 0 70%, 0 30%) !important;
}

/* Disable all earlier pseudo-element tag drawings so they cannot interfere. */
button.tag.clothing-tag::before,
button.tag.clothing-tag::after,
.result-card button.tag.clothing-tag::before,
.result-card button.tag.clothing-tag::after,
.tags button.tag.clothing-tag::before,
.tags button.tag.clothing-tag::after {
  content: none !important;
  display: none !important;
}

button.tag.clothing-tag > .tag-fill,
.result-card button.tag.clothing-tag > .tag-fill,
.tags button.tag.clothing-tag > .tag-fill {
  position: absolute !important;
  inset: 2px !important;
  z-index: 0 !important;
  display: block !important;
  background: var(--tag-bg, #fff9ee) !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  pointer-events: none !important;

  -webkit-clip-path: polygon(22% 0, 100% 0, 100% 100%, 22% 100%, 0 70%, 0 30%) !important;
  clip-path: polygon(22% 0, 100% 0, 100% 100%, 22% 100%, 0 70%, 0 30%) !important;
}

button.tag.clothing-tag > .tag-hole,
.result-card button.tag.clothing-tag > .tag-hole,
.tags button.tag.clothing-tag > .tag-hole {
  position: absolute !important;
  left: 0.72rem !important;
  top: 50% !important;
  z-index: 2 !important;
  display: block !important;
  width: 0.48rem !important;
  height: 0.48rem !important;
  transform: translateY(-50%) !important;
  border-radius: 999px !important;
  background: #fffdf8 !important;
  border: 2px solid var(--tag-outline) !important;
  box-shadow: none !important;
  pointer-events: none !important;
}

button.tag.clothing-tag > .tag-label,
.result-card button.tag.clothing-tag > .tag-label,
.tags button.tag.clothing-tag > .tag-label {
  position: relative !important;
  z-index: 3 !important;
  display: inline !important;
  color: var(--tag-text, #5a2f24) !important;
  pointer-events: none !important;
}

button.tag.clothing-tag:hover,
.result-card button.tag.clothing-tag:hover,
.tags button.tag.clothing-tag:hover {
  transform: translateY(-1px) !important;
}

/* Pastel colours retained directly on the button. */
button.tag.clothing-tag.tag-sin-code,
.result-card button.tag.clothing-tag.tag-sin-code {
  --tag-bg: #fff9ee !important;
  --tag-text: #5a2f24 !important;
}

button.tag.clothing-tag.tag-ccc,
.result-card button.tag.clothing-tag.tag-ccc {
  --tag-bg: #fff6d8 !important;
  --tag-text: #6d4a12 !important;
}

button.tag.clothing-tag.tag-pride,
.result-card button.tag.clothing-tag.tag-pride {
  --tag-bg: #eadcf8 !important;
  --tag-text: #5b2b7a !important;
}

button.tag.clothing-tag.tag-greed,
.result-card button.tag.clothing-tag.tag-greed {
  --tag-bg: #fff2b8 !important;
  --tag-text: #72560a !important;
}

button.tag.clothing-tag.tag-lust,
.result-card button.tag.clothing-tag.tag-lust {
  --tag-bg: #ffddea !important;
  --tag-text: #8a2754 !important;
}

button.tag.clothing-tag.tag-envy,
.result-card button.tag.clothing-tag.tag-envy {
  --tag-bg: #d9f3df !important;
  --tag-text: #1f6635 !important;
}

button.tag.clothing-tag.tag-gluttony,
.result-card button.tag.clothing-tag.tag-gluttony {
  --tag-bg: #ffe0bd !important;
  --tag-text: #86500f !important;
}

button.tag.clothing-tag.tag-wrath,
.result-card button.tag.clothing-tag.tag-wrath {
  --tag-bg: #ffd6d6 !important;
  --tag-text: #8f1d1d !important;
}

button.tag.clothing-tag.tag-sloth,
.result-card button.tag.clothing-tag.tag-sloth {
  --tag-bg: #dcecf7 !important;
  --tag-text: #315a75 !important;
}

@media (max-width: 860px) {
  button.tag.clothing-tag,
  .result-card button.tag.clothing-tag,
  .tags button.tag.clothing-tag {
    min-height: 2.05rem !important;
    padding: 0.38rem 0.82rem 0.38rem 2.42rem !important;
    font-size: 0.72rem !important;
  }

  button.tag.clothing-tag > .tag-hole,
  .result-card button.tag.clothing-tag > .tag-hole,
  .tags button.tag.clothing-tag > .tag-hole {
    left: 0.64rem !important;
    width: 0.42rem !important;
    height: 0.42rem !important;
  }
}


/* FINAL TAG TEXT LENGTH FIX - 20260701
   Visible tag labels are capped in app.js at 10 characters.
   This CSS is a defensive fallback so long labels cannot visually overflow. */
button.tag.clothing-tag > .tag-label,
.result-card button.tag.clothing-tag > .tag-label,
.tags button.tag.clothing-tag > .tag-label {
  display: inline-block !important;
  max-width: 10ch !important;
  overflow: hidden !important;
  text-overflow: clip !important;
  white-space: nowrap !important;
}

/* FINAL TAG HOVER FULL-TEXT TOOLTIP - 20260701
   The visible tag label remains capped at 10 characters, but hovering or
   keyboard-focusing a truncated tag now displays the full original text. */
.tag-full-tooltip {
  position: fixed !important;
  left: 0;
  top: 0;
  z-index: 999999 !important;
  box-sizing: border-box !important;
  max-width: min(34rem, calc(100vw - 1.5rem)) !important;
  padding: 0.58rem 0.72rem !important;
  background: #fffdf8 !important;
  color: #1a1512 !important;
  border: 2px solid #000 !important;
  border-radius: 0.45rem !important;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28) !important;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  font-size: 0.78rem !important;
  font-weight: 800 !important;
  line-height: 1.28 !important;
  text-align: left !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  pointer-events: none !important;
  opacity: 0 !important;
  transform: translateY(-2px) !important;
}

.tag-full-tooltip.is-visible {
  opacity: 1 !important;
}

.tag-full-tooltip[hidden] {
  display: none !important;
}


/* All Conflicts locks the conflict/review-only checkbox so it cannot
   accidentally broaden the result set beyond retained conflict/review rows. */
.checkbox-field.is-locked {
  opacity: 0.72;
}

.checkbox-field.is-locked input {
  cursor: not-allowed;
}

/* ==========================================================================
   FINAL SMALLER TAGS + RESULT TEXT SPACING FIX - 20260702
   Keeps the working true-border clothing tag structure, but reduces the tag
   footprint and adds breathing room between result text and the tag row.
   ========================================================================== */

.result-card .tags,
.source-panel .tags,
.bible-panel .tags {
  margin-top: 1.35rem !important;
  padding-top: 0.18rem !important;
  gap: 0.34rem 0.46rem !important;
}

button.tag.clothing-tag,
.result-card button.tag.clothing-tag,
.tags button.tag.clothing-tag {
  min-height: 1.72rem !important;
  padding: 0.25rem 0.62rem 0.25rem 2.02rem !important;
  font-size: 0.64rem !important;
  line-height: 1.05 !important;
}

button.tag.clothing-tag > .tag-fill,
.result-card button.tag.clothing-tag > .tag-fill,
.tags button.tag.clothing-tag > .tag-fill {
  inset: 2px !important;
}

button.tag.clothing-tag > .tag-hole,
.result-card button.tag.clothing-tag > .tag-hole,
.tags button.tag.clothing-tag > .tag-hole {
  left: 0.54rem !important;
  width: 0.34rem !important;
  height: 0.34rem !important;
  border-width: 1.5px !important;
}

button.tag.clothing-tag > .tag-label,
.result-card button.tag.clothing-tag > .tag-label,
.tags button.tag.clothing-tag > .tag-label {
  max-width: 10ch !important;
  letter-spacing: 0.01em !important;
}

.tag-full-tooltip {
  font-size: 0.76rem !important;
}

@media (max-width: 860px) {
  .result-card .tags,
  .source-panel .tags,
  .bible-panel .tags {
    margin-top: 1.1rem !important;
    padding-top: 0.12rem !important;
    gap: 0.3rem 0.4rem !important;
  }

  button.tag.clothing-tag,
  .result-card button.tag.clothing-tag,
  .tags button.tag.clothing-tag {
    min-height: 1.62rem !important;
    padding: 0.22rem 0.56rem 0.22rem 1.88rem !important;
    font-size: 0.6rem !important;
  }

  button.tag.clothing-tag > .tag-hole,
  .result-card button.tag.clothing-tag > .tag-hole,
  .tags button.tag.clothing-tag > .tag-hole {
    left: 0.5rem !important;
    width: 0.31rem !important;
    height: 0.31rem !important;
    border-width: 1.5px !important;
  }
}

/* ========================================================================== 
   FULL AUDIT POPUP + BIBLE-SIDE ACTION — REFINED ACADEMIC VIEW 20260703
   ========================================================================== */

.full-audit-card-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 1.35rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-soft);
}

.view-full-audit-button {
  min-height: 1.9rem;
  padding: 0.3rem 0.72rem;
  border: 1.5px solid #000;
  border-radius: 0.34rem;
  background: #f4dfad;
  color: #32181a;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.16);
  font-size: 0.68rem;
  font-weight: 850;
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: none;
}

.view-full-audit-button:hover {
  background: #f8e9c8;
  transform: translateY(-1px);
  filter: none;
}

.full-audit-dialog {
  width: min(1120px, calc(100vw - 2rem));
  max-height: min(94vh, 1040px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 2px solid var(--gold);
  border-radius: 1rem;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 30px 90px rgba(34, 20, 15, 0.46);
}

.full-audit-dialog::backdrop {
  background: rgba(36, 25, 20, 0.74);
  backdrop-filter: blur(4px);
}

.full-audit-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  max-height: min(94vh, 1040px);
  background: var(--bg-2);
}

.full-audit-header {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(15rem, min(44vw, 30rem));
  gap: 1rem;
  align-items: stretch;
  min-height: 108px;
  padding: 0.55rem 1.35rem 0.32rem;
  background: #fef8ed;
  border-bottom: 2px solid var(--gold);
}

.full-audit-heading-wrap {
  min-width: 0;
  display: flex;
  align-items: flex-end;
}

.full-audit-title-group {
  position: relative;
  min-width: 0;
  min-height: 100px;
}

.full-audit-brand-mark {
  display: block;
  flex: 0 0 auto;
  width: 180px;
  height: 100px;
  object-fit: contain;
  object-position: left center;
  margin: 0;
}

.full-audit-header h2 {
  position: absolute;
  right: 0;
  bottom: 0.02rem;
  max-width: 100%;
  margin: 0;
  color: var(--burgundy);
  font-family: "Cinzel", "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.05rem, 2.2vw, 1.55rem);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: 0.035em;
  text-align: right;
  text-transform: uppercase;
  white-space: normal;
  overflow-wrap: anywhere;
}

.full-audit-subtitle {
  margin: 0.42rem 0 0;
  color: var(--muted);
  font-family: "EB Garamond", Georgia, serif;
  font-size: 1rem;
  line-height: 1.35;
}

.full-audit-close {
  inline-size: 2.35rem;
  block-size: 2.35rem;
  min-width: 2.35rem;
  min-height: 2.35rem;
  margin: 0;
  padding: 0;
  display: grid;
  place-items: center;
  border: 2px solid #000;
  border-radius: 50%;
  background: #fffdf8;
  color: #251715;
  box-shadow: none;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.42rem;
  font-weight: 500;
  line-height: 1;
  text-align: center;
  appearance: none;
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
}

.full-audit-close:hover {
  background: #f4dfad;
  filter: none;
}

.full-audit-notice {
  padding: 0.68rem 1.35rem;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.78rem;
  font-weight: 750;
}

.full-audit-notice-loading { background: #fff7da; color: #684d00; }
.full-audit-notice-success { background: #eaf6e8; color: #245d29; }
.full-audit-notice-warning { background: #fff0e2; color: #7d3e0a; }

.full-audit-body {
  overflow: auto;
  padding: 1.15rem 1.3rem 2rem;
  background: var(--bg-2);
  scroll-behavior: smooth;
}

.full-audit-section {
  margin: 0 0 1.25rem;
  padding: 1.1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  background: var(--panel);
  box-shadow: 0 8px 20px rgba(72, 34, 17, 0.06);
}

.full-audit-section > h3 {
  margin: 0 0 0.9rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--gold);
  color: var(--burgundy);
  font-family: "EB Garamond", Georgia, serif;
  font-size: 1.42rem;
  font-weight: 650;
  line-height: 1.2;
}

.full-audit-facts {
  display: grid;
  grid-template-columns: minmax(190px, 0.35fr) minmax(0, 1fr);
  margin: 0;
  border: 1px solid var(--border-soft);
  border-bottom: 0;
  border-radius: 0.5rem 0.5rem 0 0;
  overflow: hidden;
}

.full-audit-facts dt,
.full-audit-facts dd {
  margin: 0;
  padding: 0.66rem 0.78rem;
  border-bottom: 1px solid var(--border-soft);
  overflow-wrap: anywhere;
}

.full-audit-facts dt {
  background: var(--panel-soft);
  color: #5f402f;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.018em;
}

.full-audit-facts dd {
  background: #fff;
  color: #30211c;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 1rem;
  line-height: 1.45;
}

.full-audit-link {
  color: #07558c;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.full-audit-text-block {
  margin-top: 0.9rem;
  padding: 0.86rem 0.95rem;
  border-left: 4px solid var(--gold);
  border-radius: 0 0.45rem 0.45rem 0;
  background: #fbf6ed;
}

.full-audit-text-block h4,
.full-audit-evidence-group h4 {
  margin: 0 0 0.42rem;
  color: #512326;
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0.024em;
}

.full-audit-text-block p {
  margin: 0;
  color: #30211c;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 1.03rem;
  line-height: 1.56;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.full-audit-citation {
  border-left-color: #000;
  background: #f0ece5;
}

.full-audit-copy-button {
  min-height: 1.9rem;
  margin-top: 0.65rem;
  padding: 0.3rem 0.62rem;
  border: 1px solid #3c2d26;
  border-radius: 0.32rem;
  background: #fff;
  color: #3c2d26;
  font-size: 0.7rem;
}

.full-audit-evidence-group {
  margin-top: 0.95rem;
}

.full-audit-evidence-list {
  display: grid;
  gap: 0.58rem;
  margin-top: 0.45rem;
}

.full-audit-evidence-item {
  margin: 0;
  padding: 0.72rem 0.78rem;
  border: 1px solid var(--border-soft);
  border-radius: 0.48rem;
  background: #fff;
}

.full-audit-evidence-item > p {
  margin: 0;
  color: #30211c;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 1rem;
  line-height: 1.48;
  overflow-wrap: anywhere;
}

.full-audit-evidence-item dl {
  display: grid;
  grid-template-columns: minmax(140px, 0.32fr) minmax(0, 1fr);
  margin: 0;
}

.full-audit-evidence-item dt,
.full-audit-evidence-item dd {
  margin: 0;
  padding: 0.35rem 0.42rem;
  border-bottom: 1px solid #f0e5d2;
  overflow-wrap: anywhere;
}

.full-audit-evidence-item dt {
  color: #6c4b36;
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.015em;
}

.full-audit-evidence-item dd {
  color: #30211c;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 0.96rem;
  line-height: 1.42;
}

.full-audit-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: flex-end;
  padding: 0.9rem 1.35rem;
  border-top: 1px solid var(--border);
  background: var(--panel-soft);
}

.full-audit-primary-action,
.full-audit-secondary-action {
  min-height: 2.35rem;
  padding: 0.48rem 0.82rem;
  font-size: 0.78rem;
}

.full-audit-primary-action {
  border: 2px solid #000;
  background: linear-gradient(180deg, #7d2228 0%, #61191d 100%);
  color: #fff;
}

.full-audit-secondary-action {
  border: 1px solid #7f6546;
  background: #fffdf8;
  color: #4c1f22;
}

body:has(.full-audit-dialog[open]) {
  overflow: hidden;
}

@media (max-width: 720px) {
  .full-audit-dialog {
    width: calc(100vw - 0.7rem);
    max-height: 97vh;
    border-radius: 0.55rem;
  }

  .full-audit-shell { max-height: 97vh; }
  .full-audit-header {
    grid-template-columns: minmax(0, 136px) minmax(0, 1fr);
    min-height: 84px;
    padding: 0.45rem 0.7rem 0.28rem;
    gap: 0.55rem;
  }
  .full-audit-brand-mark { width: 136px; height: 76px; }
  .full-audit-title-group { min-height: 76px; }
  .full-audit-header h2 { max-width: 100%; font-size: 0.95rem; white-space: normal; }
  .full-audit-close {
    inline-size: 2.15rem;
    block-size: 2.15rem;
    min-width: 2.15rem;
    min-height: 2.15rem;
  }
  .full-audit-body { padding: 0.78rem 0.68rem 1.35rem; }
  .full-audit-section { padding: 0.85rem 0.72rem; }
  .full-audit-facts { grid-template-columns: 1fr; }
  .full-audit-facts dt { padding-bottom: 0.28rem; border-bottom: 0; }
  .full-audit-facts dd { padding-top: 0.28rem; }
  .full-audit-evidence-item dl { grid-template-columns: 1fr; }
  .full-audit-evidence-item dt { padding-bottom: 0.15rem; border-bottom: 0; }
  .full-audit-evidence-item dd { padding-top: 0.15rem; }
  .full-audit-footer { justify-content: stretch; padding: 0.72rem; }
  .full-audit-footer button { flex: 1 1 100%; }
}

@media print {
  .full-audit-dialog { display: none !important; }
}

/* ========================================================================== 
   FULL AUDIT — OPTIONAL GREEK AND HEBREW BIBLE WITNESSES 20260704
   ========================================================================== */
.full-audit-bible-language-block {
  padding: 1rem 1.05rem;
}

.bible-original-english {
  margin: 0;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border-soft);
  border-left: 4px solid var(--gold);
  border-radius: 0.55rem;
  background: #fffdf8;
}

.bible-original-english h5,
.bible-original-passage > h5 {
  margin: 0 0 0.48rem;
  color: var(--burgundy);
  font-family: "EB Garamond", Georgia, serif;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.25;
}

.bible-original-english p,
.bible-original-reference-english {
  margin: 0;
  color: #30211c;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 1rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.bible-original-witness-list {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.9rem;
}

.bible-original-passage {
  padding: 0.88rem 0.92rem;
  border: 1px solid var(--border-soft);
  border-radius: 0.65rem;
  background: #fffefb;
}

.bible-original-passage > h6 {
  margin: 0.6rem 0 0.3rem;
  color: #5f402f;
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.02em;
}

.bible-original-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.48rem;
  margin-top: 0.65rem;
}

.bible-original-toggle {
  min-height: 1.95rem;
  padding: 0.32rem 0.7rem;
  border: 1.5px solid #000;
  border-radius: 0.36rem;
  background: #f4dfad;
  color: #32181a;
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.14);
  font-size: 0.69rem;
  font-weight: 850;
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: none;
}

.bible-original-toggle:hover,
.bible-original-toggle[aria-expanded="true"] {
  background: #f8e9c8;
  filter: none;
  transform: translateY(-1px);
}

.bible-original-toggle:disabled {
  cursor: progress;
  opacity: 0.68;
  transform: none;
}

.bible-original-panel {
  margin-top: 0.72rem;
  padding: 0.82rem 0.9rem;
  border: 1px solid #d8c5a5;
  border-radius: 0.55rem;
  background: #fbf6ed;
}

.bible-original-panel[hidden] {
  display: none !important;
}

.bible-original-panel h6 {
  margin: 0 0 0.48rem;
  color: var(--burgundy);
  font-family: "EB Garamond", Georgia, serif;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.25;
}

.bible-original-text {
  margin: 0;
  color: #251b18;
  font-size: 1.02rem;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bible-original-greek {
  font-family: "Noto Serif", "Times New Roman", Georgia, serif;
  font-size: calc(1.02rem + 2px);
}

.bible-original-hebrew {
  font-family: "Noto Serif Hebrew", "Times New Roman", serif;
  font-size: calc(1.12rem + 2px);
  line-height: 1.95;
  text-align: right;
  unicode-bidi: plaintext;
}

.bible-original-source {
  margin: 0.65rem 0 0;
  padding-top: 0.52rem;
  border-top: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: calc(0.72rem - 2px);
  line-height: 1.4;
}

.bible-original-analysis-heading {
  margin-top: 0.82rem !important;
  padding-top: 0.72rem;
  border-top: 1px solid var(--border-soft);
}

.bible-original-analysis {
  margin: 0;
  color: #30211c;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 0.98rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.bible-original-unavailable,
.bible-original-panel.is-loading {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-style: italic;
}

@media (max-width: 720px) {
  .full-audit-heading-wrap {
    display: flex;
    align-items: flex-end;
    gap: 0.55rem;
  }

  .full-audit-brand-mark {
    width: 136px;
    height: 76px;
  }

  .full-audit-bible-language-block {
    padding: 0.78rem 0.7rem;
  }

  .bible-original-english,
  .bible-original-passage,
  .bible-original-panel {
    padding: 0.72rem;
  }

  .bible-original-controls {
    align-items: stretch;
  }

  .bible-original-toggle {
    flex: 1 1 auto;
  }
}

/* ========================================================================== 
   FULL AUDIT — ARABIC SOURCE + ISLAMIC COMMENTARY 20260704
   ========================================================================== */
.full-audit-arabic-source {
  border-left-color: var(--burgundy);
  background: #fffdf8;
}

.full-audit-arabic-source > p,
.full-audit-commentary-arabic {
  margin: 0;
  color: #211713;
  font-family: "Amiri Quran", "Noto Naskh Arabic", "Traditional Arabic", serif;
  font-size: 0.975rem;
  line-height: 2;
  text-align: right;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  unicode-bidi: plaintext;
}

.full-audit-islamic-commentary {
  padding: 1rem 1.05rem;
}

.full-audit-commentary-list {
  display: grid;
  gap: 0.85rem;
}

.full-audit-commentary-item {
  padding: 0.9rem 0.95rem;
  border: 1px solid var(--border-soft);
  border-radius: 0.62rem;
  background: #fffefb;
}

.full-audit-commentary-item > h5 {
  margin: 0 0 0.62rem;
  color: var(--burgundy);
  font-family: "EB Garamond", Georgia, serif;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.25;
}

.full-audit-commentary-item > h6 {
  margin: 0.75rem 0 0.28rem;
  color: #5f402f;
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.02em;
}

.full-audit-commentary-item > p:not(.full-audit-commentary-arabic):not(.full-audit-commentary-source) {
  margin: 0;
  color: #30211c;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 1rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.full-audit-commentary-source {
  margin: 0.8rem 0 0;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .full-audit-heading-wrap {
    min-width: 0;
  }

  .full-audit-title-group {
    min-width: 0;
    min-height: 76px;
  }

  .full-audit-islamic-commentary,
  .full-audit-commentary-item {
    padding: 0.72rem;
  }

  .full-audit-arabic-source > p,
  .full-audit-commentary-arabic {
    font-size: 0.9rem;
  }
}


/* ========================================================================== 
   MAIN-PAGE READER TOOLS + ACCESSIBILITY 20260704
   Font-size controls intentionally exclude the Full Audit dialog.
   ========================================================================== */
:root {
  --reader-ui-size: 1rem;
  --reader-small-size: 0.78rem;
  --reader-meta-size: 0.84rem;
  --reader-source-size: 1.1rem;
  --reader-catechism-size: 1.02rem;
  --reader-arabic-size: 1.95rem;
  --reader-tag-size: 0.76rem;
  --reader-heading-size: 0.82rem;
  --reader-hero-size: 2.7rem;
  --reader-subtitle-size: 1.55rem;
  --reader-source-line-height: 1.85;
  --reader-bible-line-height: 1.62;
  --reader-catechism-line-height: 1.58;
  --reader-arabic-line-height: 2;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.tools-divider {
  width: min(calc(100% - 2.8rem), var(--container));
  height: 1px;
  margin: 0 auto;
  background: linear-gradient(90deg, transparent, var(--border-soft) 8%, var(--border-soft) 92%, transparent);
}

.reader-tools {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0.72rem 1.4rem 0.9rem;
}

.reader-tools-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.58rem;
}

.reader-tools-heading h2 {
  margin: 0;
  color: var(--burgundy);
  font-family: "Cinzel", "Cormorant Garamond", Georgia, serif;
  font-size: var(--reader-heading-size);
  font-weight: 650;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.reader-tools-heading p {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: var(--reader-small-size);
  line-height: 1.35;
}

.reader-tools-grid {
  display: grid;
  grid-template-columns: minmax(210px, 1.15fr) repeat(6, minmax(132px, 1fr)) minmax(110px, 0.8fr);
  gap: 0.48rem;
  align-items: stretch;
}

.tool-group {
  min-height: 2.55rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.35rem 0.48rem 0.35rem 0.7rem;
  border: 1px solid var(--border-soft);
  border-radius: 0.62rem;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
}

.tool-label {
  color: var(--muted);
  font-size: var(--reader-small-size);
  font-weight: 750;
  letter-spacing: 0.02em;
}

.tool-control-row {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
}

.tool-icon-button,
.tool-toggle {
  min-height: 2.45rem;
  border: 1px solid var(--border-soft);
  border-radius: 0.58rem;
  background: color-mix(in srgb, var(--panel) 90%, var(--gold) 10%);
  color: var(--text);
  box-shadow: none;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: var(--reader-small-size);
  font-weight: 750;
  line-height: 1.2;
  text-align: center;
}

.tool-toggle {
  width: 100%;
  padding: 0.48rem 0.62rem;
}

.tool-icon-button {
  min-width: 2.35rem;
  padding: 0.35rem 0.46rem;
  font-size: var(--reader-ui-size);
}

.tool-value {
  min-width: 3.5rem;
  color: var(--text);
  font-size: var(--reader-small-size);
  font-weight: 800;
  text-align: center;
}

.tool-toggle:hover,
.tool-icon-button:hover {
  background: color-mix(in srgb, var(--panel) 72%, var(--gold) 28%);
  filter: none;
}

.tool-toggle[aria-pressed="true"] {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--panel) 66%, var(--gold) 34%);
  color: var(--burgundy);
}

.tool-reset {
  color: var(--muted);
}

/* Main-page text-size controls. Full Audit intentionally is not included. */
.site-header h1 {
  font-size: clamp(1.75rem, var(--reader-hero-size), 4.1rem);
}

.site-header .hero-subtitle {
  font-size: clamp(1.15rem, var(--reader-subtitle-size), 2.35rem);
}

.control-panel input,
.control-panel select,
.control-panel button:not(.expand-toggle),
.status-strip,
.load-more-wrap button {
  font-size: var(--reader-ui-size);
}

.control-panel .field span,
.control-panel .checkbox-field span {
  font-size: var(--reader-small-size);
}

.meta-line,
.reference-links {
  font-size: var(--reader-meta-size);
}

.panel-heading {
  font-size: var(--reader-heading-size);
}

.source-text {
  font-size: var(--reader-source-size);
  line-height: var(--reader-source-line-height);
}

.bible-text {
  font-size: var(--reader-source-size);
  line-height: var(--reader-bible-line-height);
}

.catechism-text {
  font-size: var(--reader-catechism-size);
  line-height: var(--reader-catechism-line-height);
}

.source-arabic-text {
  font-size: var(--reader-arabic-size);
  font-weight: 700;
  line-height: var(--reader-arabic-line-height);
}

.results .tag,
.results button.tag,
.results .view-full-audit-button {
  font-size: var(--reader-tag-size) !important;
}

/* Large symbol-only expand/collapse control; remains a semantic button for keyboard and screen-reader access. */
.expandable-text-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.expand-toggle,
button.expand-toggle {
  align-self: flex-end;
  display: inline-grid;
  place-items: center;
  inline-size: 2.9rem;
  block-size: 2.9rem;
  min-width: 2.9rem;
  min-height: 2.9rem;
  margin: 0.42rem 0 0;
  padding: 0;
  border: 0 !important;
  border-radius: 50%;
  background: transparent !important;
  color: var(--burgundy);
  box-shadow: none !important;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 2.25rem;
  font-weight: 500;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  appearance: none;
}

.expand-toggle:hover,
.expand-toggle[aria-expanded="true"] {
  background: color-mix(in srgb, var(--gold) 12%, transparent) !important;
  color: var(--text);
  filter: none;
  transform: none;
}

.expand-toggle:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  box-shadow: none !important;
}

/* Focused reading width for users who benefit from shorter lines. */
html[data-reading-width="focused"] .status-strip,
html[data-reading-width="focused"] .results,
html[data-reading-width="focused"] .load-more-wrap {
  max-width: 1180px;
}

/* A system-font option with extra word and letter spacing; script-specific fonts remain unchanged. */
html[data-readable-font="true"] .site-header h1,
html[data-readable-font="true"] .site-header .hero-subtitle,
html[data-readable-font="true"] .control-panel,
html[data-readable-font="true"] .status-strip,
html[data-readable-font="true"] .source-text,
html[data-readable-font="true"] .bible-panel,
html[data-readable-font="true"] .catechism-text,
html[data-readable-font="true"] .reference-links,
html[data-readable-font="true"] .load-more-wrap {
  font-family: Verdana, Arial, Helvetica, sans-serif;
  letter-spacing: 0.018em;
  word-spacing: 0.08em;
}

html[data-readable-font="true"] .source-arabic-text {
  letter-spacing: normal;
  word-spacing: normal;
}

/* Dark mode. */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #15110f;
  --bg-2: #1b1512;
  --panel: #211915;
  --panel-soft: #2b211b;
  --border: #8b7041;
  --border-soft: #4d3b2e;
  --text: #f2e5cf;
  --muted: #c6b197;
  --gold: #d6ad5b;
  --gold-2: #e1bf78;
  --burgundy: #efb3b7;
  --red: #ef6a6a;
  --amber: #f0a74d;
  --green: #74c77a;
  --focus: #ffd36f;
  --shadow: rgba(0, 0, 0, 0.42);
}

html[data-theme="dark"] body,
html[data-theme="dark"] .site-header {
  background: var(--bg);
  color: var(--text);
}

html[data-theme="dark"] .control-panel {
  background: rgba(21, 17, 15, 0.96);
}

html[data-theme="dark"] input,
html[data-theme="dark"] select {
  background: #201915;
  color: var(--text);
  border-color: var(--border);
}

html[data-theme="dark"] input::placeholder {
  color: #a9957f;
}

html[data-theme="dark"] .result-card,
html[data-theme="dark"] .source-panel,
html[data-theme="dark"] .bible-panel,
html[data-theme="dark"] .source-arabic-panel,
html[data-theme="dark"] .catechism-block {
  background: var(--panel);
  color: var(--text);
}

html[data-theme="dark"] .bible-panel,
html[data-theme="dark"] .source-arabic-panel {
  background: var(--panel-soft);
}

html[data-theme="dark"] .collapsible-text.is-collapsed::after {
  background: linear-gradient(180deg, rgba(33, 25, 21, 0), var(--panel) 82%);
}

html[data-theme="dark"] .bible-panel .collapsible-text.is-collapsed::after,
html[data-theme="dark"] .source-arabic-panel .collapsible-text.is-collapsed::after {
  background: linear-gradient(180deg, rgba(43, 33, 27, 0), var(--panel-soft) 82%);
}

html[data-theme="dark"] .button-secondary,
html[data-theme="dark"] .source-arabic-toggle,
html[data-theme="dark"] .tool-icon-button,
html[data-theme="dark"] .tool-toggle,
html[data-theme="dark"] .tool-group {
  background: #2a211b;
  color: var(--text);
  border-color: var(--border-soft);
}

html[data-theme="dark"] .tool-toggle[aria-pressed="true"] {
  border-color: var(--gold);
  background: #47381f;
  color: #fff2cd;
}

html[data-theme="dark"] .source-link,
html[data-theme="dark"] .inline-link,
html[data-theme="dark"] .full-audit-link {
  color: #9ed1ff;
}

html[data-theme="dark"] .search-hit {
  background: #705923;
  color: #fff7dc;
}

/* Dark mode for the Full Audit popup; font-size reader controls still do not cascade into it. */
html[data-theme="dark"] .full-audit-dialog,
html[data-theme="dark"] .full-audit-shell,
html[data-theme="dark"] .full-audit-body,
html[data-theme="dark"] .full-audit-header,
html[data-theme="dark"] .full-audit-section,
html[data-theme="dark"] .full-audit-text-block,
html[data-theme="dark"] .full-audit-evidence-item,
html[data-theme="dark"] .full-audit-commentary-item,
html[data-theme="dark"] .bible-original-english,
html[data-theme="dark"] .bible-original-passage,
html[data-theme="dark"] .bible-original-panel {
  background: var(--panel);
  color: var(--text);
}

html[data-theme="dark"] .full-audit-shell,
html[data-theme="dark"] .full-audit-body,
html[data-theme="dark"] .full-audit-footer,
html[data-theme="dark"] .full-audit-facts dt {
  background: var(--panel-soft);
}

html[data-theme="dark"] .full-audit-facts dd,
html[data-theme="dark"] .full-audit-evidence-item,
html[data-theme="dark"] .full-audit-commentary-item,
html[data-theme="dark"] .bible-original-passage {
  background: #241c18;
}

html[data-theme="dark"] .full-audit-facts dd,
html[data-theme="dark"] .full-audit-text-block p,
html[data-theme="dark"] .full-audit-evidence-item > p,
html[data-theme="dark"] .full-audit-evidence-item dd,
html[data-theme="dark"] .full-audit-commentary-item > p,
html[data-theme="dark"] .bible-original-english p,
html[data-theme="dark"] .bible-original-reference-english,
html[data-theme="dark"] .bible-original-text,
html[data-theme="dark"] .bible-original-analysis {
  color: var(--text);
}

html[data-theme="dark"] .full-audit-close,
html[data-theme="dark"] .full-audit-secondary-action,
html[data-theme="dark"] .full-audit-copy-button,
html[data-theme="dark"] .bible-original-toggle,
html[data-theme="dark"] .view-full-audit-button {
  background: #2a211b;
  color: var(--text);
  border-color: #d8c8ad;
}

/* High-contrast option works in either light or dark mode. */
html[data-contrast="high"][data-theme="light"] {
  --bg: #ffffff;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --panel-soft: #f4f4f4;
  --border: #000000;
  --border-soft: #555555;
  --text: #000000;
  --muted: #222222;
  --gold: #5f4300;
  --burgundy: #650000;
  --focus: #005fcc;
  --shadow: rgba(0, 0, 0, 0.22);
}

html[data-contrast="high"][data-theme="dark"] {
  --bg: #000000;
  --bg-2: #000000;
  --panel: #000000;
  --panel-soft: #111111;
  --border: #ffffff;
  --border-soft: #bfbfbf;
  --text: #ffffff;
  --muted: #f0f0f0;
  --gold: #ffdf57;
  --burgundy: #ffb8be;
  --focus: #79c8ff;
  --shadow: rgba(255, 255, 255, 0.12);
}

html[data-contrast="high"] .result-card,
html[data-contrast="high"] input,
html[data-contrast="high"] select,
html[data-contrast="high"] button,
html[data-contrast="high"] .tool-group,
html[data-contrast="high"] .full-audit-dialog,
html[data-contrast="high"] .full-audit-section {
  border-width: 2px;
}

html[data-contrast="high"] a {
  text-decoration-thickness: 0.14em;
}

html[data-contrast="high"] *:focus-visible {
  outline: 3px solid var(--focus) !important;
  outline-offset: 3px;
}

/* Original-language text remains bold and enlarged; Arabic is 25% smaller than V3. */
.full-audit-arabic-source > p,
.full-audit-commentary-arabic {
  font-size: 1.95rem !important;
  font-weight: 700 !important;
  line-height: 1.9 !important;
}

.bible-original-greek {
  font-size: 2.3rem !important;
  font-weight: 700 !important;
  line-height: 1.75;
}

.bible-original-hebrew {
  font-size: 2.5rem !important;
  font-weight: 700 !important;
  line-height: 1.9;
}

/* Motion preference. */
html[data-reduce-motion="true"] *,
html[data-reduce-motion="true"] *::before,
html[data-reduce-motion="true"] *::after {
  scroll-behavior: auto !important;
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
  }
}

@media (max-width: 1500px) {
  .reader-tools-grid {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
  }

  .tool-group-text-size {
    grid-column: span 2;
  }
}

@media (max-width: 760px) {
  .reader-tools {
    padding-inline: 0.85rem;
  }

  .reader-tools-grid {
    grid-template-columns: 1fr 1fr;
  }

  .tool-group-text-size {
    grid-column: 1 / -1;
  }

  .reader-tools-heading p {
    max-width: 28rem;
  }

  .source-arabic-text {
    font-size: var(--reader-arabic-size);
  }

  .full-audit-arabic-source > p,
  .full-audit-commentary-arabic {
    font-size: 1.8rem !important;
  }

  .bible-original-greek {
    font-size: 2.3rem !important;
  }

  .bible-original-hebrew {
    font-size: 2.5rem !important;
  }
}

@media (max-width: 480px) {
  .reader-tools-grid {
    grid-template-columns: 1fr;
  }

  .tool-group-text-size {
    grid-column: auto;
  }

  .tools-divider {
    width: calc(100% - 1.7rem);
  }
}

.tool-icon-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  filter: none;
}


/* ==========================================================================
   V2 COMPACT READER TOOLBAR, TRANSPARENT LOGO, HOLY SPIRIT GLOW,
   LOCAL TEXT SIZING, AND COMPACT EXPAND/COLLAPSE CONTROL
   ========================================================================== */

.brand-logo {
  position: relative;
  width: min(100%, 520px);
  margin: 0 auto 0.35rem;
  isolation: isolate;
}

.brand-logo .brand-mark {
  width: 100%;
  height: auto;
  display: block;
  margin: 0;
}

.brand-mark-base {
  position: relative;
  z-index: 1;
}

.brand-mark-glow {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
  transform: translateZ(0);
  transition: opacity 280ms ease, filter 280ms ease;
}

html[data-theme="dark"] .brand-mark-base {
  filter: brightness(1.04) contrast(1.06) drop-shadow(0 0 0.28rem rgba(214, 173, 91, 0.13));
}

html[data-theme="dark"] .brand-mark-glow {
  opacity: 0.96;
  filter:
    brightness(1.95)
    saturate(1.32)
    drop-shadow(0 0 0.35rem rgba(255, 225, 137, 0.9))
    drop-shadow(0 0 0.9rem rgba(255, 205, 94, 0.65))
    drop-shadow(0 0 1.8rem rgba(255, 190, 68, 0.38));
  animation: holy-spirit-breathe 4.8s ease-in-out infinite;
}

html[data-contrast="high"] .brand-mark-base {
  filter: contrast(1.28) saturate(1.12);
}

html[data-contrast="high"][data-theme="dark"] .brand-mark-glow {
  opacity: 1;
  filter:
    brightness(2.25)
    saturate(1.5)
    drop-shadow(0 0 0.45rem rgba(255, 244, 185, 1))
    drop-shadow(0 0 1.15rem rgba(255, 223, 87, 0.9))
    drop-shadow(0 0 2.1rem rgba(255, 223, 87, 0.6));
}

@keyframes holy-spirit-breathe {
  0%, 100% { opacity: 0.8; transform: scale(0.998); }
  50% { opacity: 1; transform: scale(1.004); }
}

.control-panel-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.4rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
}

.control-panel-inner .filters {
  max-width: none;
  margin: 0;
  padding: 0.82rem 1rem 0.82rem 0;
  grid-template-columns: minmax(240px, 2fr) repeat(3, minmax(145px, 1fr));
  gap: 0.7rem;
}

.reader-tools {
  max-width: none;
  margin: 0;
  padding: 0 0 0 0.78rem;
  border-left: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
}

.reader-tools-grid {
  display: grid;
  grid-template-columns: repeat(9, 2.18rem);
  gap: 0.28rem;
  align-items: center;
}

.tool-icon-button,
.tool-toggle,
.reader-tools .tool-icon-button,
.reader-tools .tool-toggle {
  position: relative;
  width: 2.18rem;
  min-width: 2.18rem;
  height: 2.18rem;
  min-height: 2.18rem;
  padding: 0.42rem;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  line-height: 1;
}

.reader-tools .tool-icon-button svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: currentColor;
}

.reader-tools .tool-icon-button:hover {
  background: color-mix(in srgb, var(--panel) 70%, var(--gold) 30%);
  color: var(--text);
  border-color: var(--border-soft);
  filter: none;
}

.reader-tools .tool-icon-button[aria-pressed="true"] {
  background: color-mix(in srgb, var(--panel) 62%, var(--gold) 38%);
  color: var(--burgundy);
  border-color: var(--gold);
}

.tool-icon-sun { display: none !important; }
#theme-toggle[aria-pressed="true"] .tool-icon-moon { display: none !important; }
#theme-toggle[aria-pressed="true"] .tool-icon-sun { display: block !important; }

html[data-theme="dark"] .reader-tools .tool-icon-button {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}

html[data-theme="dark"] .reader-tools .tool-icon-button:hover {
  background: #2a211b;
  color: var(--text);
  border-color: var(--border-soft);
}

html[data-theme="dark"] .reader-tools .tool-icon-button[aria-pressed="true"] {
  background: #47381f;
  color: #fff2cd;
  border-color: var(--gold);
}

/* Per-result text controls. */
.local-text-tools {
  min-height: 1.42rem;
  margin: -0.08rem 0 0.08rem;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.16rem;
  opacity: 0.72;
  transition: opacity 160ms ease;
}

.expandable-text-wrap:hover > .local-text-tools,
.local-text-tools:focus-within {
  opacity: 1;
}

.local-text-button,
button.local-text-button {
  width: 1.42rem;
  min-width: 1.42rem;
  height: 1.42rem;
  min-height: 1.42rem;
  padding: 0.23rem;
  border: 1px solid transparent;
  border-radius: 0.38rem;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  line-height: 1;
}

.local-text-button svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: currentColor;
}

.local-text-button:hover {
  background: color-mix(in srgb, var(--panel) 74%, var(--gold) 26%);
  color: var(--text);
  border-color: var(--border-soft);
  filter: none;
}

.local-text-button:disabled {
  opacity: 0.28;
  cursor: default;
}

/* Half-size, low-profile expand/collapse control immediately beneath the text. */
.expandable-text-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.expand-toggle,
button.expand-toggle {
  align-self: flex-end;
  display: inline-grid;
  place-items: center;
  inline-size: 1.45rem;
  block-size: 1.45rem;
  min-width: 1.45rem !important;
  min-height: 1.45rem !important;
  margin: -0.05rem 0 0;
  padding: 0;
  border: 0 !important;
  border-radius: 0.3rem;
  background: transparent !important;
  color: var(--burgundy);
  box-shadow: none !important;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.12rem;
  font-weight: 500;
  line-height: 1;
}

.expand-toggle:hover,
.expand-toggle[aria-expanded="true"] {
  background: color-mix(in srgb, var(--gold) 14%, transparent) !important;
  color: var(--text);
}

html[data-theme="dark"] .local-text-button,
html[data-theme="dark"] .expand-toggle {
  color: var(--muted);
}

html[data-theme="dark"] .local-text-button:hover,
html[data-theme="dark"] .expand-toggle:hover,
html[data-theme="dark"] .expand-toggle[aria-expanded="true"] {
  background: #2a211b !important;
  color: var(--text);
}

@media (max-width: 1420px) {
  .control-panel-inner {
    grid-template-columns: 1fr;
  }

  .control-panel-inner .filters {
    padding-right: 0;
  }

  .reader-tools {
    border-left: 0;
    border-top: 1px solid var(--border-soft);
    padding: 0.42rem 0 0.5rem;
    justify-content: flex-end;
  }
}

@media (max-width: 980px) {
  .control-panel-inner .filters {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 620px) {
  .control-panel-inner {
    padding-inline: 0.85rem;
  }

  .control-panel-inner .filters {
    grid-template-columns: 1fr;
    padding-block: 0.7rem;
  }

  .reader-tools {
    justify-content: center;
    overflow-x: auto;
  }

  .reader-tools-grid {
    grid-template-columns: repeat(9, 2rem);
  }

  .tool-icon-button,
  .tool-toggle,
  .reader-tools .tool-icon-button,
  .reader-tools .tool-toggle {
    width: 2rem;
    min-width: 2rem;
    height: 2rem;
    min-height: 2rem;
  }
}

html[data-reduce-motion="true"] .brand-mark-glow {
  animation: none !important;
}


/* ==========================================================================
   V3 SYMMETRICAL FILTER LAYOUT + 3x3 TOOL MATRIX
   ========================================================================== */

.control-panel-inner {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0;
  align-items: stretch;
}

.control-panel-inner .filters {
  padding: 0.86rem 1.05rem 0.86rem 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-areas:
    "search search classification source"
    "confidence rule checkbox actions";
  gap: 0.68rem 0.72rem;
  align-items: end;
}

.control-panel-inner .field-search { grid-area: search; }
.control-panel-inner .field-classification { grid-area: classification; }
.control-panel-inner .field-source { grid-area: source; }
.control-panel-inner .field-confidence { grid-area: confidence; }
.control-panel-inner .field-rule {
  grid-area: rule;
  grid-column: auto;
}
.control-panel-inner .checkbox-field { grid-area: checkbox; }
.control-panel-inner .button-row { grid-area: actions; }

.control-panel-inner .field,
.control-panel-inner .checkbox-field,
.control-panel-inner .button-row {
  min-width: 0;
}

.control-panel-inner input,
.control-panel-inner select,
.control-panel-inner .button-row button {
  min-height: 2.85rem;
}

.control-panel-inner .button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.48rem;
}

.reader-tools {
  min-width: 8.25rem;
  padding: 0.82rem 0 0.82rem 1rem;
  align-items: center;
  justify-content: center;
}

.reader-tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 2.2rem);
  grid-template-rows: repeat(3, 2.2rem);
  gap: 0.34rem;
  place-content: center;
}

.reader-tools .tool-icon-button,
.reader-tools .tool-toggle {
  width: 2.2rem;
  min-width: 2.2rem;
  height: 2.2rem;
  min-height: 2.2rem;
}

@media (max-width: 1260px) {
  .control-panel-inner .filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas:
      "search search classification"
      "source confidence rule"
      "checkbox actions actions";
  }
}

@media (max-width: 1040px) {
  .control-panel-inner {
    grid-template-columns: 1fr;
  }

  .control-panel-inner .filters {
    padding-right: 0;
  }

  .reader-tools {
    min-width: 0;
    border-left: 0;
    border-top: 1px solid var(--border-soft);
    padding: 0.62rem 0 0.72rem;
    justify-content: center;
  }
}

@media (max-width: 760px) {
  .control-panel-inner .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "search search"
      "classification source"
      "confidence rule"
      "checkbox checkbox"
      "actions actions";
  }
}

@media (max-width: 520px) {
  .control-panel-inner .filters {
    grid-template-columns: 1fr;
    grid-template-areas:
      "search"
      "classification"
      "source"
      "confidence"
      "rule"
      "checkbox"
      "actions";
  }

  .reader-tools {
    overflow: visible;
  }

  .reader-tools-grid {
    grid-template-columns: repeat(3, 2.1rem);
    grid-template-rows: repeat(3, 2.1rem);
  }

  .reader-tools .tool-icon-button,
  .reader-tools .tool-toggle {
    width: 2.1rem;
    min-width: 2.1rem;
    height: 2.1rem;
    min-height: 2.1rem;
  }
}


/* ==========================================================================
   V6 COMPACT SQUARE SEARCH/FILTER PANEL + DARK-MODE SCROLL ILLUMINATION
   ========================================================================== */

/* The search/filter/tool surface is deliberately a few shades darker than the
   page while staying in the same warm cream/brown colour family. */
.control-panel {
  background: rgba(241, 228, 204, 0.97);
  border-top-color: #d8bd8a;
  border-bottom-color: #c59e55;
  box-shadow: 0 7px 15px rgba(72, 34, 17, 0.09);
}

.control-panel-inner {
  padding-inline: 1.1rem;
}

.control-panel-inner .filters {
  padding: 0.56rem 0.82rem 0.56rem 0;
  gap: 0.46rem 0.52rem;
}

.control-panel-inner .field,
.control-panel-inner .checkbox-field {
  gap: 0.2rem;
}

.control-panel-inner .field span,
.control-panel-inner .checkbox-field span {
  font-size: 0.68rem;
  letter-spacing: 0.035em;
}

.control-panel-inner input,
.control-panel-inner select {
  min-height: 2.28rem;
  padding: 0.42rem 0.58rem;
  border-radius: 0.08rem;
  font-size: 0.82rem;
}

.control-panel-inner .checkbox-field {
  min-height: 2.28rem;
  padding: 0.08rem 0;
}

.control-panel-inner .checkbox-field input {
  width: 0.9rem;
  height: 0.9rem;
}

.control-panel-inner .button-row {
  align-self: end;
  gap: 0.34rem;
}

.control-panel-inner .button-row button {
  min-height: 1.48rem;
  height: 1.48rem;
  padding: 0.12rem 0.4rem;
  border-radius: 0.06rem;
  font-size: 0.64rem;
  line-height: 1;
  box-shadow: none;
}

.reader-tools {
  min-width: 7.35rem;
  padding: 0.55rem 0 0.55rem 0.78rem;
  border-left-color: #cfb27e;
}

.reader-tools-grid {
  grid-template-columns: repeat(3, 1.92rem);
  grid-template-rows: repeat(3, 1.92rem);
  gap: 0.24rem;
}

.reader-tools .tool-icon-button,
.reader-tools .tool-toggle {
  width: 1.92rem;
  min-width: 1.92rem;
  height: 1.92rem;
  min-height: 1.92rem;
  padding: 0.34rem;
  border-radius: 0.08rem;
}

/* Dark mode gets the same compact geometry and a deeper version of the same
   brown colour grade instead of a visually disconnected black strip. */
html[data-theme="dark"] .control-panel {
  background: rgba(16, 12, 10, 0.97);
  border-top-color: #33261f;
  border-bottom-color: #5f482e;
}

html[data-theme="dark"] .control-panel-inner input,
html[data-theme="dark"] .control-panel-inner select {
  background: #1a1411;
  border-color: #6f5737;
}

html[data-theme="dark"] .reader-tools {
  border-left-color: #46362a;
}

/* Result cards subtly brighten as they pass through the central reading band.
   JavaScript only toggles the state; all visuals remain theme-controlled CSS. */
.result-card {
  position: relative;
  isolation: isolate;
  transition:
    background 360ms ease,
    border-color 360ms ease,
    box-shadow 360ms ease,
    filter 360ms ease;
}

.result-card > .source-panel,
.result-card > .bible-panel {
  position: relative;
  z-index: 1;
  transition: background 360ms ease, color 360ms ease;
}

html[data-theme="dark"] .result-card {
  background: linear-gradient(135deg, #1d1613 0%, #18120f 58%, #15100e 100%);
  border-color: #5f4933;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.36);
  filter: brightness(0.94) saturate(0.94);
}

html[data-theme="dark"] .result-card .source-panel {
  background: linear-gradient(135deg, #211915 0%, #1d1613 100%);
}

html[data-theme="dark"] .result-card .bible-panel {
  background: linear-gradient(135deg, #271e19 0%, #211915 100%);
}

html[data-theme="dark"] .result-card.is-illuminated {
  border-color: #a98448;
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(214, 173, 91, 0.12),
    0 0 28px rgba(214, 173, 91, 0.09);
  filter: brightness(1.035) saturate(1.02);
}

html[data-theme="dark"] .result-card.is-illuminated .source-panel {
  background: linear-gradient(135deg, #2a211b 0%, #241b17 52%, #201814 100%);
}

html[data-theme="dark"] .result-card.is-illuminated .bible-panel {
  background: linear-gradient(135deg, #30251e 0%, #292019 52%, #241b17 100%);
}

html[data-theme="dark"] .result-card.is-illuminated .source-text,
html[data-theme="dark"] .result-card.is-illuminated .bible-text,
html[data-theme="dark"] .result-card.is-illuminated .source-arabic-text,
html[data-theme="dark"] .result-card.is-illuminated .catechism-text {
  color: #fff1d8;
}

/* Reduced-motion users receive the readable brighter state without a fade. */
html[data-reduce-motion="true"] .result-card,
html[data-reduce-motion="true"] .result-card > .source-panel,
html[data-reduce-motion="true"] .result-card > .bible-panel {
  transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .result-card,
  .result-card > .source-panel,
  .result-card > .bible-panel {
    transition: none !important;
  }
}

html[data-reduce-motion="true"][data-theme="dark"] .result-card {
  filter: none;
}

@media (max-width: 1040px) {
  .reader-tools {
    padding: 0.42rem 0 0.5rem;
    border-left: 0;
  }
}

@media (max-width: 760px) {
  .control-panel-inner {
    padding-inline: 0.72rem;
  }

  .control-panel-inner .filters {
    padding-block: 0.5rem;
  }
}

/* High-contrast mode keeps strict contrast instead of decorative gradients. */
html[data-contrast="high"][data-theme="light"] .control-panel {
  background: #e8e8e8;
  border-color: #000;
}

html[data-contrast="high"][data-theme="dark"] .control-panel {
  background: #000;
  border-color: #fff;
}

html[data-contrast="high"][data-theme="dark"] .result-card,
html[data-contrast="high"][data-theme="dark"] .result-card.is-illuminated,
html[data-contrast="high"][data-theme="dark"] .result-card .source-panel,
html[data-contrast="high"][data-theme="dark"] .result-card .bible-panel,
html[data-contrast="high"][data-theme="dark"] .result-card.is-illuminated .source-panel,
html[data-contrast="high"][data-theme="dark"] .result-card.is-illuminated .bible-panel {
  background: #000;
  border-color: #fff;
  color: #fff;
  filter: none;
  box-shadow: none;
}

/* ========================================================================== 
   V7 FULL AUDIT — ON-DEMAND ARABIC WITNESS + REVIEWED MICRO-ANALYSIS
   ========================================================================== */
.full-audit-arabic-language-block {
  border-left-color: var(--burgundy);
  background: #fffdf8;
}

.arabic-source-controls {
  margin-top: 0.35rem;
}

.arabic-source-toggle {
  min-width: 7.2rem;
}

.arabic-source-panel {
  border-color: #c9ab75;
  background: #fffaf0;
}

.full-audit-arabic-source-text {
  margin: 0;
  color: #211713;
  font-family: "Amiri Quran", "Noto Naskh Arabic", "Traditional Arabic", serif;
  font-size: 2.7rem;
  font-weight: 700;
  line-height: 1.95;
  text-align: right;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  unicode-bidi: plaintext;
}

.arabic-source-metadata {
  display: grid;
  gap: 0.2rem;
  margin-top: 0.72rem;
  padding-top: 0.62rem;
  border-top: 1px solid var(--border-soft);
}

.arabic-source-metadata p {
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.45;
}

.arabic-source-provenance {
  font-style: italic;
}

.arabic-micro-analysis {
  margin-top: 0.85rem;
  padding-top: 0.72rem;
  border-top: 1px solid var(--border-soft);
}

.arabic-micro-analysis > h6 {
  margin-bottom: 0.55rem;
}

.arabic-micro-analysis-list {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.36rem;
}

.arabic-micro-analysis-item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.1rem;
  min-width: 4.2rem;
  max-width: 10rem;
  padding: 0.32rem 0.42rem;
  border: 1px solid var(--border-soft);
  border-radius: 0.25rem;
  background: #fffefb;
  text-align: center;
}

.arabic-micro-analysis-source {
  color: var(--text);
  font-family: "Amiri Quran", "Noto Naskh Arabic", serif;
  font-size: 1rem;
  line-height: 1.45;
}

.arabic-micro-analysis-detail {
  display: block;
  color: var(--muted);
  font-size: 0.56rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

html[data-theme="dark"] .full-audit-arabic-language-block,
html[data-theme="dark"] .arabic-source-panel,
html[data-theme="dark"] .arabic-micro-analysis-item {
  background: var(--panel);
  color: var(--text);
}

html[data-theme="dark"] .full-audit-arabic-source-text,
html[data-theme="dark"] .arabic-micro-analysis-source {
  color: #fff1d8;
}

html[data-contrast="high"] .full-audit-arabic-language-block,
html[data-contrast="high"] .arabic-source-panel,
html[data-contrast="high"] .arabic-micro-analysis-item {
  background: var(--panel);
  border-color: var(--border);
  color: var(--text);
}

@media (max-width: 720px) {
  .full-audit-arabic-language-block {
    padding: 0.78rem 0.7rem;
  }

  .arabic-source-panel {
    padding: 0.72rem;
  }

  .full-audit-arabic-source-text {
    font-size: 2.4rem;
  }
}


/* ==========================================================================
   V8 CLEAN FILTERS — NO PUBLIC TAG CONTROLS
   Keep the database classification/sort metadata intact, while presenting a
   balanced search surface without the retired rule-tag control.
   ========================================================================== */
.control-panel-inner .filters {
  grid-template-areas:
    "search search classification source"
    "confidence confidence actions actions";
}

.control-panel-inner .field-search { grid-area: search; }
.control-panel-inner .field-classification { grid-area: classification; }
.control-panel-inner .field-source { grid-area: source; }
.control-panel-inner .field-confidence { grid-area: confidence; }
.control-panel-inner .button-row { grid-area: actions; }

@media (max-width: 1040px) {
  .control-panel-inner .filters {
    grid-template-areas:
      "search search"
      "classification source"
      "confidence confidence"
      "actions actions";
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (max-width: 620px) {
  .control-panel-inner .filters {
    grid-template-areas:
      "search"
      "classification"
      "source"
      "confidence"
      "actions";
    grid-template-columns: minmax(0, 1fr);
  }
}


/* ========================================================================== 
   SEARCH INTENT GATE — idle, examples, browse-all, and no-result states
   ========================================================================== */
.control-panel-inner .button-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.search-state-card {
  width: 100%;
  min-height: clamp(12rem, 28vh, 18rem);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.7rem;
  padding: clamp(1.5rem, 4vw, 3rem);
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  border-radius: 1rem;
  background:
    radial-gradient(circle at 50% 0%, rgba(201, 150, 47, 0.08), transparent 18rem),
    color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: 0 12px 28px color-mix(in srgb, var(--shadow) 72%, transparent);
  text-align: center;
}

.search-state-card h2 {
  margin: 0;
  color: var(--burgundy);
  font-family: "Cinzel", Georgia, serif;
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  letter-spacing: 0.035em;
}

.search-state-card p {
  max-width: 42rem;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.search-example-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

button.search-example {
  min-height: 2rem;
  padding: 0.38rem 0.7rem;
  border-color: color-mix(in srgb, var(--gold) 50%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 88%, var(--gold) 12%);
  color: var(--burgundy);
  font-size: 0.78rem;
  font-weight: 600;
  box-shadow: none;
}

button.search-example:hover,
button.search-example:focus-visible {
  border-color: var(--gold);
  filter: none;
  box-shadow: 0 0 0 3px rgba(201, 150, 47, 0.14);
}

html[data-theme="dark"] .search-state-card h2,
html[data-theme="dark"] button.search-example {
  color: var(--text);
}

@media (max-width: 620px) {
  .control-panel-inner .button-row {
    grid-template-columns: 1fr;
  }
}


/* ========================================================================== 
   V3 MISSION STATEMENT — theory-led introduction using the brand type system
   ========================================================================== */
.mission-section {
  max-width: min(var(--container), 1320px);
  margin: 0 auto;
  padding: 0 1.4rem 1.35rem;
}

.mission-card {
  position: relative;
  overflow: hidden;
  padding: clamp(1.7rem, 4vw, 3.15rem) clamp(1.25rem, 5vw, 4.75rem);
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  border-top-color: color-mix(in srgb, var(--gold) 72%, var(--border));
  border-bottom-color: color-mix(in srgb, var(--gold) 72%, var(--border));
  background:
    linear-gradient(90deg, transparent, rgba(201, 150, 47, 0.10), transparent) top / 100% 1px no-repeat,
    radial-gradient(circle at 50% -14%, rgba(201, 150, 47, 0.15), transparent 24rem),
    linear-gradient(145deg, color-mix(in srgb, var(--panel) 96%, white 4%), color-mix(in srgb, var(--panel-soft) 92%, transparent));
  box-shadow: 0 16px 38px color-mix(in srgb, var(--shadow) 76%, transparent);
  text-align: center;
}

.mission-card::before,
.mission-card::after {
  content: "";
  position: absolute;
  top: 1.1rem;
  bottom: 1.1rem;
  width: 1px;
  background: linear-gradient(transparent, color-mix(in srgb, var(--gold) 58%, transparent), transparent);
  opacity: 0.72;
  pointer-events: none;
}

.mission-card::before { left: 1rem; }
.mission-card::after { right: 1rem; }

.mission-kicker {
  margin: 0 0 0.65rem;
  color: var(--gold);
  font-family: "Cinzel", "Cormorant Garamond", "EB Garamond", Georgia, serif;
  font-size: clamp(0.72rem, 1.2vw, 0.9rem);
  font-weight: 600;
  letter-spacing: 0.19em;
  text-transform: uppercase;
}

.mission-card h2 {
  margin: 0;
  color: var(--burgundy);
  font-family: "Cinzel", "Cormorant Garamond", "EB Garamond", Georgia, serif;
  font-size: clamp(1.45rem, 3vw, 2.35rem);
  font-weight: 500;
  letter-spacing: 0.075em;
  line-height: 1.15;
}

.mission-card h2::after {
  content: "";
  display: block;
  width: clamp(5rem, 16vw, 9rem);
  height: 1px;
  margin: 0.85rem auto 1.1rem;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.mission-copy {
  max-width: 68rem;
  margin: 0 auto;
  color: var(--text);
  font-family: "EB Garamond", "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.08rem, 1.7vw, 1.32rem);
  line-height: 1.72;
  text-wrap: pretty;
}

.mission-copy p {
  margin: 0;
}

.mission-copy p + p {
  margin-top: 0.85rem;
}

html[data-theme="dark"] .mission-card {
  background:
    linear-gradient(90deg, transparent, rgba(214, 173, 91, 0.18), transparent) top / 100% 1px no-repeat,
    radial-gradient(circle at 50% -14%, rgba(214, 173, 91, 0.15), transparent 24rem),
    linear-gradient(145deg, color-mix(in srgb, var(--panel) 96%, black 4%), color-mix(in srgb, var(--panel-soft) 92%, transparent));
}

html[data-theme="dark"] .mission-card h2,
html[data-theme="dark"] .mission-copy {
  color: var(--text);
}

html[data-readable-font="true"] .mission-card,
html[data-readable-font="true"] .mission-kicker,
html[data-readable-font="true"] .mission-card h2,
html[data-readable-font="true"] .mission-copy {
  font-family: Verdana, Arial, Helvetica, sans-serif;
}

html[data-contrast="high"] .mission-card {
  border-width: 2px;
  box-shadow: none;
}

@media (max-width: 720px) {
  .mission-section {
    padding-inline: 0.8rem;
    padding-bottom: 1rem;
  }

  .mission-card {
    padding: 1.55rem 1.15rem 1.7rem;
  }

  .mission-card::before,
  .mission-card::after {
    display: none;
  }

  .mission-copy {
    font-size: 1.06rem;
    line-height: 1.62;
  }
}

/* ==========================================================================
   V4 MISSION IN SEARCH RESULTS — visible only while the audit browser is idle
   ========================================================================== */
.results > .mission-section {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.mission-search-prompt {
  max-width: 48rem;
  margin: 1.35rem auto 0;
  padding-top: 1.15rem;
  border-top: 1px solid color-mix(in srgb, var(--gold) 42%, transparent);
}

.mission-search-prompt h3 {
  margin: 0 0 0.45rem;
  color: var(--burgundy);
  font-family: "Cinzel", "Cormorant Garamond", "EB Garamond", Georgia, serif;
  font-size: clamp(1rem, 1.8vw, 1.25rem);
  font-weight: 600;
  letter-spacing: 0.055em;
}

.mission-search-prompt p {
  margin: 0;
  color: var(--muted);
  font-family: "EB Garamond", "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1rem, 1.4vw, 1.12rem);
  line-height: 1.55;
}

.mission-search-prompt .search-example-row {
  margin-top: 0.85rem;
}

html[data-theme="dark"] .mission-search-prompt h3 {
  color: var(--text);
}

html[data-readable-font="true"] .mission-search-prompt,
html[data-readable-font="true"] .mission-search-prompt h3,
html[data-readable-font="true"] .mission-search-prompt p {
  font-family: Verdana, Arial, Helvetica, sans-serif;
}

@media (max-width: 720px) {
  .results > .mission-section {
    padding: 0;
  }

  .mission-search-prompt {
    margin-top: 1.05rem;
    padding-top: 1rem;
  }
}



/* ==========================================================================
   V11.4.9 COMPACT HORIZONTAL INTERLINEAR + ARABIC READABILITY
   The original-language word, transliteration, phonetics and gloss remain
   vertically aligned inside compact cells. Words never wrap; a verse scrolls
   horizontally when it is wider than the popup.
   ========================================================================== */

.bible-original-replacement {
  width: 100%;
  min-width: 0;
}

.bible-original-replacement[data-mode="loading"] {
  margin-top: 0.72rem;
  padding: 0.72rem 0.82rem;
  border: 1px solid var(--border-soft);
  border-radius: 0.5rem;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.8rem;
  font-style: italic;
}

.bible-original-replacement[data-mode="interlinear"] .bible-original-toggle,
.bible-original-replacement[data-mode="interlinear"] .bible-original-controls {
  display: none !important;
}

.bible-original-fallback-controls {
  justify-content: center;
}

.bible-interlinear-auto-panel,
.bible-interlinear-study {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.bible-interlinear-heading-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
  text-align: center;
}

.bible-interlinear-heading-row h6 {
  margin: 0;
  font-size: 0.9rem;
  text-align: center;
}

.bible-interlinear-review-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.55rem;
  padding: 0.12rem 0.52rem;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 750;
  line-height: 1.2;
  text-align: center;
}

.bible-interlinear-feature-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.32rem;
  margin: 0.45rem auto 0.55rem;
}

.bible-interlinear-feature-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.95rem;
  padding: 0.28rem 0.58rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 750;
  line-height: 1;
  text-align: center;
  cursor: pointer;
}

.bible-interlinear-feature-toggle[aria-pressed="true"] {
  background: var(--burgundy);
  color: #fff;
}

/*
 * V11.4.13 PERSISTENT INTERLINEAR DISPLAY TOGGLES
 *
 * Only token fields participate in show/hide behaviour. Toolbar controls
 * remain visible regardless of the state of the field they control.
 */
.bible-interlinear-token [data-feature] {
  display: none;
}

.bible-interlinear-study.show-transliteration
  .bible-interlinear-token [data-feature="transliteration"],
.bible-interlinear-study.show-pronunciation
  .bible-interlinear-token [data-feature="pronunciation"],
.bible-interlinear-study.show-gloss
  .bible-interlinear-token [data-feature="gloss"],
.bible-interlinear-study.show-morphology
  .bible-interlinear-token [data-feature="morphology"],
.bible-interlinear-study.show-lemma
  .bible-interlinear-token [data-feature="lemma"] {
  display: block;
}

.bible-interlinear-feature-toggle {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1;
  flex: 0 0 auto;
}

.bible-interlinear-feature-toggle[aria-pressed="false"] {
  background: var(--panel);
  color: var(--text);
  border-color: var(--border);
  box-shadow: none;
}

.bible-interlinear-feature-toggle[aria-pressed="true"],
.bible-interlinear-feature-toggle.is-active {
  background: var(--burgundy);
  color: #fff;
}

.bible-interlinear-reading-note {
  max-width: 56rem;
  margin: 0.35rem auto 0.7rem;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.4;
  text-align: center;
}

.bible-interlinear-verse {
  position: relative;
  width: 100%;
  min-width: 0;
  margin: 0.85rem 0 1rem;
  box-sizing: border-box;
}

.bible-interlinear-verse > h6 {
  margin: 0 0 0.42rem;
  font-size: 0.82rem;
  text-align: left;
}

.bible-interlinear-token-grid {
  display: flex;
  align-items: stretch;
  gap: 0.34rem;
  width: 100%;
  min-width: 0;
  padding: 0.08rem 0 0.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  box-sizing: border-box;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.bible-interlinear-token-grid[dir="rtl"] {
  direction: rtl;
}

.bible-interlinear-token {
  display: grid;
  grid-template-rows:
    minmax(1.8rem, auto)
    minmax(1.15rem, auto)
    minmax(1.15rem, auto)
    minmax(1.55rem, auto);
  align-content: start;
  justify-items: center;
  flex: 0 0 auto;
  min-width: 5.6rem;
  width: max-content;
  max-width: none;
  min-height: 6.25rem;
  padding: 0.48rem 0.54rem;
  border: 1px solid var(--border-soft);
  border-radius: 0.48rem;
  background: var(--panel);
  color: var(--text);
  box-sizing: border-box;
  text-align: center;
}

.bible-interlinear-token:focus-visible {
  outline: 0.16rem solid currentColor;
  outline-offset: 0.12rem;
}

.bible-interlinear-lemma,
.bible-interlinear-surface,
.bible-interlinear-transliteration,
.bible-interlinear-pronunciation,
.bible-interlinear-gloss,
.bible-interlinear-morphology {
  min-width: 0;
  max-width: 10rem;
  margin: 0;
  box-sizing: border-box;
  text-align: center;
}

.bible-interlinear-surface {
  max-width: none;
  align-self: center;
  justify-self: center;
  font-size: clamp(1.02rem, 1.45vw, 1.24rem);
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}

.bible-interlinear-hebrew .bible-interlinear-surface {
  direction: rtl;
  font-family: "Noto Serif Hebrew", "Times New Roman", serif;
  font-size: clamp(1.08rem, 1.55vw, 1.3rem);
}

.bible-interlinear-greek .bible-interlinear-surface {
  font-family: "Noto Serif", "Times New Roman", Georgia, serif;
}

.bible-interlinear-transliteration,
.bible-interlinear-pronunciation {
  font-size: 0.75rem;
  line-height: 1.25;
  white-space: nowrap;
}

.bible-interlinear-transliteration {
  font-style: italic;
}

.bible-interlinear-pronunciation {
  color: var(--muted);
}

.bible-interlinear-gloss {
  max-width: 8.75rem;
  font-size: 0.75rem;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.bible-interlinear-lemma,
.bible-interlinear-morphology {
  grid-column: 1;
  max-width: 10rem;
  color: var(--muted);
  font-size: 0.64rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.bible-interlinear-study.show-lemma .bible-interlinear-token,
.bible-interlinear-study.show-morphology .bible-interlinear-token {
  min-height: 7.5rem;
}

.bible-interlinear-source-details {
  max-width: 56rem;
  margin: 0.55rem auto 0;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.4;
}

.bible-interlinear-source-details summary {
  width: fit-content;
  margin: 0 auto;
  cursor: pointer;
  font-weight: 700;
  text-align: center;
}

.bible-interlinear-source,
.bible-interlinear-provenance {
  margin: 0.45rem auto 0;
  overflow-wrap: anywhere;
  text-align: center;
}

.bible-interlinear-source a {
  color: inherit;
}

.bible-interlinear-verse.is-collapsed .bible-interlinear-token:nth-child(n + 25) {
  display: none;
}

.bible-interlinear-verse-toggle {
  display: block;
  width: 2.75rem;
  min-width: 2.75rem;
  min-height: 2.1rem;
  margin: 0.4rem auto 0;
  padding: 0.1rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 0.42rem;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  cursor: pointer;
}

.bible-interlinear-verse-toggle:focus-visible {
  outline: 0.16rem solid currentColor;
  outline-offset: 0.15rem;
}

/* Larger Arabic source text for easier reading. */
.full-audit-arabic-source-text {
  font-size: 2.7rem;
  line-height: 1.95;
}

@media (max-width: 720px) {
  .bible-interlinear-heading-row {
    gap: 0.4rem;
  }

  .bible-interlinear-feature-controls {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.2rem;
  }

  .bible-interlinear-feature-toggle {
    flex: 0 0 auto;
  }

  .bible-interlinear-token {
    min-width: 5.15rem;
    max-width: none;
    padding: 0.42rem 0.46rem;
  }

  .bible-interlinear-surface {
    font-size: 1.02rem;
  }

  .bible-interlinear-hebrew .bible-interlinear-surface {
    font-size: 1.08rem;
  }

  .full-audit-arabic-source-text {
    font-size: 2.4rem;
  }
}

@media (max-width: 430px) {
  .bible-interlinear-token {
    min-width: 4.9rem;
    max-width: none;
  }

  .bible-interlinear-transliteration,
  .bible-interlinear-pronunciation,
  .bible-interlinear-gloss {
    font-size: 0.71rem;
  }
}



/* ==========================================================================
   V11.4.12 ALL REFERENCES + FIXED INTERLINEAR TOOLBAR
   The display controls live in a separate non-scrolling toolbar above the
   verse text. Only each word-aligned verse row scrolls horizontally.
   ========================================================================== */

.bible-original-passage,
.bible-original-panel,
.bible-original-replacement,
.bible-interlinear-auto-panel,
.bible-interlinear-study,
.bible-interlinear-verse-list {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.bible-interlinear-auto-panel {
  overflow-x: hidden;
}

.bible-interlinear-toolbar {
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: 0;
  margin: 0 0 0.75rem;
  padding: 0.68rem 0.72rem;
  border: 1px solid var(--border-soft);
  border-radius: 0.55rem;
  background: color-mix(in srgb, var(--panel) 94%, var(--gold) 6%);
  box-sizing: border-box;
  overflow: visible;
}

.bible-interlinear-heading-row {
  justify-content: flex-start;
  margin: 0 0 0.48rem;
  text-align: left;
}

.bible-interlinear-heading-row h6 {
  text-align: left;
}

.bible-interlinear-feature-controls {
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: visible;
}

.bible-interlinear-controls-label {
  flex: 0 0 auto;
  margin-right: 0.1rem;
  color: var(--muted);
  font-size: 0.69rem;
  font-weight: 800;
  line-height: 1.2;
}

.bible-interlinear-reading-note {
  max-width: none;
  margin: 0.52rem 0 0;
  text-align: left;
}

.bible-interlinear-verse-list {
  width: 100%;
  overflow: visible;
}

.bible-interlinear-token-grid {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

@media (max-width: 720px) {
  .bible-interlinear-toolbar {
    padding: 0.62rem;
  }

  .bible-interlinear-feature-controls {
    justify-content: flex-start;
    flex-wrap: wrap;
    overflow: visible;
    padding-bottom: 0;
  }

  .bible-interlinear-controls-label {
    flex-basis: 100%;
    margin-bottom: 0.12rem;
  }
}

@supports not (background: color-mix(in srgb, white 94%, black 6%)) {
  .bible-interlinear-toolbar {
    background: var(--panel);
  }
}
/* DCF/CNR pending display visual styles — flag-off stage.
   These styles are inert until ENABLE_DCF_CNR_PENDING_DISPLAY is separately enabled. */
.audit-sidecar-panel {
  border: 1px solid rgba(197, 151, 85, 0.34);
  background:
    linear-gradient(90deg, rgba(197, 151, 85, 0.10), transparent 42%),
    rgba(197, 151, 85, 0.045);
  padding: 0;
}

.audit-sidecar-panel--pending {
  color: inherit;
}

.audit-sidecar-header {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.82rem 0.95rem;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.audit-sidecar-header:focus-visible {
  outline: 2px solid rgba(197, 151, 85, 0.78);
  outline-offset: -2px;
}

.audit-sidecar-marker {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 999px;
  background: rgba(197, 151, 85, 0.95);
  box-shadow: 0 0 0 0.28rem rgba(197, 151, 85, 0.14);
  flex: 0 0 auto;
}

.audit-sidecar-title-group {
  min-width: 0;
  flex: 1 1 auto;
}

.audit-sidecar-title {
  display: block;
  font-weight: 750;
  font-size: 0.96rem;
  line-height: 1.25;
}

.audit-sidecar-subtitle {
  display: block;
  color: var(--muted-text, rgba(235, 225, 210, 0.72));
  font-size: 0.82rem;
  line-height: 1.35;
  margin-top: 0.14rem;
}

.audit-sidecar-toggle {
  color: rgba(197, 151, 85, 0.95);
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
  flex: 0 0 auto;
}

.audit-sidecar-body {
  border-top: 1px solid rgba(197, 151, 85, 0.22);
  padding: 0.86rem 0.95rem 0.98rem;
}

.audit-sidecar-note {
  margin: 0 0 0.78rem;
  color: var(--muted-text, rgba(235, 225, 210, 0.74));
  font-size: 0.88rem;
  line-height: 1.55;
}

.audit-sidecar-status-grid {
  display: grid;
  grid-template-columns: minmax(8.5rem, 12rem) minmax(0, 1fr);
  gap: 0.4rem 0.8rem;
  margin: 0;
  font-size: 0.88rem;
}

.audit-sidecar-status-grid dt {
  color: var(--muted-text, rgba(235, 225, 210, 0.70));
  margin: 0;
}

.audit-sidecar-status-grid dd {
  margin: 0;
  min-width: 0;
}

.audit-sidecar-value--pending {
  color: rgba(197, 151, 85, 0.96);
  font-weight: 650;
}

@media (max-width: 720px) {
  .audit-sidecar-header {
    align-items: flex-start;
    gap: 0.65rem;
  }

  .audit-sidecar-status-grid {
    grid-template-columns: 1fr;
    gap: 0.14rem;
  }

  .audit-sidecar-status-grid dt {
    font-size: 0.78rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .audit-sidecar-marker {
    box-shadow: none;
  }
}
