/*
 * Complete Urtext source view.
 * The grouped lemma cards remain useful for discovery; this layer makes the
 * underlying MACULA chapter rows first-class, readable research material.
 */
#ORIGINALMODE[aria-hidden="false"] {
  --oc-accent: #7fe5d2;
  --oc-accent-soft: rgba(127, 229, 210, .12);
  --oc-gold: #d9b978;
  --oc-line: rgba(171, 220, 218, .16);
  --oc-panel: rgba(11, 28, 41, .94);
  --oc-panel-deep: rgba(5, 15, 24, .94);
}

#ORIGINALMODE[aria-hidden="false"] .original-complete-panel {
  position: relative;
  margin: 14px 0;
  padding: 16px;
  border: 1px solid var(--oc-line);
  border-radius: 14px;
  background:
    radial-gradient(circle at 4% 0%, rgba(127, 229, 210, .10), transparent 30%),
    linear-gradient(180deg, var(--oc-panel), var(--oc-panel-deep));
  box-shadow: 0 18px 42px rgba(0, 0, 0, .26), inset 0 1px rgba(255, 255, 255, .04);
}

#ORIGINALMODE[aria-hidden="false"] .original-complete-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 13px;
  border-bottom: 1px solid rgba(171, 220, 218, .10);
}

#ORIGINALMODE[aria-hidden="false"] .original-complete-head h2 {
  margin: 4px 0 5px;
  color: #edf8f4;
  font-family: var(--gu-display, Georgia, serif);
  font-size: clamp(1.25rem, 2vw, 1.72rem);
  font-weight: 650;
  line-height: 1.05;
}

#ORIGINALMODE[aria-hidden="false"] .original-complete-head p {
  max-width: 680px;
  margin: 0;
  color: var(--gu-muted, #8aa3a9);
  font-size: .70rem;
  line-height: 1.45;
}

#ORIGINALMODE[aria-hidden="false"] .original-complete-count {
  flex: 0 0 auto;
  min-width: 84px;
  padding: 9px 10px;
  border: 1px solid rgba(127, 229, 210, .28);
  border-radius: 9px;
  background: rgba(127, 229, 210, .07);
  text-align: right;
}

#ORIGINALMODE[aria-hidden="false"] .original-complete-count strong {
  display: block;
  color: var(--oc-accent);
  font-family: var(--gu-mono, ui-monospace, monospace);
  font-size: 1.08rem;
  line-height: 1;
}

#ORIGINALMODE[aria-hidden="false"] .original-complete-count span {
  display: block;
  margin-top: 4px;
  color: var(--gu-muted, #8aa3a9);
  font-size: .49rem;
  letter-spacing: .08em;
  line-height: 1.2;
  text-transform: uppercase;
}

#ORIGINALMODE[aria-hidden="false"] .original-complete-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 11px 0 12px;
}

#ORIGINALMODE[aria-hidden="false"] .original-complete-summary span {
  padding: 5px 8px;
  border: 1px solid rgba(171, 220, 218, .12);
  border-radius: 999px;
  background: rgba(255, 255, 255, .025);
  color: var(--gu-muted, #8aa3a9);
  font-family: var(--gu-mono, ui-monospace, monospace);
  font-size: .49rem;
  letter-spacing: .02em;
}

#ORIGINALMODE[aria-hidden="false"] .original-complete-summary b {
  color: var(--oc-gold);
  font-weight: 650;
}

#ORIGINALMODE[aria-hidden="false"] .original-source-table {
  max-height: min(68vh, 740px);
  overflow: auto;
  border: 1px solid rgba(171, 220, 218, .12);
  border-radius: 10px;
  background: rgba(3, 11, 18, .56);
  scrollbar-color: rgba(127, 229, 210, .34) transparent;
}

#ORIGINALMODE[aria-hidden="false"] .original-source-header,
#ORIGINALMODE[aria-hidden="false"] .original-source-row {
  display: grid;
  grid-template-columns: 58px minmax(110px, 1.24fr) minmax(92px, 1fr) minmax(95px, 1fr) minmax(100px, 1fr) 62px;
  gap: 0;
  min-width: 0;
}

#ORIGINALMODE[aria-hidden="false"] .original-source-header {
  position: sticky;
  z-index: 2;
  top: 0;
  min-height: 31px;
  align-items: center;
  border-bottom: 1px solid rgba(127, 229, 210, .18);
  background: rgba(7, 19, 29, .98);
  color: var(--gu-muted, #8aa3a9);
  font-family: var(--gu-mono, ui-monospace, monospace);
  font-size: .48rem;
  letter-spacing: .10em;
  text-transform: uppercase;
}

#ORIGINALMODE[aria-hidden="false"] .original-source-header span {
  padding: 0 9px;
}

#ORIGINALMODE[aria-hidden="false"] .original-source-row {
  min-height: 67px;
  align-items: stretch;
  border-bottom: 1px solid rgba(171, 220, 218, .08);
  transition: background .18s ease, box-shadow .18s ease;
}

#ORIGINALMODE[aria-hidden="false"] .original-source-row:last-child {
  border-bottom: 0;
}

#ORIGINALMODE[aria-hidden="false"] .original-source-row:hover {
  background: linear-gradient(90deg, rgba(127, 229, 210, .10), rgba(127, 229, 210, .025));
  box-shadow: inset 3px 0 var(--oc-accent);
}

#ORIGINALMODE[aria-hidden="false"] .original-source-cell {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 8px 9px;
  border-right: 1px solid rgba(171, 220, 218, .07);
}

#ORIGINALMODE[aria-hidden="false"] .original-source-cell:last-child {
  border-right: 0;
}

#ORIGINALMODE[aria-hidden="false"] .original-source-cell small {
  color: #68858d;
  font-family: var(--gu-mono, ui-monospace, monospace);
  font-size: .43rem;
  letter-spacing: .08em;
  line-height: 1;
  text-transform: uppercase;
}

#ORIGINALMODE[aria-hidden="false"] .original-source-cell b {
  overflow: hidden;
  color: #dcece8;
  font-size: .65rem;
  font-weight: 600;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#ORIGINALMODE[aria-hidden="false"] .original-source-cell em {
  overflow: hidden;
  color: #78969a;
  font-size: .51rem;
  font-style: normal;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#ORIGINALMODE[aria-hidden="false"] .original-source-ref b {
  color: var(--oc-gold);
  font-family: var(--gu-mono, ui-monospace, monospace);
  font-size: .66rem;
}

#ORIGINALMODE[aria-hidden="false"] .original-source-ref em {
  color: #86a2a2;
  font-family: var(--gu-mono, ui-monospace, monospace);
  font-size: .46rem;
}

#ORIGINALMODE[aria-hidden="false"] .original-source-form b {
  overflow: visible;
  color: #f2f7ed;
  font-family: var(--gu-reading, Georgia, serif);
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.15;
  text-overflow: clip;
  white-space: normal;
}

#ORIGINALMODE[aria-hidden="false"] .original-source-form em {
  color: var(--oc-accent);
  font-family: var(--gu-mono, ui-monospace, monospace);
}

#ORIGINALMODE[aria-hidden="false"] .original-source-language b {
  color: var(--oc-accent);
  font-size: .56rem;
}

#ORIGINALMODE[aria-hidden="false"] .original-source-empty {
  padding: 30px 18px;
  color: var(--gu-muted, #8aa3a9);
  font-size: .72rem;
  text-align: center;
}

@media (max-width: 900px) {
  #ORIGINALMODE[aria-hidden="false"] .original-complete-panel {
    margin: 10px 0;
    padding: 12px;
    border-radius: 11px;
  }

  #ORIGINALMODE[aria-hidden="false"] .original-complete-head {
    gap: 12px;
  }

  #ORIGINALMODE[aria-hidden="false"] .original-complete-head h2 {
    font-size: 1.28rem;
  }

  #ORIGINALMODE[aria-hidden="false"] .original-complete-head p {
    font-size: .65rem;
  }

  #ORIGINALMODE[aria-hidden="false"] .original-complete-count {
    min-width: 68px;
    padding: 8px 7px;
  }

  #ORIGINALMODE[aria-hidden="false"] .original-complete-count strong {
    font-size: .92rem;
  }

  #ORIGINALMODE[aria-hidden="false"] .original-source-table {
    max-height: 62vh;
  }

  #ORIGINALMODE[aria-hidden="false"] .original-source-header {
    display: none;
  }

  #ORIGINALMODE[aria-hidden="false"] .original-source-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    min-width: 0;
    padding: 4px 0;
  }

  #ORIGINALMODE[aria-hidden="false"] .original-source-cell {
    min-height: 54px;
    padding: 7px 8px;
  }

  #ORIGINALMODE[aria-hidden="false"] .original-source-ref {
    grid-column: 1 / -1;
    min-height: 34px;
    flex-direction: row;
    align-items: baseline;
    gap: 7px;
    padding-bottom: 2px;
    border-right: 0;
  }

  #ORIGINALMODE[aria-hidden="false"] .original-source-ref small {
    order: 0;
  }

  #ORIGINALMODE[aria-hidden="false"] .original-source-ref b {
    order: 1;
  }

  #ORIGINALMODE[aria-hidden="false"] .original-source-ref em {
    order: 2;
  }

  #ORIGINALMODE[aria-hidden="false"] .original-source-cell:nth-child(odd) {
    border-right: 0;
  }

  #ORIGINALMODE[aria-hidden="false"] .original-source-cell b {
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  #ORIGINALMODE[aria-hidden="false"] .original-source-row {
    transition: none;
  }
}
