/* 🌟 Code Latin Treebank - Clean Layout + Side-by-Side Text Boxes */

/* Typeface imports */
@font-face {
  font-family: 'Neon';
  src: url('fonts/neon-regular-webfont.woff2') format('woff2'),
       url('fonts/neon-regular-webfont.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Neon';
  src: url('fonts/neon-bold-webfont.woff2') format('woff2'),
       url('fonts/neon-bold-webfont.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* 🔷 Page Body */
html, body { height: 100%; }
/* Responsive base font: scales with viewport, clamped for usability */
html { font-size: calc(var(--tbv-base-font-size) * var(--tbv-ui-scale, 1)); }
:root {
  --global-ui-zoom: 1;
  --panel-w: 160px;
  --tree-pane: 28%;
  --table-pane: 100%;
  --inspector-pane: 0%;
  --json-pane: 32%;
  --clause-col-width: 60px;
  --latin-col-width: 120px;
  --dictionary-col-width: 0px;
  --frieze-col-width: 2000px;
  --lewis-col-width: 320px;
  --parsing-col-width: 360px;
  --inline-edit-col-width: 160px;
  --word-table-width: auto;
  --tbv-ui-scale: 1;
  --sticky-offset: 0px;
  --tbv-toolbar-h: 0px;
  --tbv-loader-h: 0px;
  --tbv-meta-h: 0px;
  --tbv-header-h: 0px;
  --header-row-height: 0px;
  --tbv-page-gutter: 16px;
  --tbv-base-font-size: clamp(14px, 0.35vw + 12px, 22px);
  --editor-footer-offset: 0px;
  --word-table-min-width: 0px;
}

@media (min-width: 1280px) and (max-height: 960px) {
  :root {
    --tbv-ui-scale: 0.88;
    --tbv-page-gutter: clamp(10px, 1.8vw, 22px);
  }

  body.treebanks-page {
    font-size: 0.95em;
  }
}

body.treebanks-page {
  --tbv-page-gutter: clamp(8px, 2vw, 20px);
  padding-bottom: var(--editor-footer-offset, 0px);
}

body.tree-mode-senior {
  background-color: #fff8eb;
}

body.tree-mode-senior .panel,
body.tree-mode-senior .create-card {
  border-color: #d97706;
}

body.tree-mode-senior .word-table-header {
  background: #fef3c7;
  border-bottom-color: #fcd34d;
}

body.treebanks-page .logo-row,
body.treebanks-page .global-nav,
body.treebanks-page .page-title-row {
  box-sizing: border-box;
}

body.treebanks-page .logo-row {
  padding-left: var(--tbv-page-gutter, 16px);
  padding-right: var(--tbv-page-gutter, 16px);
}

body.treebanks-page .global-nav {
  padding-left: var(--tbv-page-gutter, 16px);
  padding-right: var(--tbv-page-gutter, 16px);
}

body.treebanks-page .page-title-row {
  padding-left: var(--tbv-page-gutter, 16px);
  padding-right: var(--tbv-page-gutter, 16px);
}
body {
  display: flex;
  flex-direction: column;
  font-family: 'DM Sans', sans-serif;
  background-color: white;
  color: black;
  margin: 0;
  overflow-x: hidden; /* prevent horizontal bleed */
}

body.primer-overlay-open {
  overflow: hidden;
}

body.latin-word-modal-open {
  overflow: hidden;
}

body.supplementary-dictionary-modal-open {
  overflow: hidden;
}

#tbv-stage {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
  box-sizing: border-box;
  padding: 0;
}

#tbv-root {
  flex: 1 1 auto;
  width: 100%;
}

body.tree-view-active #tbv-sticky-stack {
  position: sticky;
  top: 0;
  z-index: 180;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: #fff;
}

body:not(.tree-view-active) #tbv-sticky-stack {
  position: relative;
  top: auto;
  z-index: auto;
}

/* children of sticky stack inherit normal flow (avoid nested sticky jumps) */
#tbv-sticky-stack > * {
  position: relative;
  top: auto;
  z-index: auto;
}

.is-hidden {
  display: none !important;
}

#editor-toolbar {
  position: relative;
  top: auto;
  z-index: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 10px var(--tbv-page-gutter, 16px) 8px;
  background: #ffffff;
  border-bottom: 1px solid #d8d8d8;
  box-shadow: none;
}

#editor-toolbar .toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#editor-toolbar .toolbar-view-controls,
#editor-toolbar .toolbar-edit-controls {
  flex: 1 1 100%;
}

#editor-toolbar .toolbar-group.is-hidden {
  display: none;
}

#editor-toolbar .toolbar-mode-toggle {
  flex-shrink: 0;
}

/* Primary toolbar buttons match the black/white Code Latin style */
#editor-toolbar button,
#editor-toolbar a.toolbar-link {
  font-family: 'Montserrat', 'DM Sans', sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  border: 2px solid #fff;
  background: #000;
  color: #fff;
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

#editor-toolbar button:hover,
#editor-toolbar button.is-active,
#editor-toolbar a.toolbar-link:hover,
#editor-toolbar a.toolbar-link.is-active {
  background: #fff;
  color: #000;
  border-color: #000;
  transform: translateY(-1px);
}

#editor-toolbar button:disabled {
  background: #fff;
  color: #000;
  border-color: #000;
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

#toggle-fullscreen,
#toggle-parsing,
#toggle-toolbar-mode,
.toolbar-zoom-controls #zoom-out,
.toolbar-zoom-controls #zoom-in {
  background: #fff;
  color: #000;
  border-color: #000;
}

#toggle-fullscreen:hover,
#toggle-parsing:hover,
#toggle-toolbar-mode:hover,
.toolbar-zoom-controls #zoom-out:hover,
.toolbar-zoom-controls #zoom-in:hover {
  background: #000;
  color: #fff;
  border-color: #fff;
}

.toolbar-tree-label {
  font-family: 'Montserrat', 'DM Sans', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #000;
  background: #fff;
  border: 2px solid #000;
  border-radius: 8px;
  padding: 4px 10px;
  margin-left: 4px;
}


.toolbar-zoom-controls .toggle-btn {
  background: #fff;
  color: #000;
  border: 2px solid #000;
  border-radius: 8px;
  padding: 6px 12px;
  font-family: 'Montserrat', 'DM Sans', sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  min-width: 120px;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.toolbar-zoom-controls .toggle-btn.is-active {
  background: #000;
  color: #fff;
  border-color: #000;
}

.toolbar-zoom-controls .toggle-btn:focus-visible {
  outline: 3px solid rgba(0,0,0,0.4);
  outline-offset: 2px;
}

.toolbar-zoom-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.toolbar-zoom-controls span {
  font-family: 'Montserrat', 'DM Sans', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #000;
}

.toolbar-zoom-controls button {
  padding: 6px 12px;
  min-width: auto;
}

.toolbar-zoom-controls #zoom-reset {
  background: #fff;
  color: #000;
  border-color: #000;
}

.toolbar-zoom-controls #zoom-reset:hover {
  background: #000;
  color: #fff;
  border-color: #fff;
}

.toolbar-zoom-controls #zoom-range {
  width: 140px;
  accent-color: #000;
  background: transparent;
  cursor: pointer;
}

.toolbar-zoom-controls #zoom-range::-webkit-slider-runnable-track {
  height: 4px;
  background: #000;
  border-radius: 999px;
}

.toolbar-zoom-controls #zoom-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: #fff;
  border: 2px solid #000;
  border-radius: 50%;
  margin-top: -5px;
  transition: transform 0.15s ease;
}

.toolbar-zoom-controls #zoom-range::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.toolbar-zoom-controls #zoom-range::-moz-range-track {
  height: 4px;
  background: #000;
  border-radius: 999px;
}

.toolbar-zoom-controls #zoom-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: #fff;
  border: 2px solid #000;
  border-radius: 50%;
  transition: transform 0.15s ease;
}

.toolbar-zoom-controls #zoom-range::-moz-range-thumb:hover {
  transform: scale(1.1);
}

/* Loader bar */
#loader-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px var(--tbv-page-gutter, 16px);
  border-bottom: 1px solid #e6e6e6;
  background: #fff;
  color: #000;
  position: relative;
  top: auto;
  z-index: auto;
}

#loader-bar select {
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
}

/* 🧭 Meta header (head info + navigation) */
#meta-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px var(--tbv-page-gutter, 16px);
  border-bottom: 1px solid #e6e6e6;
  background: #fff;
  position: relative;
  top: auto;
  z-index: auto;
}

/* Remove title; selectors sit in its place */

#selectors-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  flex: 2 1 260px;
  min-width: 0;
}

#selectors-group .selector-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  flex: 1 1 360px;
}

.selector-file-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 360px;
}

.selector-file-nav select {
  flex: 1 1 220px;
  min-width: 160px;
}

.selector-file-nav button {
  min-width: 42px;
  padding: 6px 10px;
}

.selector-view-toggles #go-to-tree {
  min-width: 64px;
  font-weight: 600;
  text-transform: none;
}

.selector-view-toggles {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.selector-view-toggles button {
  min-width: auto;
}

.tree-meta-actions {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  flex: 0 0 auto;
}

#meta-header button {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.2px;
  text-transform: none;
  font-weight: 600;
  border: 1px solid #0f172a;
  background: #0f172a;
  color: #fff;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

#meta-header button:hover {
  background: #fff;
  color: #000;
  border-color: #000;
  transform: translateY(-1px);
}

/* left/right containers not used in one-row layout */

#meta-header select,
#selectors-group select {
  font-family: 'DM Sans', sans-serif;
  border: 2px solid #000;
  background: #fff;
  color: #000;
  padding: 6px 10px;
  border-radius: 8px;
  min-width: 120px;
  flex: 1 1 180px;
}

.tree-explorer-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid #0f172a;
  background: #0f172a;
  color: #fff;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.tree-explorer-toggle:hover,
.tree-explorer-toggle:focus-visible {
  background: #fff;
  color: #0f172a;
  transform: translateY(-1px);
}

body.tree-explorer-active #open-tree-explorer {
  display: none;
}

body.tree-view-active #open-tree-explorer {
  display: inline-flex;
}

.tree-explorer-toggle.secondary {
  border-color: #475569;
  background: #fff;
  color: #475569;
}

.tree-explorer-toggle.secondary:hover,
.tree-explorer-toggle.secondary:focus-visible {
  background: #475569;
  color: #fff;
}

#tree-explorer {
  margin: 12px var(--tbv-page-gutter, 16px) 0;
  padding: 16px;
  border: 1px solid #d4d4d8;
  border-radius: 12px;
  background: #f8fafc;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
}

body.tree-view-active #tree-explorer {
  display: none;
}

body.tree-explorer-active #tree-explorer {
  display: block;
}

.tree-explorer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.tree-explorer-header h2 {
  font-size: 1.28rem;
  margin: 0;
  color: #0f172a;
}

.tree-explorer-subtitle {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: #475569;
}

.tree-builder-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 999px;
  background: linear-gradient(120deg, #2563eb, #4f46e5);
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.tree-builder-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
}

.tree-builder-button--secondary {
  background: #e2e8f0;
  color: #0f172a;
  box-shadow: none;
}

.tree-builder-button--secondary:hover {
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
}

.tree-explorer-body {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 18px;
}

#tree-folder-tree {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px;
  overflow: auto;
  max-height: 360px;
}

.folder-tree {
  list-style: none;
  margin: 0;
  padding: 0;
}

.folder-node {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  border: none;
  padding: 6px 4px;
  border-radius: 8px;
  font-size: 0.9rem;
  color: #0f172a;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.folder-node:hover,
.folder-node:focus-visible {
  background: rgba(59, 130, 246, 0.1);
  outline: none;
}

.folder-node.is-active {
  background: rgba(59, 130, 246, 0.18);
  color: #1e3a8a;
  font-weight: 600;
}

.folder-node .folder-count {
  font-size: 0.75rem;
  color: #64748b;
}

.folder-children {
  list-style: none;
  margin: 4px 0 0 12px;
  padding: 0;
  border-left: 2px dotted #cbd5f5;
}

#tree-result-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tree-result-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
}

.tree-filter-group {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: #475569;
}

.tree-filter-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.tree-sort select {
  font-family: 'DM Sans', sans-serif;
  border: 1px solid #cbd5f5;
  border-radius: 6px;
  padding: 4px 8px;
  background: #fff;
}

.tree-result-list {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px;
  max-height: 420px;
  overflow: auto;
  display: grid;
  gap: 6px;
}

.tree-result-list .tree-result-empty {
  padding: 16px;
  color: #64748b;
  font-size: 0.85rem;
}

.tree-result-item .tree-result-open {
  display: none;
}

.tree-result-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: linear-gradient(145deg, #fdfdfd, #f8fafc);
  color: #0f172a;
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease, background-color 0.12s ease, color 0.12s ease;
}

.tree-result-item:hover {
  border-color: #000;
  background: #000;
  color: #fff;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.35);
  transform: translateY(-1px);
}

.tree-result-item.is-active {
  border-color: #2563eb;
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.15);
}

.tree-result-item:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.tree-result-title {
  font-weight: 600;
  color: #0f172a;
  font-size: 0.95rem;
}


.tree-result-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 6px;
}

.tree-result-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.tree-result-info {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #475569;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.tree-result-snippet {
  margin-top: 10px;
  font-size: 0.95rem;
  font-family: 'DM Sans', sans-serif;
  color: #0f172a;
  line-height: 1.5;
}

.tree-result-snippet em {
  color: #64748b;
  font-style: normal;
}

.tree-result-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 10px;
}

.tree-result-item:hover .tree-result-title,
.tree-result-item:hover .tree-result-meta,
.tree-result-item:hover .tree-result-meta span,
.tree-result-item:hover .tree-result-info,
.tree-result-item:hover .tree-result-snippet {
  color: inherit;
}

.tree-result-item:hover .tree-result-snippet em {
  color: rgba(255, 255, 255, 0.75);
}

.tree-result-item:hover mark {
  background: rgba(255, 255, 255, 0.25);
  color: inherit;
}
.tree-search {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 240px;
  flex: 1 1 240px;
}

.tree-search label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #475569;
}

#tree-search-input {
  font-family: 'DM Sans', sans-serif;
  border: 1px solid #cbd5f5;
  background: #fff;
  color: #0f172a;
  padding: 8px 12px;
  border-radius: 8px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

#tree-search-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.tree-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #d4d4d8;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.12);
  max-height: 340px;
  overflow: auto;
  padding: 4px;
  z-index: 80;
}

.tree-search-results[hidden] {
  display: none;
}

.tree-search-result {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.tree-search-result:hover,
.tree-search-result:focus-visible,
.tree-search-result.is-active {
  background: rgba(59, 130, 246, 0.12);
  outline: none;
}

.tree-search-result .tree-search-title {
  font-weight: 600;
  color: #0f172a;
}

.tree-search-result .tree-search-meta {
  font-size: 0.75rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tree-search-result .tree-search-snippet {
  font-size: 0.88rem;
  font-family: 'DM Sans', sans-serif;
  color: #0f172a;
  line-height: 1.4;
}

.tree-search-result .tree-search-snippet em {
  color: #94a3b8;
  font-style: normal;
}

.tree-search-empty {
  padding: 10px;
  font-size: 0.8rem;
  color: #64748b;
}

/* Header: Latin and English */
#header-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
  justify-content: stretch;
  max-width: 100%;
  margin: 8px auto 8px;
  padding: 0 var(--tbv-page-gutter, 16px);
  position: relative;
  top: auto;
  z-index: auto;
  background: #fff;
  border-bottom: 1px solid #e6e6e6;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* Stack Latin/English boxes on narrow screens */
@media (max-width: 900px) {
  #header-row {
    grid-template-columns: 1fr;
  }
  .latin-header-modal__dialog {
    max-height: 92vh;
    padding: 18px;
  }
  .latin-header-modal__body textarea {
    min-height: 220px;
  }
}

/* Virgil mode: three-column header layout */
#header-row.tbv-has-scansion {
  grid-template-columns: repeat(3, minmax(360px, 1fr));
  gap: 12px;
  align-items: stretch;
  justify-content: center;
  margin-left: auto;
  margin-right: auto;
}

#header-row .latin-header-container,
#header-row .english-header-container,
#header-row .scansion-header-container {
  min-width: 0;
}

#header-row.tbv-has-scansion #latin-box,
#header-row.tbv-has-scansion #english-box,
#header-row.tbv-has-scansion #scansion-box {
  white-space: nowrap;
  overflow-x: auto;
  font-size: clamp(0.92rem, 0.75rem + 0.55vw, 1.05rem);
  line-height: 1.22;
  padding: clamp(10px, 0.8vw + 8px, 16px);
}

#header-row.tbv-has-scansion .latin-header-container .text-box {
  padding-right: clamp(56px, 7vw, 96px);
}

/* 📦 Shared Style for Latin and English Boxes */
/* Cicero mode: hide English/scansion and let Latin span full width */
#header-row.is-cicero-mode {
  grid-template-columns: 1fr;
}

#header-row.is-cicero-mode .english-header-container,
#header-row.is-cicero-mode .scansion-header-container {
  display: none;
}

#header-row.is-cicero-mode .latin-header-container {
  grid-column: 1 / -1;
}

#header-row.is-cicero-mode #latin-box {
  width: 100%;
  max-width: none;
}

/* Manual English header toggle overrides */
body.english-header-hidden #header-row .english-header-container {
  display: none;
}

body.english-header-hidden #header-row:not(.tbv-has-scansion) {
  grid-template-columns: 1fr;
}

body.english-header-hidden #header-row.tbv-has-scansion {
  grid-template-columns: repeat(2, minmax(360px, 1fr));
}

body.english-header-visible #header-row.is-cicero-mode {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.english-header-visible #header-row.is-cicero-mode .english-header-container {
  display: flex !important;
}

body.english-header-visible #header-row.is-cicero-mode .latin-header-container {
  grid-column: auto;
}

/* Word table column visibility toggles */
body.table-hide-clause .word-summary-table td.clause-cell {
  display: none;
}

body.table-hide-dictionary .word-summary-table td.dictionary-cell--primary {
  display: none;
}

body.table-hide-parsing .word-summary-table td.parsing-cell {
  display: none;
}

body.table-hide-clause .word-table-header .header-clause {
  display: none;
}

body.table-hide-dictionary .word-table-header .header-dictionary {
  display: none;
}

body.table-hide-parsing .word-table-header .header-parsing {
  display: none;
}

/* Cicero mode: tighten dictionary & parsing columns */
body.is-cicero-mode .word-summary-table td.dictionary-cell,
body.is-cicero-mode .word-summary-table td.dictionary-cell--parsing {
  padding: 0 2px;
  line-height: 1.2;
}

body.is-cicero-mode .dictionary-cell-inner {
  padding: 0;
  margin: 0;
  gap: 0;
  border-radius: 4px;
}

body.is-cicero-mode .dictionary-supplementary-row {
  gap: 4px;
}

body.is-cicero-mode .dictionary-parsing-detail {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

body.is-cicero-mode .dictionary-parsing-table thead th {
  padding: 2px 4px;
}

body.is-cicero-mode .dictionary-parsing-table tbody td {
  padding: 3px 4px;
  line-height: 1.25;
}

body.is-cicero-mode .dictionary-cell-inner.show-parsing,
body.is-cicero-mode .dictionary-cell-inner.dictionary-cell-committed.show-parsing,
body.is-cicero-mode .dictionary-cell-inner.dictionary-cell-pending.show-parsing {
  background: transparent;
  border-radius: 0;
}

body.is-cicero-mode .parsing-cell-inner {
  gap: 2px;
}

body.is-cicero-mode .word-summary-table td.parsing-cell {
  padding: 0 2px;
}

body.is-cicero-mode .parsing-editor {
  padding: 0;
  background: transparent;
  border-radius: 0;
  gap: 4px;
}

body.is-cicero-mode .parsing-cell-inner.show-parsing .parsing-editor {
  background: transparent;
}

body.is-cicero-mode .parsing-info-table {
  margin-bottom: 2px;
}

#latin-box,
#english-box,
.text-box {
  width: auto;
  padding: 16px;
  border: 2px solid black;
  border-radius: 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 1.2em;
  line-height: 1.4;
  box-sizing: border-box;
  background-color: #fafcff;
  overflow-y: auto;
  white-space: normal;
  word-break: break-word;
}

/* 🎨 Latin Box Styling */
#latin-box {
  background-color: white;
  color: black;
}

.latin-header-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.latin-header-container .text-box {
  width: 100%;
  padding-right: 96px;
}

.latin-header-edit-btn {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #0f172a;
  background: #ffffff;
  color: #0f172a;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, color 0.18s ease, opacity 0.18s ease;
  opacity: 0;
  pointer-events: none;
}

.latin-header-container:hover .latin-header-edit-btn,
.latin-header-container:focus-within .latin-header-edit-btn,
.latin-header-edit-btn:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

.latin-header-edit-btn:hover,
.latin-header-edit-btn:focus-visible {
  background: #0f172a;
  color: #f8fafc;
  transform: translateY(-2px);
}

.latin-header-edit-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.35);
}

.latin-header-edit-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25);
}

.latin-header-edit-btn:disabled {
  font-family: 'Montserrat', 'DM Sans', sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: 2px solid #000;
  background: #fff;
  color: #000;
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

body.latin-header-modal-open {
  overflow: hidden;
}

.latin-header-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.latin-header-modal[hidden] {
  display: none;
}

.latin-header-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 11, 25, 0.58);
}

.latin-header-modal__dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: min(920px, 92vw);
  width: 100%;
  background: #ffffff;
  border-radius: 18px;
  border: 3px solid #000;
  padding: 20px 24px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.25);
}

.latin-header-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.latin-header-modal__header h2 {
  margin: 0;
  font-family: 'Montserrat', 'DM Sans', sans-serif;
  font-size: clamp(1.2rem, 2vw + 0.8rem, 1.6rem);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #0f172a;
}

.latin-header-modal__close {
  border: 2px solid #000;
  background: #000;
  color: #fff;
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.latin-header-modal__close:hover {
  background: #fff;
  color: #000;
  transform: translateY(-1px);
}

.latin-header-modal__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.latin-header-modal__hint {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.4;
  color: #42526a;
}

.latin-header-modal__body textarea {
  width: 100%;
  min-height: 320px;
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  border: 2px solid #000;
  border-radius: 12px;
  padding: 12px 14px;
  resize: vertical;
  box-sizing: border-box;
  background: #fdfdfd;
}

.latin-header-modal__body textarea:focus {
  outline: none;
  border-color: #1d4ed8;
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.2);
}

.head-metadata-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 4px;
  margin-bottom: 8px;
}

.head-metadata-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.95rem;
  color: #0f172a;
}

.head-metadata-field span {
  font-weight: 600;
}

.head-metadata-field input,
.head-metadata-field select {
  border: 1px solid #cbd5f5;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 1rem;
  font-family: 'DM Sans', sans-serif;
  background: #ffffff;
  color: #0f172a;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.head-metadata-field input:focus,
.head-metadata-field select:focus {
  outline: none;
  border-color: #1d4ed8;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.latin-header-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.latin-header-modal__btn {
  font-family: 'Montserrat', 'DM Sans', sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: 2px solid #000;
  border-radius: 10px;
  padding: 8px 18px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.latin-header-modal__btn--secondary {
  background: #fff;
  color: #000;
}

.latin-header-modal__btn--secondary:hover {
  background: #000;
  color: #fff;
  transform: translateY(-1px);
}

.latin-header-modal__btn--primary {
  background: #000;
  color: #fff;
}

.latin-header-modal__btn--primary:hover {
  background: #fff;
  color: #000;
  transform: translateY(-1px);
}

/* 🎨 English Box Styling */
#english-box {
  background-color: white;
  color: #333;
}


/* 🖼️ SVG Tree Layer */
svg,
.treebank-svg {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  pointer-events: none;
  background-color: transparent; /* ensure it does not cover side panel */
  border: none;
}

/* Right side panel */
.info-pane {
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255,255,255,0.05);
  text-align: left;
  box-sizing: border-box;
  max-width: 100%;
  color: inherit;
  margin-bottom: 8px;
}

.info-pane h3 {
  margin: 0 0 12px 0;
  font-size: 1.1rem;
  font-weight: 550;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.3);
  padding-bottom: 6px;
}

#inspector {
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: anywhere;
}

#inspector > div {
  margin-bottom: 8px;
  padding: 4px 0;
}

#inspector strong {
  color: #ffd700;
  font-weight: 600;
  display: inline-block;
  min-width: 100px;
  margin-right: 8px;
}

.inspector-empty {
  color: #aaa;
  font-style: italic;
  text-align: center;
  padding: 20px;
}

body.treebanks-page #zoom-wrap {
  height: auto;
  min-height: 0;
  overflow: auto;
  box-sizing: border-box;
  padding: 0;
  border: 2px solid #000;
  border-radius: 12px;
  background: #fafafa;
  cursor: grab;
}




/* Hide legacy right panel; keep meta header visible */
#right-panel { display: none !important; }

/* 📊 Output Area for Treebank */
#output {
  position: relative;
  z-index: 0;
  margin: 0;
  transform-origin: top left;
}

/* Main content: tree + word table */
#content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px var(--tbv-page-gutter, 16px) 0;
  box-sizing: border-box;
  min-height: 0;
  height: 100%;
}

body.tree-view-active #content {
  height: var(--tbv-panel-height);
  overflow: hidden;
}

body.treebanks-page #workspace {
  display: flex;
  flex-direction: row;
  gap: 0;
  align-items: stretch;
  width: 100%;
  min-height: 0;
  height: 100%;
  overflow: auto; /* allow table width to extend and scroll */
}


#left-area {
  flex: 1 1 var(--tree-pane, 28%);
  min-width: 340px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  order: 3;
}

#left-area.tree-panel {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#left-area.is-hidden {
  display: none;
}

#splitter-tree-json {
  margin: 0 8px;
  order: 4;
}

#splitter-table-tree {
  order: 2;
}

#json-panel {
  flex: 0 0 var(--json-pane, 32%);
  min-width: 320px;
  background: #fff;
  border: 1px solid #dfe3f3;
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  min-height: 0;
  order: 5;
}

#json-panel.is-hidden {
  display: none;
}

.json-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid #dfe3f3;
  background: #f8fafc;
  border-radius: 14px 14px 0 0;
}

.json-panel-title {
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.json-panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.json-panel-actions button {
  font-family: 'Montserrat', 'DM Sans', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  border: 1px solid #94a3b8;
  background: #fff;
  color: #0f172a;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.json-panel-actions button:hover {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}

.json-panel-actions #close-json {
  background: #fee2e2;
  border-color: #fecaca;
  color: #7f1d1d;
}

.json-panel-actions #close-json:hover {
  background: #ef4444;
  border-color: #b91c1c;
  color: #fff;
}

.json-panel-body {
  flex: 1 1 auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#json-editor {
  flex: 1 1 auto;
  width: 100%;
  min-height: 240px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: 14px;
  line-height: 1.5;
  padding: 12px;
  border: 1px solid #cbd5f5;
  border-radius: 10px;
  background: #fafafa;
  color: #111;
  box-sizing: border-box;
  resize: none;
  overflow: auto;
  white-space: pre;
  tab-size: 2;
}

.json-status {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
}

#json-panel.dark {
  background: #0f172a;
  color: #e2e8f0;
  border-color: #1e293b;
  box-shadow: 0 16px 32px rgba(2, 6, 23, 0.45);
}

#json-panel.dark .json-panel-header {
  background: rgba(15, 23, 42, 0.9);
  border-bottom-color: #1e293b;
}

#json-panel.dark .json-panel-actions button {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

#json-panel.dark .json-panel-actions button:hover {
  background: #38bdf8;
  border-color: #38bdf8;
  color: #0f172a;
}

#json-panel.dark .json-panel-actions #close-json {
  background: #b91c1c;
  border-color: #f87171;
  color: #fee2e2;
}

#json-panel.dark .json-panel-actions #close-json:hover {
  background: #ef4444;
  border-color: #fecaca;
  color: #0f172a;
}

#json-panel.dark #json-editor {
  background: #0b1120;
  border-color: #1f2937;
  color: #f8fafc;
}

#word-table-panel {
  flex: 1 1 var(--table-pane, 72%);
  min-width: var(--word-table-min-width, 0);
  background: #fff;
  border: 1px solid #dfe3f3;
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: var(--word-table-width, auto);
  max-width: 100%;
  box-sizing: border-box;
  order: 1;
  overflow: visible;
}

#word-table-panel.is-hidden {
  display: none;
}

.splitter {
  flex-shrink: 0;
  position: relative;
  touch-action: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #d4dcff 0%, #eef2ff 100%);
  box-shadow:
    inset 0 0 0 1px rgba(71, 85, 105, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.75),
    0 6px 18px rgba(15, 23, 42, 0.15);
  transition:
    background 0.2s ease,
    box-shadow 0.2s ease,
    opacity 0.2s ease;
}

.splitter::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 48px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.6), rgba(59, 130, 246, 0.35));
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.25),
    0 10px 20px rgba(37, 99, 235, 0.25);
  pointer-events: none;
}

.splitter::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 32px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 20%, rgba(15, 23, 42, 0.5) 0, rgba(15, 23, 42, 0.5) 35%, transparent 36%) top center/100% 33% no-repeat,
    radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 0.35) 0, rgba(15, 23, 42, 0.35) 35%, transparent 36%) center/100% 33% no-repeat,
    radial-gradient(circle at 50% 80%, rgba(15, 23, 42, 0.35) 0, rgba(15, 23, 42, 0.35) 35%, transparent 36%) bottom center/100% 33% no-repeat;
  opacity: 0.85;
  pointer-events: none;
}

.splitter:hover {
  background: linear-gradient(180deg, #c1cbff 0%, #e0e5ff 100%);
  box-shadow:
    inset 0 0 0 1px rgba(37, 99, 235, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.85),
    0 8px 22px rgba(30, 64, 175, 0.28);
}

.splitter:hover::before {
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.75), rgba(59, 130, 246, 0.55));
}

.splitter:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.45);
  outline-offset: 3px;
}

.splitter.is-hidden {
  display: none;
}

.split-vertical {
  width: 14px;
  cursor: col-resize;
  margin: 0 8px;
  height: auto;
  align-self: stretch;
}

@media (max-width: 1024px) {
  #workspace {
    flex-direction: column;
  }
  #left-area,
#word-table-panel {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
}
  #json-panel {
    flex: 1 1 auto;
    min-width: 100%;
  }
  .split-vertical {
    display: none !important;
  }
}

#word-table-panel .panel-header {
  display: inline-grid;
  position: relative;
  z-index: 2;
  pointer-events: auto;
  grid-template-columns:
    minmax(0, var(--latin-col-width, max-content))
    minmax(0, var(--clause-col-width, max-content))
    minmax(0, max-content)
    minmax(0, var(--frieze-col-width, max-content))
    minmax(0, var(--lewis-col-width, max-content))
    minmax(0, var(--parsing-col-width, max-content));
  align-items: center;
  padding: 6px 0 4px;
  border-bottom: 1px solid #0f172a;
  background: #0f172a;
  gap: 0;
  width: 100%;
  min-width: var(--word-table-width, auto);
  max-width: none;
  box-sizing: border-box;
  border-radius: 14px 14px 0 0;
}

body.edit-mode #word-table-panel .panel-header {
  grid-template-columns:
    minmax(0, var(--latin-col-width, max-content))
    minmax(0, var(--clause-col-width, max-content))
    minmax(140px, var(--inline-edit-col-width, 260px))
    minmax(0, max-content)
    minmax(0, var(--frieze-col-width, max-content))
    minmax(0, var(--lewis-col-width, max-content))
    minmax(0, var(--parsing-col-width, max-content));
}

.header-inline-edit-stack {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  padding: 4px 6px;
  min-height: 100%;
}

.header-inline-edit-stack span {
  font-size: 0.95rem;
  line-height: 1.3;
  color: #f1f5ff;
  font-weight: 600;
  text-align: center;
}

.word-table-header {
  position: sticky;
  top: 0;
  z-index: 95;
  background: #fff;
  border-bottom: 1px solid #dfe3f3;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.word-table-header .header-col {
  font-weight: 600;
  font-size: 0.95rem;
  color: #ffffff;
  padding: 0 10px;
  box-sizing: border-box;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  justify-self: center;
}

.word-table-header .header-editable {
  display: none;
}

body.edit-mode .word-table-header .header-editable {
  display: flex;
  width: var(--inline-edit-col-width, 160px);
  min-width: 120px;
  max-width: 200px;
}



.word-table-header .header-clause {
  width: var(--clause-col-width, max-content);
  padding: 0 10px;
}

.word-table-header .header-dictionary {
  width: auto;
  min-width: 140px;
  padding: 0 10px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-dictionary-content {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.header-dictionary-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* technique badge styles retained for legacy references but hidden in UI */

.dictionary-source-toggle {
  display: inline-flex;
  align-items: center;
  pointer-events: auto;
  position: relative;
  z-index: 6;
}

.dictionary-source-toggle select {
  font-size: 0.78rem;
  border: 1px solid #cbd5f5;
  border-radius: 999px;
  padding: 2px 10px;
  background: #fff;
  color: #0f172a;
  cursor: pointer;
}

.dictionary-source-toggle.is-disabled select {
  opacity: 0.5;
  cursor: not-allowed;
}

body.tree-mode-senior .dictionary-source-toggle {
  display: inline-flex;
}

.word-table-header .header-lewis {
  width: var(--lewis-col-width, 320px);
  min-width: var(--lewis-col-width, 300px);
  max-width: var(--lewis-col-width, 360px);
  padding: 0 10px;
}

.word-table-header .header-parsing {
  width: var(--parsing-col-width, 560px);
  min-width: var(--parsing-col-width, 560px);
  max-width: none;
  padding: 0 10px;
}

body:not(.has-supplementary-dictionaries):not([data-primary-dictionary="frieze"]) .header-frieze,
body:not(.has-supplementary-dictionaries):not([data-primary-dictionary="frieze"]) .dictionary-cell--frieze {
  display: none;
}

body:not(.has-supplementary-dictionaries):not([data-primary-dictionary="lewis"]) .header-lewis,
body:not(.has-supplementary-dictionaries):not([data-primary-dictionary="lewis"]) .dictionary-cell--lewis {
  display: none;
}

#header-row .header-frieze {
  display: none !important;
}

body:not(.edit-mode):not([data-primary-dictionary="frieze"]) .header-frieze,
body:not(.edit-mode):not([data-primary-dictionary="frieze"]) .dictionary-cell--frieze {
  display: none;
}

body:not(.edit-mode) .english-header-actions {
  display: none;
}

body:not(.edit-mode):not([data-primary-dictionary="lewis"]) .header-lewis,
body:not(.edit-mode):not([data-primary-dictionary="lewis"]) .dictionary-cell--lewis {
  display: none;
}

body:not(.edit-mode) {
  --frieze-col-width: 2000px;
  --lewis-col-width: 0px;
  --inline-edit-col-width: 0px;
}

.word-summary-table td.dictionary-cell--source-frieze .dictionary-cell-inner,
.word-summary-table td.dictionary-cell--source-lewis .dictionary-cell-inner {
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
}

.word-summary-table td.dictionary-cell--source-lewis .dictionary-lewis-panel {
  height: 100%;
  max-height: 100%;
}

.word-summary-table td.dictionary-cell--source-lewis .dictionary-lewis-panel__body {
  max-height: 200px;
}

.dictionary-mode-callout {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 0 0 28px;
  padding: 18px 20px;
  border: 2px solid #000;
  border-radius: 18px;
  background: #fff;
  align-items: center;
}

.dictionary-mode-details {
  flex: 1 1 260px;
}

.dictionary-mode-title {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #475569;
}

.dictionary-mode-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
  margin-top: 2px;
}

.dictionary-mode-description {
  margin: 8px 0 0;
  font-size: 0.9rem;
  color: #1f2937;
  line-height: 1.45;
}

.dictionary-mode-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.dictionary-mode-switch {
  border: 2px solid #0f172a;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  color: #0f172a;
  background: #fff;
  transition: background 0.15s ease, color 0.15s ease;
}

.dictionary-mode-switch:hover {
  background: #0f172a;
  color: #fff;
}

.dictionary-mode-switch--primary {
  background: #0f172a;
  color: #fff;
}

.dictionary-mode-switch--primary:hover {
  background: #fff;
  color: #0f172a;
}

.word-summary-table td.word-edit-cell {
  display: none;
}

body.edit-mode .word-summary-table td.word-edit-cell {
  display: table-cell;
}

body.edit-mode .word-summary-table td.word-edit-cell {
  background: #f8fafc;
  padding: 6px 8px;
  vertical-align: top;
  min-width: 120px;
  width: var(--inline-edit-col-width, 160px);
  max-width: 200px;
}

body.edit-mode .word-summary-table td.word-edit-combined {
  min-width: var(--inline-edit-col-width, 160px);
}

.word-summary-table td.word-edit-cell input.word-inline-input {
  width: 100%;
  box-sizing: border-box;
  padding: 4px 6px;
  border: 1px solid #cbd5f5;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  background: #ffffff;
  color: #0f172a;
}

.word-summary-table td.word-edit-cell input.word-inline-input:focus {
  outline: 2px solid #2563eb;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.12);
}

.word-inline-tags {
  display: flex;
  align-items: center;
  gap: 6px;
}

.word-inline-tags .word-inline-input--tags {
  flex: 1 1 auto;
}

.word-inline-primer-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border: 1px solid #cbd5f5;
  border-radius: 6px;
  background: #ffffff;
  color: #0f172a;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  min-width: 32px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.word-inline-primer-btn:hover,
.word-inline-primer-btn:focus {
  background: #eff6ff;
  border-color: #2563eb;
  color: #1d4ed8;
  outline: none;
}

.word-inline-primer-btn:active {
  background: #dbeafe;
  border-color: #1d4ed8;
  color: #1e3a8a;
}

.word-inline-apposition-btn {
  display: none !important;
}

.word-edit-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: var(--inline-edit-col-width, 160px);
}

.word-inline-english-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.word-inline-english-row .word-inline-input--english {
  flex: 1 1 auto;
  min-width: 0;
}

.dictionary-definition-token {
  display: inline-flex;
  align-items: center;
  background: transparent;
  color: inherit;
  padding: 0 4px;
  margin: 0;
  cursor: pointer;
  border-radius: 4px;
  border: none;
  font: inherit;
  line-height: 1.4;
  transition: background 0.12s ease, color 0.12s ease;
}

.dictionary-definition-token:hover,
.dictionary-definition-token:focus {
  outline: none;
}

.dictionary-definition-token.is-selected {
  background: #111827;
  color: #ffffff;
  font-weight: 600;
}

.dictionary-definition-token.is-selected:hover,
.dictionary-definition-token.is-selected:focus {
  background: #0f172a;
}

.dictionary-definition-token.is-active {
  background: #111827;
  color: #ffffff;
  font-weight: 600;
}

.dictionary-definition-token.is-active:hover,
.dictionary-definition-token.is-active:focus {
  background: #0f172a;
  color: #ffffff;
}

#word-table-panel .panel-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: auto;
  padding: 4px 0 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  max-height: calc(var(--tbv-panel-height) - var(--tbv-table-header));
  height: auto;
}

.word-summary-table {
  border-collapse: collapse;
  table-layout: auto;
  font-size: 13px;
  display: inline-table;
  width: max-content;
}

.word-summary-table thead th {
  position: sticky;
  top: 0;
  background: #eef2ff;
  border-bottom: 1px solid #dfe3f3;
  padding: 6px 8px;
  text-align: left;
  font-weight: 600;
  width: auto;
}

.word-summary-table tbody tr:nth-child(even) {
  background: #fafcff;
}

.word-summary-table tbody tr:hover {
  background: #e8edff;
}

.word-summary-table tbody tr.row-composite-part {
  background-image: linear-gradient(90deg, rgba(0, 255, 255, 0.12), rgba(0, 255, 255, 0));
}

.word-summary-table tbody tr.row-composite-aux {
  background-image: linear-gradient(90deg, rgba(34, 197, 94, 0.14), rgba(34, 197, 94, 0));
}

.word-summary-table tbody tr.row-composite-part .latin-cell {
  box-shadow: inset 4px 0 0 rgba(0, 255, 255, 0.9);
}

.word-summary-table .word-link-btn {
  background: #111827;
  color: #ffffff;
  border: 0;
  border-radius: 999px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.word-summary-table .word-link-btn:hover,
.word-summary-table .word-link-btn:focus-visible {
  background: #1f2937;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.32);
  outline: none;
}

.word-summary-table .word-link-btn:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

.word-summary-table .word-link-btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
}

.word-summary-table td.latin-cell .latin-word .word-link-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 6px;
}

.word-summary-table td.latin-cell .latin-word .word-link-inline .word-link-btn {
  pointer-events: auto;
}

.word-summary-table tbody tr.row-composite-aux .latin-cell {
  box-shadow: inset 4px 0 0 rgba(0, 255, 0, 0.9);
}

.word-summary-table th,
.word-summary-table td {
  border: 2px solid #0f172a;
  background: #ffffff;
  padding: 5px 8px;
  vertical-align: middle;
  word-break: normal;
  white-space: nowrap;
}


.word-summary-table td.latin-cell {
  white-space: nowrap;
  vertical-align: middle;
  text-align: left;
  padding: 2px 4px 2px 0;
  cursor: pointer;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  overflow: visible;
  font-weight: 400;
  box-sizing: border-box;
  width: var(--latin-col-width, 120px);
  min-width: 0;
  max-width: var(--latin-col-width, 120px);
  font-size: 1rem;
}

body.edit-mode .word-summary-table td.latin-cell {
  position: relative;
  padding-right: 40px;
  --latin-col-width: 120px;
}

.word-summary-table td.latin-cell-composite {
  padding: 2px 4px 2px 0;
}

.word-summary-table td.latin-cell.highlighted {
  border-color: #0f172a !important;
  border-width: 2px !important;
  box-shadow: inset 0 0 0 2px rgba(8, 13, 31, 0.75) !important;
  transform: translateY(-1px);
}

.line-number-token,
.line-number-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #000000;
  color: #ffffff !important;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 6px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  text-decoration: none;
}

.line-number-token:hover,
.line-number-badge:hover {
  background: #222222;
}

.dictionary-line-badge {
  margin-right: 8px;
}

.dictionary-line-word {
  font-weight: 600;
  margin-right: 6px;
}

.word-summary-table tr.line-number-active {
  animation: line-number-flash 0.9s ease;
}

@keyframes line-number-flash {
  0% { background-color: rgba(0, 0, 0, 0.12); }
  100% { background-color: inherit; }
}


.word-summary-table td.latin-cell .latin-word {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 2px 4px 2px 12px;
  line-height: 1.2;
  font-size: 0.95rem;
  color: inherit;
  font-weight: inherit;
  gap: 2px;
  white-space: normal;
}

.latin-word-edit-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  border: 1px solid rgba(15, 23, 42, 0.35);
  background: rgba(255, 255, 255, 0.85);
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

body.edit-mode .latin-word-edit-btn {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
}

.word-inline-tags .latin-word-edit-btn {
  position: static;
  transform: none;
  margin-left: 4px;
  margin-right: 4px;
}

body.edit-mode .word-inline-tags .latin-word-edit-btn {
  position: static;
  transform: none;
}

.latin-word-edit-btn:hover {
  background: #f8fafc;
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.2);
}

.latin-word-edit-btn:active {
  transform: translateY(1px);
}

.latin-word-edit-btn:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.word-summary-table td.latin-cell .latin-line-number {
  display: block;
  margin-bottom: 1px;
}

.word-summary-table td.latin-cell .latin-line-number .line-number-badge {
  margin-right: 0;
}

.word-summary-table td.latin-cell .latin-word-text {
  display: inline-block;
  white-space: nowrap;
}

.word-summary-table td.latin-cell .latin-candidate-preview {
  font-size: 0.72rem;
  color: #4b5563;
  font-style: italic;
  white-space: nowrap;
}

.word-summary-table td.latin-cell .latin-word.latin-word-composite .composite-wrapper {
  padding: 0;
  white-space: nowrap;
}

.latin-word-modal {
  position: fixed;
  inset: 0;
  z-index: 3200;
  display: none;
}

.latin-word-modal.is-open {
  display: block;
}

.latin-word-modal[hidden] {
  display: none !important;
}

.latin-word-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.latin-word-modal__dialog {
  position: relative;
  max-width: min(440px, calc(100% - 32px));
  margin: 10vh auto 0;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.latin-word-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.latin-word-modal__header h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: #0f172a;
}

.latin-word-modal__close {
  border: none;
  background: transparent;
  font-size: 1.15rem;
  cursor: pointer;
  color: #0f172a;
}

.latin-word-modal__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.latin-word-modal__body label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1f2937;
}

.latin-word-modal__body input {
  width: 100%;
  padding: 10px 12px;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid #cbd5f5;
  background: #f8fafc;
  color: #0f172a;
  box-sizing: border-box;
}

.dictionary-helper {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.15);
  display: none;
}

.dictionary-helper.is-visible {
  display: block;
}

.dictionary-helper-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.dictionary-helper-heading {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
}

.dictionary-helper-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.dictionary-helper-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  background: #e0e7ff;
  color: #3730a3;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.dictionary-helper-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dictionary-helper-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dictionary-helper-label {
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dictionary-helper-value {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
}

.dictionary-helper-list li small {
  font-size: 12px;
  color: #64748b;
}

.dictionary-helper-empty {
  margin: 0;
  font-size: 12px;
  color: #64748b;
}

.latin-word-modal__body input:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
  background: #ffffff;
}

.latin-word-modal__hint {
  margin: 0;
  font-size: 0.82rem;
  color: #475569;
}

.latin-word-modal__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.latin-word-modal__actions {
  display: flex;
  gap: 8px;
}

.latin-word-modal__footer button {
  font-size: 0.9rem;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.latin-word-modal__footer button:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.latin-word-modal__delete {
  background: #fee2e2;
  color: #b91c1c;
  border-color: rgba(185, 28, 28, 0.2);
}

.latin-word-modal__delete:hover {
  background: #fecaca;
}

.latin-word-modal__save {
  background: #111827;
  color: #ffffff;
}

.latin-word-modal__save:hover {
  background: #1f2937;
}

.latin-word-modal__insert {
  background: #2563eb;
  color: #ffffff;
  border-color: rgba(37, 99, 235, 0.2);
}

.latin-word-modal__insert:hover {
  background: #1d4ed8;
}

.latin-word-modal__actions button:first-child {
  background: #e5e7eb;
  color: #111827;
}

.latin-word-modal__actions button:first-child:hover {
  background: #d1d5db;
}

.supplementary-dictionary-modal {
  position: fixed;
  inset: 0;
  z-index: 1600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.supplementary-dictionary-modal[hidden] {
  display: none;
}

.supplementary-dictionary-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.supplementary-dictionary-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(960px, 92vw);
  height: min(90vh, 720px);
  max-height: 90vh;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 28px 90px rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  outline: none;
}

.supplementary-dictionary-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 22px 12px;
  border-bottom: 1px solid #e2e8f0;
  gap: 16px;
}

.supplementary-dictionary-modal__title-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.supplementary-dictionary-modal__eyebrow {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #475569;
}

.supplementary-dictionary-modal__title {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.25;
  color: #0f172a;
}

.supplementary-dictionary-modal__close {
  border: none;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  color: #0f172a;
  padding: 2px 4px;
  cursor: pointer;
}

.supplementary-dictionary-modal__body {
  flex: 1 1 auto;
  padding: 18px 22px 22px;
  overflow: auto;
  background: #f8fafc;
}

.supplementary-dictionary-modal__content {
  min-height: 100%;
  font-size: 0.95rem;
  color: #0f172a;
  line-height: 1.55;
}

.supplementary-dictionary-modal__content p {
  margin-top: 0;
}

.supplementary-dictionary-modal__content p + p {
  margin-top: 1rem;
}

.supplementary-dictionary-modal__entry {
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  padding: 16px 20px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.supplementary-dictionary-modal__entry--frieze {
  color: #7c2d12;
}

.supplementary-dictionary-modal__entry--lewis {
  color: #0f172a;
}

.supplementary-dictionary-modal__status {
  font-size: 0.95rem;
  color: #475569;
}

.supplementary-dictionary-modal__status.is-error {
  color: #b91c1c;
}

.word-summary-table td.clause-cell {
  white-space: normal;
  font-size: 0.95rem;
  color: #111827;
  width: var(--clause-col-width, 160px);
  min-width: 0;
  max-width: var(--clause-col-width, 260px);
  vertical-align: middle;
  padding: 0;
}

.word-summary-table td.clause-cell.clause-cell-wide {
  max-width: 320px;
}

body.treebanks-page:not(.tree-explorer-open) .logo-row,
body.treebanks-page:not(.tree-explorer-open) .global-nav,
body.treebanks-page:not(.tree-explorer-open) .page-title-row {
  display: none !important;
}

body.treebanks-page:not(.tree-explorer-open) {
  padding-top: 0;
}

.word-summary-table td.clause-cell.clause-type-main {
  background: #ffffff;
}

.word-summary-table td.clause-cell.clause-type-coordinated {
  background: #f3f3f3;
}

.word-summary-table td.clause-cell.clause-type-adverbial {
  background: #d9ead3;
}

.word-summary-table td.clause-cell.clause-type-ablative-absolute {
  background: #fce5cd;
}

.word-summary-table td.clause-cell.clause-type-relative {
  background: #fff2cc;
}

.word-summary-table td.clause-cell.clause-type-nominal {
  background: #ead1dc;
}

.word-summary-table td.dictionary-cell {
  white-space: normal;
  word-break: normal;
  padding: 4px 6px;
  line-height: 1.35;
  vertical-align: top;
  overflow: visible;
}

.word-summary-table td.dictionary-cell.dictionary-cell--primary {
  width: auto;
  min-width: 140px;
}

body[data-primary-dictionary="frieze"] .word-summary-table td.dictionary-cell.dictionary-cell--primary {
  width: 380px;
  min-width: 380px;
}

body[data-primary-dictionary="frieze"] .word-summary-table td.dictionary-cell.dictionary-cell--primary .frieze-panel__title {
  white-space: nowrap;
}

body[data-primary-dictionary="lewis"] .word-summary-table td.dictionary-cell.dictionary-cell--primary {
  width: 320px;
  min-width: 320px;
}

body[data-primary-dictionary="lewis"] .dictionary-lewis-panel__body {
  max-height: min(var(--dictionary-row-height, 220px), 220px);
  overflow-y: auto;
}

body[data-primary-dictionary="lewis"] .dictionary-lewis-panel__heading {
  white-space: normal;
  word-break: break-word;
}

body[data-primary-dictionary="lewis"] .dictionary-lewis-panel__body .ls-head {
  white-space: normal;
  word-break: break-word;
}

.word-summary-table td.dictionary-cell--frieze,
.word-summary-table td.dictionary-cell--lewis {
  height: auto;
  max-height: none;
  overflow: visible;
  padding: 0;
  position: relative;
  z-index: 10;
  pointer-events: auto;
}

.word-summary-table td.parsing-cell {
  padding: 4px 6px;
  line-height: 1.35;
  vertical-align: top;
  width: var(--parsing-col-width, 560px);
  min-width: var(--parsing-col-width, 560px);
  max-width: none;
}

#word-table-panel {
  overflow: visible;
  overflow-x: auto;
}

body.treebanks-page #word-table-panel {
  min-width: 0;
  max-width: none;
  width: auto;
}

#word-table-body {
  overflow: visible;
}

.word-summary-table {
  width: max-content;
  min-width: 0;
  max-width: none;
  overflow: visible;
}

.word-summary-table tr {
  --dictionary-row-height: auto;
  position: relative;
  overflow: visible;
  z-index: 1;
}

.dictionary-cell.freq-tier-a {
  background-color: #ffffff;
  color: #111827;
}

.dictionary-cell.freq-tier-b {
  background-color: #fafcff;
  color: #111827;
}

.dictionary-cell.freq-tier-c {
  background-color: #f3f5fb;
  color: #111827;
}

.dictionary-cell.freq-tier-d {
  background-color: #eceff6;
  color: #111827;
}

.dictionary-cell.freq-tier-e {
  background-color: #e4e8f3;
  color: #111827;
}

.dictionary-cell.freq-tier-f {
  background-color: #dde2f0;
  color: #111827;
}

.dictionary-cell.freq-tier-enclitic {
  background-color: #f6f8ff;
  color: #111827;
}

.word-summary-table td.dictionary-cell--composite {
  background-color: #dcfce7;
  box-shadow: inset 4px 0 0 #15803d;
}

.word-summary-table td.dictionary-cell--composite .dictionary-cell-inner {
  color: #0f172a;
}

.dictionary-cell.freq-tier-e .dictionary-entry,
.dictionary-cell.freq-tier-e .dictionary-meaning,
.dictionary-cell.freq-tier-e .dictionary-parsing,
.dictionary-cell.freq-tier-f .dictionary-entry,
.dictionary-cell.freq-tier-f .dictionary-meaning,
.dictionary-cell.freq-tier-f .dictionary-parsing {
  color: inherit;
}

.dictionary-cell-inner {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  align-items: flex-start;
  color: #1f2937;
  width: auto;
  max-width: 100%;
  overflow: visible;
  pointer-events: auto;
}

.dictionary-cell.freq-tier-e .dictionary-cell-inner,
.dictionary-cell.freq-tier-f .dictionary-cell-inner {
  color: inherit;
}

.dictionary-supplementary-actions {
  display: none;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: auto;
}

.dictionary-cell-inner:hover .dictionary-supplementary-actions,
.dictionary-cell-inner:focus-within .dictionary-supplementary-actions {
  display: flex;
}

.dictionary-supplementary-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
}

.dictionary-cell-inner[data-word-id] {
  cursor: pointer;
  padding: 2px 4px;
  margin: -2px -4px;
  border-radius: 6px;
  transition: background 0.15s ease;
  outline: 0;
}

.dictionary-cell-inner[data-word-id]:hover {
  background: transparent;
}

.dictionary-cell.freq-tier-e .dictionary-cell-inner[data-word-id]:hover,
.dictionary-cell.freq-tier-f .dictionary-cell-inner[data-word-id]:hover,
.dictionary-cell.freq-tier-enclitic .dictionary-cell-inner[data-word-id]:hover {
  background: transparent;
}

.dictionary-tags-row {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.dictionary-tags-row--inline {
  margin-top: 4px;
}

.dictionary-tags-row--inline-top {
  display: inline-flex;
  gap: 4px;
  margin-top: 4px;
  margin-left: 0;
  vertical-align: middle;
}

.dictionary-tags-row--supplementary {
  margin-top: 0;
}

.dictionary-primary-line {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

/* Keep tags on the first line beside the headword in Cicero mode */
body.is-cicero-mode .dictionary-primary-line {
  align-items: center;
  flex-wrap: wrap;
}

body.is-cicero-mode .dictionary-primary-line .dictionary-entry {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dictionary-tag-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #000000;
  color: #0f172a;
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.2;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  position: relative;
  z-index: 1;
  pointer-events: auto;
}

body[data-primary-dictionary="whitaker"] .dictionary-cell--whitaker .dictionary-tag-badge {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.dictionary-tag-badge--header {
  background: #ffffff;
  border-color: #000000;
}

.dictionary-tag-badge[data-tag-note]:hover::after,
.dictionary-tag-badge[data-tag-note]:focus-visible::after {
  content: attr(data-tag-note);
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  transform: translateX(0);
  background: #ffffff;
  color: #000000;
  border: 1px solid #000000;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 0.82rem;
  line-height: 1.35;
  white-space: normal;
  min-width: 200px;
  max-width: 320px;
  z-index: 9000;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.dictionary-tag-badge[data-tag-note]:hover::before,
.dictionary-tag-badge[data-tag-note]:focus-visible::before {
  content: '';
  position: absolute;
  left: 14px;
  top: calc(100% + 1px);
  border: 6px solid transparent;
  border-top: 0;
  border-bottom: 0;
  border-top: 6px solid #000000;
  z-index: 9000;
  pointer-events: none;
}

.dictionary-cell-inner[data-dictionary-source="lewis"],
.dictionary-cell-inner.dictionary-cell-lewis {
  cursor: default;
}

.dictionary-entry {
  font-weight: 600;
  font-size: 0.85rem;
  color: #111827;
  white-space: normal;
}

.dictionary-meta-inline {
  display: inline-flex;
  gap: 6px;
  align-items: baseline;
  font-size: 0.78rem;
  color: #475569;
  margin-left: 6px;
}

.dictionary-meta-inline .dictionary-meta-summary {
  font-weight: 600;
  color: #0f172a;
}

.dictionary-meta-inline .dictionary-meta-frequency {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dictionary-meta-inline .dictionary-meta-frequency.freq-tier-a { color: #166534; }
.dictionary-meta-inline .dictionary-meta-frequency.freq-tier-b { color: #15803d; }
.dictionary-meta-inline .dictionary-meta-frequency.freq-tier-c { color: #b45309; }
.dictionary-meta-inline .dictionary-meta-frequency.freq-tier-d { color: #b45309; }
.dictionary-meta-inline .dictionary-meta-frequency.freq-tier-e { color: #b91c1c; }
.dictionary-meta-inline .dictionary-meta-frequency.freq-tier-f { color: #7f1d1d; }

.dictionary-entry-meta {
  font-size: 0.72rem;
  color: #0f172a;
  margin-top: 2px;
  font-family: 'DM Mono', 'SFMono-Regular', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  letter-spacing: 0.08em;
}

.dictionary-entry-meta--morph {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dictionary-meta-morph {
  font: inherit;
}

.dictionary-entry .dictionary-parsing-inline {
  font-weight: 400;
  font-size: 0.72rem;
  color: #4b5563;
  white-space: normal;
}

.dictionary-cell-source {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dictionary-source-label {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #475569;
  font-weight: 600;
}

.dictionary-cell-source--frieze .dictionary-source-label {
  color: #0369a1;
}

.dictionary-cell-source--whitaker .dictionary-source-label {
  color: #0f766e;
}

.dictionary-cell--lewis .dictionary-source-label {
  color: #7c2d12;
}

.dictionary-lewis {
  max-height: 260px;
  overflow: auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 6px;
}

.dictionary-lewis__title {
  font-weight: 600;
  margin-bottom: 4px;
}

.dictionary-lewis__loading,
.dictionary-lewis__empty {
  font-size: 0.85rem;
  color: #475569;
}

.frieze-cell,
.lewis-cell {
  vertical-align: top;
  padding: 6px 8px;
}

.frieze-cell {
  width: var(--frieze-col-width, 1400px);
}

.lewis-cell {
  width: var(--lewis-col-width, 320px);
}

.supplementary-cell-content {
  font-size: 0.85rem;
  color: #475569;
  line-height: 1.35;
}

.supplementary-cell-content.is-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  gap: 6px;
  text-align: center;
}

.supplementary-cell-message {
  font-size: 0.8rem;
  color: #64748b;
}

.supplementary-cell-message--error {
  color: #b91c1c;
}

.supplementary-cell-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.supplementary-cell-button {
  border: 1px solid #cbd5f5;
  background: #fff;
  color: #0f172a;
  border-radius: 999px;
  font-size: 0.75rem;
  padding: 2px 10px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.supplementary-cell-button:hover {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}

.dictionary-supplementary-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.dictionary-supplementary-actions .dictionary-supplementary-btn {
  font-size: 0.78rem;
}

.frieze-panel {
  border: 1px solid #000000;
  border-radius: 10px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: visible;
  height: auto;
  max-height: none;
}

.frieze-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: nowrap;
  padding: 6px 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #ffffff;
  background: #0f172a;
  border-bottom: 1px solid #000000;
  overflow: visible;
  position: relative;
  z-index: 2;
}

.frieze-panel__title-block,
.dictionary-lewis-panel__title-block {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.frieze-panel__tags {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.frieze-panel__badge {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #c2410c;
}

.frieze-panel__actions,
.dictionary-lewis-panel__actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  position: relative;
  z-index: 20;
}

.dictionary-lewis-panel--simple .dictionary-lewis-panel__actions {
  justify-content: flex-end;
  width: 100%;
  padding: 4px 10px;
  background: linear-gradient(120deg, #e0e7ff, #eef2ff);
  border-bottom: 1px solid #dbe4ff;
  gap: 8px;
}

.supplementary-expand-btn {
  min-width: auto;
  padding: 2px 8px;
  font-size: 0.72rem;
}

.frieze-panel__body {
  padding: 10px 12px;
  overflow: visible;
  flex: 1 1 auto;
  min-height: 0;
  font-size: 0.88rem;
  color: #0f172a;
  line-height: 1.4;
  background: #ffffff;
  pointer-events: auto;
}

.frieze-token {
  display: inline-block;
  padding: 2px 3px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  pointer-events: auto;
}

.frieze-token.is-marked {
  background: #0f172a;
  color: #ffffff;
}

.frieze-token.is-selected {
  background: #e5e7eb;
  color: inherit;
  border-radius: 6px;
}

.frieze-panel.is-collapsed .frieze-token.is-collapsed-hidden {
  display: none;
}

.frieze-panel.is-expanded .frieze-token {
  display: inline;
}
.frieze-panel__body p {
  margin: 0;
}

.frieze-panel__empty {
  padding: 12px;
  font-size: 0.85rem;
  color: #a16207;
}

.dictionary-lewis-panel {
  border: 1px solid #dbe4ff;
  border-radius: 12px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 100%;
  height: 100%;
  max-height: var(--dictionary-row-height, 260px);
}

.dictionary-lewis-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  font-size: 0.85rem;
  font-weight: 600;
  background: linear-gradient(120deg, #e0e7ff, #eef2ff);
  border-bottom: 1px solid #dbe4ff;
}

.dictionary-lewis-panel__title {
  color: #1e1b4b;
}

.dictionary-lewis-panel__badge {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #4338ca;
}

.tag-note-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.tag-note-modal__panel {
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  width: min(420px, 90vw);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tag-note-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: #111827;
  color: #ffffff;
}

.tag-note-modal__title {
  font-weight: 700;
  font-size: 0.95rem;
}

.tag-note-modal__close {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 1rem;
  cursor: pointer;
}

.tag-note-modal__body {
  padding: 12px;
}

.tag-note-modal__text {
  font-size: 0.95rem;
  color: #111827;
  white-space: pre-wrap;
}

.tag-note-modal__input {
  width: 100%;
  min-height: 120px;
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 0.95rem;
  color: #111827;
  resize: vertical;
}

.tag-note-modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 12px;
  background: #f9fafb;
}

.tag-note-modal__save,
.tag-note-modal__cancel {
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.9rem;
  cursor: pointer;
}

.tag-note-modal__save {
  background: #111827;
  color: #ffffff;
}

.tag-note-modal__cancel {
  background: #e5e7eb;
  color: #111827;
}

.dictionary-lewis-panel__body {
  padding: 10px 12px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: #0f172a;
  max-height: min(var(--dictionary-row-height, 260px), 260px);
}

.dictionary-lewis-panel__heading {
  font-weight: 600;
  margin-bottom: 6px;
  color: #312e81;
  font-size: 0.85rem;
}

.dictionary-lewis-panel__mini-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: #4338ca;
  margin-right: auto;
  white-space: nowrap;
}

.dictionary-lewis-panel__body .ls-head {
  font-weight: 700;
  display: inline-block;
  margin-bottom: 6px;
}

.dictionary-lewis-panel__body .ls-sense {
  display: block;
  margin-bottom: 8px;
}

.dictionary-lewis-panel__body .ls-sense-label {
  font-weight: 600;
  margin-right: 4px;
}

.dictionary-lewis-panel__empty {
  padding: 12px;
  font-size: 0.85rem;
  color: #475569;
}

.dictionary-lewis-panel--empty {
  max-height: none;
}

.dictionary-notes-display-text {
  min-height: 2.5em;
  white-space: pre-wrap;
}

.dictionary-notes-display-text--empty {
  color: #94a3b8;
  font-style: italic;
}

.word-inline-input--notes {
  width: 100%;
  min-height: 70px;
  resize: vertical;
  padding: 6px;
  font-family: inherit;
  border: 1px solid #cbd5f5;
  border-radius: 6px;
}

.dictionary-entry.dictionary-principal {
  font-weight: 700;
}

.dictionary-entry.dictionary-secondary {
  font-weight: 500;
  font-size: 0.78rem;
  color: #374151;
}

.dictionary-entry-text {
  display: block;
  line-height: 1.25;
}

.dictionary-entry-subtitle {
  font-size: 0.74rem;
  color: #4b5563;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 2px;
}

.dictionary-entry-definition {
  font-size: 0.74rem;
  color: #4b5563;
  margin-top: 2px;
  line-height: 1.3;
  white-space: normal;
}

.dictionary-entry--interactive {
  cursor: pointer;
}

.dictionary-entry--interactive:hover {
  color: #1f2937;
  text-decoration: underline;
}

.dictionary-gender-chip {
  display: inline-block;
  margin-left: 4px;
  font-weight: 600;
  font-size: 0.75rem;
  color: #374151;
}

.dictionary-pronoun-chip {
  display: inline-block;
  margin-left: 4px;
  font-weight: 600;
  font-size: 0.75rem;
  color: #1f2937;
  text-transform: lowercase;
}

.dictionary-lock-toggle {
  display: inline-block;
  margin-left: 4px;
  padding: 0 2px;
  background: transparent;
  border: none;
  color: #15803d;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  line-height: 1;
  vertical-align: middle;
}

.dictionary-lock-toggle:focus {
  outline: 2px solid rgba(21, 128, 61, 0.4);
  outline-offset: 1px;
}

.dictionary-lock-toggle.is-locked {
  color: #16a34a;
}

.dictionary-lock-toggle.is-unlocked {
  color: #b91c1c;
}

.dictionary-candidate-entry.is-limited {
  cursor: pointer;
}


.dictionary-parsing-detail {
  width: 100%;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(17, 24, 39, 0.08);
}

.dictionary-parsing-detail[hidden] {
  display: none !important;
}

.dictionary-parsing-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 2px;
}

.dictionary-parsing-table thead th {
  background: #111827;
  color: #f9fafb;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 6px;
  border: 1px solid #0f172a;
  text-align: left;
}

.dictionary-parsing-table tbody td {
  background: #ffffff;
  color: #111827;
  font-size: 0.78rem;
  padding: 6px;
  border: 1px solid rgba(17, 24, 39, 0.12);
  line-height: 1.35;
}

.dictionary-cell-inner.show-parsing {
  background: rgba(15, 23, 42, 0.04);
  border-radius: 8px;
  transition: background 0.15s ease;
}

.dictionary-cell-inner.dictionary-cell-committed.show-parsing {
  background: rgba(182, 249, 210, 0.5);
}

.dictionary-cell-inner.dictionary-cell-pending.show-parsing {
  background: rgba(254, 202, 202, 0.42);
}

.parsing-cell-inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #1f2937;
}

.parsing-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.03);
  overflow-x: auto;
}

.parsing-info-wrap {
  width: 100%;
  overflow-x: auto;
}

.parsing-info-table {
  width: max-content;
  border-collapse: collapse;
  margin-bottom: 6px;
  font-size: 0.75rem;
  color: #1f2937;
}

.parsing-info-table thead th {
  background: #0f172a;
  color: #f8fafc;
  padding: 4px 6px;
  border: 1px solid rgba(15, 23, 42, 0.55);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.parsing-info-table tbody td {
  padding: 6px 8px;
  border: 1px solid rgba(17, 24, 39, 0.15);
  background: #ffffff;
  min-width: 110px;
}

.parsing-info-table tbody td select.parsing-field-select {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  font-size: 0.85rem;
  padding: 4px 6px;
}

.parsing-cell-inner.show-parsing .parsing-editor {
  background: rgba(15, 23, 42, 0.07);
}

.parsing-editor[hidden] {
  display: none !important;
}

.parsing-frequency-line {
  font-size: 0.75rem;
  color: #4b5563;
}

.parsing-frequency-line .parsing-frequency-value {
  font-weight: 600;
  margin-left: 4px;
}

.parsing-fields {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: flex-start;
  min-width: max-content;
}

.parsing-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.72rem;
  color: #4b5563;
  flex: 0 0 auto;
}

.parsing-field-label {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  font-size: 0.65rem;
  color: #6b7280;
}

.parsing-field-select {
  font-size: 0.85rem;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.8);
  background: #ffffff;
  color: #111827;
  min-width: 120px;
}

.parsing-field-select:focus {
  outline: 2px solid rgba(59, 130, 246, 0.35);
  outline-offset: 1px;
}

.parsing-empty {
  font-size: 0.75rem;
  color: #6b7280;
  font-style: italic;
}

.dictionary-meaning {
  font-size: 0.78rem;
  color: #374151;
  margin-top: 2px;
  white-space: normal;
}

.dictionary-whitaker {
  font-size: 0.72rem;
  color: #4b5563;
  line-height: 1.3;
  margin-top: 2px;
  white-space: normal;
}

.dictionary-parsing {
  font-size: 0.72rem;
  color: #4b5563;
  font-weight: 400;
  margin-left: 4px;
  white-space: normal;
}

.dictionary-candidate-panel {
  margin-top: 6px;
  width: 100%;
  border: 1px solid #d6dbf7;
  border-radius: 8px;
  background: #f6f8ff;
  padding: 8px 10px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.dictionary-candidate-panel.is-expanded {
  background: #eef2ff;
  border-color: #7c89f8;
}

.dictionary-candidate-panel:focus {
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.35);
  border-color: #7c89f8;
}

.dictionary-candidate-limited {
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
}

.candidate-more-indicator {
  align-self: flex-end;
  font-size: 0.72rem;
  font-weight: 600;
  color: #4b5563;
  margin-top: 4px;
  text-align: right;
}

.dictionary-candidate-panel[data-has-selection="false"] .candidate-more-indicator {
  color: #b45309;
}

.dictionary-candidate-list {
  margin-top: 8px;
  border-top: 1px solid rgba(99, 102, 241, 0.25);
  padding-top: 8px;
  max-height: 240px;
  overflow-y: auto;
  cursor: default;
}

.dictionary-candidate-entry {
  padding: 6px 6px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.dictionary-candidate-entry:hover {
  background: rgba(99, 102, 241, 0.12);
}

.dictionary-candidate-entry.is-selected {
  background: rgba(99, 102, 241, 0.16);
}

.dictionary-candidate-entry.is-primary {
  background: rgba(79, 70, 229, 0.18);
  border: 1px solid rgba(79, 70, 229, 0.28);
}

.dictionary-candidate-entry.is-empty {
  font-size: 0.75rem;
  color: #6b7280;
  font-style: italic;
}

.candidate-header-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto) auto;
  align-items: baseline;
  gap: 8px;
  font-family: 'DM Mono', 'IBM Plex Mono', 'Roboto Mono', monospace;
  font-size: 0.78rem;
  color: #1f2937;
  font-variant-numeric: tabular-nums;
  white-space: normal;
}

.candidate-form {
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.candidate-form .candidate-search-variant {
  font-size: 0.68rem;
  font-weight: 500;
  color: #1d4ed8;
  background: rgba(59, 130, 246, 0.14);
  border-radius: 999px;
  padding: 2px 8px;
  letter-spacing: 0.4px;
  text-transform: none;
}

.candidate-details {
  font-weight: 500;
  color: #1f2937;
  white-space: normal;
}

.candidate-confidence-chip {
  font-size: 0.68rem;
  color: #4338ca;
  font-weight: 600;
  justify-self: end;
}

.candidate-principal-line {
  font-size: 0.78rem;
  color: #111827;
}

.candidate-sense-line {
  font-size: 0.74rem;
  color: #4b5563;
  line-height: 1.25;
}

.dictionary-candidate-hint {
  margin-top: 8px;
  font-size: 0.7rem;
  color: #6b7280;
}

.dictionary-candidate-empty {
  margin-top: 6px;
  font-size: 0.75rem;
  color: #6b7280;
  font-style: italic;
}

.dictionary-cell-inner.dictionary-cell-committed {
  background: rgba(182, 249, 210, 0.36);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(14, 159, 110, 0.35);
}

.dictionary-cell-inner.dictionary-cell-pending {
  background: rgba(254, 202, 202, 0.28);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(185, 28, 28, 0.25);
}

.dictionary-cell-inner.dictionary-cell-pending:hover {
  box-shadow: inset 0 0 0 2px rgba(185, 28, 28, 0.35);
}

.dictionary-cell-inner.dictionary-cell-committed:hover {
  box-shadow: inset 0 0 0 2px rgba(14, 159, 110, 0.45);
}

.dictionary-cell-inner:focus {
  outline: 2px solid rgba(79, 70, 229, 0.45);
  outline-offset: 2px;
}

.dictionary-candidate-entry.candidate-tone-0 {
  border-left: 4px solid rgba(220, 38, 38, 0.65);
}

.dictionary-candidate-entry.candidate-tone-1 {
  border-left: 4px solid rgba(239, 68, 68, 0.55);
}

.dictionary-candidate-entry.candidate-tone-2 {
  border-left: 4px solid rgba(248, 113, 113, 0.5);
}

.dictionary-candidate-entry.candidate-tone-3 {
  border-left: 4px solid rgba(252, 165, 165, 0.45);
}

.dictionary-candidate-entry.candidate-tone-4 {
  border-left: 4px solid rgba(254, 202, 202, 0.4);
}

.dictionary-candidate-entry.candidate-tone-5 {
  border-left: 4px solid rgba(255, 228, 230, 0.36);
}

.dictionary-candidate-entry.is-primary.candidate-tone-0,
.dictionary-candidate-entry.is-primary.candidate-tone-1,
.dictionary-candidate-entry.is-primary.candidate-tone-2,
.dictionary-candidate-entry.is-primary.candidate-tone-3,
.dictionary-candidate-entry.is-primary.candidate-tone-4,
.dictionary-candidate-entry.is-primary.candidate-tone-5 {
  border-left-color: rgba(34, 197, 94, 0.85);
}

#whitaker-inline-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  z-index: 1800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#whitaker-inline-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

#clause-order-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  z-index: 1700;
}

#clause-order-modal.is-open {
  display: flex;
}

.clause-order-dialog {
  background: #ffffff;
  border-radius: 16px;
  width: min(2100px, 98vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 32px 80px rgba(15, 23, 42, 0.35);
  overflow: hidden;
}

.clause-order-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 12px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.clause-order-title {
  margin: 0;
  font-size: 1.22rem;
  font-weight: 700;
  color: #0f172a;
}

.clause-order-close {
  border: none;
  background: transparent;
  color: #0f172a;
  font-size: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.clause-order-close:hover,
.clause-order-close:focus-visible {
  background: rgba(15, 23, 42, 0.12);
  transform: rotate(90deg);
  outline: none;
}

.clause-order-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.clause-order-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
  width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  padding-bottom: 6px;
}

.clause-order-chip {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 2px solid rgba(15, 23, 42, 0.16);
  background: #f8fafc;
  color: #0f172a;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
  cursor: grab;
  user-select: none;
  width: clamp(260px, 32vw, 460px);
  min-width: clamp(260px, 32vw, 460px);
}

.clause-order-chip:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 4px;
}

.clause-order-chip--dragging {
  opacity: 0.78;
  cursor: grabbing;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.28);
}

.clause-order-chip--drop {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35);
}

.clause-order-chip--drop-before::before,
.clause-order-chip--drop-after::after {
  content: '';
  position: absolute;
  top: 8px;
  bottom: 8px;
  width: 4px;
  background: #2563eb;
  border-radius: 999px;
}

.clause-order-chip--drop-before::before {
  left: -8px;
}

.clause-order-chip--drop-after::after {
  right: -8px;
}

.clause-order-chip__text {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.22;
  word-break: break-word;
}

.clause-order-chip__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.clause-order-chip__label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
}

.clause-order-chip__index {
  width: 56px;
  padding: 5px 6px;
  border-radius: 10px;
  border: 2px solid #94a3b8;
  background: #ffffff;
  color: #0f172a;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  box-shadow: inset 0 2px 4px rgba(15, 23, 42, 0.12);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  -moz-appearance: textfield;
}

.clause-order-chip__index:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
  outline: none;
}

.clause-order-chip__index::-webkit-outer-spin-button,
.clause-order-chip__index::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.clause-order-chip__segments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  overflow: visible;
}

.clause-order-chip__segment {
  padding: 2px 6px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.12);
  font-size: 0.76rem;
  font-weight: 600;
  white-space: normal;
  word-break: break-word;
  line-height: 1.2;
}

.clause-order-chip__latin {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 500;
  color: #334155;
  line-height: 1.25;
  word-break: break-word;
}

.clause-order-chip__latin-token {
  padding: 2px 6px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.12);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
}

.clause-order-chip__open {
  margin-top: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid #0f172a;
  background: #ffffff;
  color: #0f172a;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.2);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.clause-order-chip__open:hover,
.clause-order-chip__open:focus-visible {
  background: #0f172a;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.28);
  outline: none;
}

.clause-order-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px 20px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.clause-order-btn {
  min-width: 120px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 2px solid transparent;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.2s ease, color 0.2s ease;
}

.clause-order-btn.cancel {
  background: #ffffff;
  color: #dc2626;
  border-color: #dc2626;
}

.clause-order-btn.cancel:hover,
.clause-order-btn.cancel:focus-visible {
  background: #dc2626;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(220, 38, 38, 0.28);
  outline: none;
}

.clause-order-btn.confirm {
  background: #15803d;
  color: #ffffff;
  border-color: #15803d;
}

.clause-order-btn.confirm:hover,
.clause-order-btn.confirm:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(21, 128, 61, 0.3);
  outline: none;
}

#clause-reorder-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px 18px;
  z-index: 1750;
}

#clause-reorder-modal.is-open {
  display: flex;
}

.clause-reorder-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px 18px;
  background: rgba(15, 23, 42, 0.55);
  z-index: 2200;
}

.clause-reorder-overlay.is-open {
  display: flex;
}

.english-meta-dialog {
  width: min(960px, calc(100vw - 48px));
  max-height: 90vh;
}

.english-meta-body {
  overflow-y: auto;
  max-height: calc(90vh - 140px);
}

.english-meta-footer {
  gap: 12px;
}

.english-order-dialog {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 2100;
}

.english-order-dialog.is-open {
  display: flex;
}

.english-order-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
}

.english-order-dialog__panel {
  position: relative;
  background: #ffffff;
  border-radius: 18px;
  padding: 26px 28px;
  box-shadow: 0 28px 60px rgba(15, 23, 42, 0.32), 0 12px 24px rgba(15, 23, 42, 0.18);
  min-width: 280px;
  max-width: 400px;
  width: min(90vw, 360px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  font-family: 'DINNextRounded', sans-serif;
  z-index: 1;
}

.english-order-dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.english-order-dialog__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: #0f172a;
}

.english-order-dialog__close {
  border: none;
  background: transparent;
  color: #0f172a;
  font-size: 1.5rem;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.english-order-dialog__close:hover,
.english-order-dialog__close:focus-visible {
  background: rgba(15, 23, 42, 0.08);
  outline: none;
  transform: scale(1.05);
}

.english-order-dialog__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.english-order-dialog__metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0;
  font-size: 0.95rem;
  color: #0f172a;
}

.english-order-dialog__label {
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #475569;
}

.english-order-dialog__value {
  font-weight: 600;
  text-align: right;
  letter-spacing: 0.01em;
}

.clause-reorder-dialog {
  background: #ffffff;
  border-radius: 18px;
  width: calc(100vw - 48px);
  max-width: none;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 32px 80px rgba(15, 23, 42, 0.35), 0 8px 20px rgba(15, 23, 42, 0.25);
}

.clause-reorder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 12px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.clause-reorder-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
}

.clause-reorder-close {
  border: none;
  background: transparent;
  color: #0f172a;
  font-size: 20px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.clause-reorder-close:hover,
.clause-reorder-close:focus-visible {
  background: rgba(15, 23, 42, 0.08);
  transform: rotate(90deg);
  outline: none;
}

.clause-reorder-body {
  padding: 18px 24px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.clause-reorder-hint {
  margin: 0 0 14px;
  font-size: 0.95rem;
  color: #475569;
}

.clause-reorder-items {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
  justify-content: flex-start;
}

.clause-reorder-item {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 8px;
  padding: 16px 18px;
  border-radius: 12px;
  background: #f8fafc;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #0f172a;
  cursor: grab;
  border: 2px solid transparent;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
  flex: 0 0 auto;
  min-width: 160px;
  max-width: 220px;
  user-select: none;
}

.clause-reorder-item:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 3px;
}

.clause-reorder-item__stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  padding-bottom: 40px;
}

.clause-reorder-item__latin {
  display: block;
  text-align: left;
  font-size: 0.9rem;
  font-weight: 500;
  color: #475569;
  white-space: normal;
  word-break: break-word;
}

.clause-reorder-item__controls {
  position: absolute;
  right: 12px;
  bottom: 10px;
  display: flex;
  gap: 6px;
}

.clause-reorder-item__control {
  border: none;
  padding: 4px 0;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.18);
  color: #0f172a;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.clause-reorder-item__control:hover,
.clause-reorder-item__control:focus-visible {
  background: rgba(15, 23, 42, 0.32);
  color: #ffffff;
}

.clause-reorder-item__control:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.clause-reorder-item__control--add {
  background: rgba(16, 185, 129, 0.2);
  color: #047857;
}

.clause-reorder-item__control--add:hover,
.clause-reorder-item__control--add:focus-visible {
  background: rgba(16, 185, 129, 0.45);
  color: #f0fdf4;
}

.clause-reorder-item__control--remove {
  background: rgba(239, 68, 68, 0.2);
  color: #b91c1c;
}

.clause-reorder-item__control--remove:hover,
.clause-reorder-item__control--remove:focus-visible {
  background: rgba(239, 68, 68, 0.45);
  color: #fff1f2;
}

.clause-reorder-item--dragging {
  opacity: 0.75;
  cursor: grabbing;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.28);
}

.clause-reorder-item--drop {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35);
}

.clause-reorder-item--drop-before::before,
.clause-reorder-item--drop-after::after {
  content: '';
  position: absolute;
  top: 8px;
  bottom: 8px;
  width: 4px;
  background: #2563eb;
  border-radius: 999px;
}

.clause-reorder-item--drop-before::before {
  left: -8px;
}

.clause-reorder-item--drop-after::after {
  right: -8px;
}

.clause-reorder-empty {
  padding: 18px;
  text-align: center;
  color: #64748b;
  font-style: italic;
  border: 2px dashed #cbd5f5;
  border-radius: 12px;
  background: rgba(148, 163, 184, 0.08);
}

.clause-reorder-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px 20px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.clause-reorder-btn-cancel,
.clause-reorder-btn-confirm {
  min-width: 120px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 2px solid transparent;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.2s ease, color 0.2s ease;
}

.clause-reorder-btn-cancel {
  background: #ffffff;
  color: #dc2626;
  border-color: #dc2626;
}

.clause-reorder-btn-cancel:hover,
.clause-reorder-btn-cancel:focus-visible {
  background: #dc2626;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(220, 38, 38, 0.28);
  outline: none;
}

.clause-reorder-btn-confirm {
  background: #15803d;
  color: #ffffff;
  border-color: #15803d;
  opacity: 0.55;
  cursor: not-allowed;
}

.clause-reorder-btn-confirm.is-enabled {
  opacity: 1;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(21, 128, 61, 0.26);
}

.clause-reorder-btn-confirm.is-enabled:hover,
.clause-reorder-btn-confirm.is-enabled:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(21, 128, 61, 0.32);
  outline: none;
}

.whitaker-modal-content {
  background: #ffffff;
  border-radius: 12px;
  width: min(720px, 94vw);
  max-height: 82vh;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.2);
  display: flex;
  flex-direction: column;
}

.whitaker-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(99, 102, 241, 0.08));
}

.whitaker-modal-title {
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
}

.whitaker-modal-close {
  border: none;
  background: transparent;
  font-size: 1rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  color: #1f2937;
  transition: background 0.15s ease, color 0.15s ease;
}

.whitaker-modal-close:hover {
  background: rgba(15, 23, 42, 0.08);
  color: #111827;
}

.whitaker-modal-body {
  padding: 16px 22px 20px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.whitaker-modal-search {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.whitaker-modal-search-form {
  display: block;
}

.whitaker-modal-search-form input[type="search"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(15, 23, 42, 0.18);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
}

.whitaker-modal-search-form input[type="search"]:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.whitaker-modal-search-status {
  font-size: 0.85rem;
  color: #475569;
  min-height: 1em;
}

.whitaker-modal-search-status.is-error {
  color: #b91c1c;
}

.whitaker-modal-search-status.is-muted {
  color: #64748b;
}

.whitaker-modal-search-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  padding-top: 10px;
}

.whitaker-modal-search-heading {
  font-weight: 600;
  font-size: 0.9rem;
  color: #1f2937;
}

.whitaker-modal-search-empty {
  font-size: 0.85rem;
  color: #64748b;
}

.whitaker-modal-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.whitaker-modal-search-entry .dictionary-candidate-entry {
  border-radius: 6px;
}

.whitaker-modal-entry .dictionary-candidate-entry {
  border-radius: 8px;
}

.whitaker-modal-entry .dictionary-candidate-entry:hover {
  background: rgba(59, 130, 246, 0.12);
}

.whitaker-modal-entry .dictionary-candidate-entry.is-selected {
  background: rgba(59, 130, 246, 0.18);
  border: 1px solid rgba(59, 130, 246, 0.32);
}

.whitaker-modal-entry:focus {
  outline: 2px solid rgba(59, 130, 246, 0.65);
  outline-offset: 4px;
}

#dictionary-tooltip {
  position: absolute;
  top: 0;
  left: 0;
  max-width: 240px;
  padding: 0;
  background: transparent;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 1600;
}

#dictionary-tooltip.is-visible {
  visibility: visible;
  opacity: 1;
}

.syntax-tooltip {
  background: #ffffff;
  color: #111111;
  border: 2px solid #000000;
  border-radius: 12px;
  min-width: 200px;
  max-width: 240px;
  padding: 10px 12px 12px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  font-size: 0.78rem;
  pointer-events: auto;
}

.syntax-tooltip__title {
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}

.syntax-tooltip__rows {
  display: none;
}

.syntax-tooltip__sentence {
  font-size: 0.78rem;
  line-height: 1.34;
  color: #111111;
}

.clause-cell-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-align: left;
  width: 100%;
  cursor: pointer;
  border-radius: 10px;
  padding: 6px 10px 6px 6px;
  min-height: 100%;
  position: relative;
}

.clause-cell-inner:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.clause-cell-inner.is-bulk-selected {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.08);
}

.clause-cell-inner.is-editing {
  background: rgba(37, 99, 235, 0.08);
}

.clause-editor {
  display: none;
  width: 100%;
  min-height: 2.6rem;
  margin-top: 2px;
  padding: 6px 8px;
  border: 1px solid rgba(15, 23, 42, 0.18);
  border-radius: 8px;
  font: inherit;
  line-height: 1.4;
  resize: vertical;
  box-sizing: border-box;
  background: #ffffff;
  color: inherit;
}

.clause-cell-inner.is-editing .clause-english-wrap,
.clause-cell-inner.is-editing .clause-label-badge {
  display: none;
}

.clause-cell-inner.is-editing .clause-editor {
  display: block;
}

.clause-english-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  max-width: calc(var(--clause-col-width, 240px) - 8px);
  line-height: 1.4;
  align-items: flex-start;
}

.word-summary-table td.clause-cell.clause-cell-wide .clause-english-wrap {
  max-width: calc(var(--clause-col-width, 260px) - 8px);
}

.word-summary-table td.clause-cell.clause-cell-wide .clause-cell-inner {
  padding-right: 14px;
}

.clause-english-wrap.is-empty {
  opacity: 0.6;
  font-style: italic;
}

.clause-word {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 4px;
  min-height: 22px;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.015em;
  font-size: inherit;
  line-height: 1.05;
  box-shadow: 0 1px 1px rgba(15, 23, 42, 0.1);
  word-break: normal;
  white-space: normal;
  overflow-wrap: break-word;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  text-align: left;
  position: relative;
}

.clause-english-wrap.is-empty {
  color: #64748b;
}

.clause-reorder-btn {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid #111827;
  background: #ffffff;
  color: #111827;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.2s ease, color 0.2s ease;
}

.clause-reorder-btn:hover,
.clause-reorder-btn:focus-visible {
  background: #111827;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.32);
}

.clause-reorder-btn:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.clause-reorder-btn:active {
  transform: scale(0.96);
}

.word-summary-table tbody tr:hover .clause-word {
  transform: translateY(-0.5px);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.16);
}

.clause-label-badge {
  display: none;
  align-items: center;
  gap: 6px;
  background: #f8f8f8;
  border: 2px solid #111827;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1.25;
  letter-spacing: 0.025em;
  color: #111827;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  max-width: 160px;
  flex-wrap: wrap;
  row-gap: 2px;
  cursor: pointer;
}

.clause-cell-inner.is-active .clause-label-badge {
  display: inline-flex;
}

.clause-label-badge.badge-relative-clause,
.clause-label-badge.badge-adjectival {
  border-color: #78350f;
}

.clause-label-badge.badge-adverbial,
.clause-label-badge.badge-clause-adverbial {
  border-color: #065f46;
}

.clause-label-badge.badge-clause-nominal,
.clause-label-badge.badge-nominal {
  border-color: #5b21b6;
}

.clause-label-code {
  display: inline-block;
  background: #0f172a;
  color: #fff;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  letter-spacing: 0.18em;
}

.clause-label-text {
  font-weight: 600;
  letter-spacing: 0.03em;
}

.word-summary-table .latin-cell span {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 600;
}

/* Hide old right panel when footer is active */
#right-panel { display: none; }

/* removed duplicate #right-panel rule */

/* Footer */
/* Parsing: one row per item */
#inspector {
  display: block;
}

#inspector > div {
  display: block;
  margin: 2px 0 6px;
}

/* Commentary compact style */
/* Commentary compact style */
#commentary.commentary-box {
  font-size: 0.9rem;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Enhanced select styling */
#right-panel select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
}

#right-panel select option {
  background: #333;
  color: #fff;
}

.deck-select label {
  color: #fff;
  font-weight: 500;
  margin-bottom: 8px;
  display: block;
}

/* Commentary box */
.commentary-box {
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  padding: 12px;
  min-height: 100px;
  background: rgba(255,255,255,0.06);
  white-space: normal;
  font-size: 14px;
  line-height: 1.5;
}

/* 🧱 Treebank Word Boxes */
.word,
.word-box {
  position: absolute;
  z-index: 10;
  display: inline-block;
  /* Scale padding with font size for readability on large screens */
  padding: 0.55em 0.9em;
  background: white;
  border: 2px solid black;
  border-radius: 12px;
  font-family: 'DINNextRounded', sans-serif;
  font-size: 1.1em;
  color: black;
  transition: background-color 0.3s, box-shadow 0.3s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.word-box {
  scroll-margin: 0 !important;
  scroll-padding: 0 !important;
  scroll-snap-align: none !important;

  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;

  -webkit-tap-highlight-color: transparent;
}

.word-box.word-ellipsis {
  color: #666666;
  border-color: rgba(120, 120, 120, 0.55);
  background-color: rgba(80, 80, 80, 0.08);
  opacity: 0.95;
}

.word-box.word-ellipsis .word-inner {
  color: inherit;
}

.word-box:hover {
  background-color: #f9f9f9;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.word-text:hover {
  background-color: #eeeeee;
}

.word-box:focus {
  outline: none;
  box-shadow: none;
}

/* Ensure word boxes are positioned absolutely for layout */
.word-box { position: absolute; }


/* 🪵 Waiting Area Panel */
.staging-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: clamp(18px, 2vw, 24px);
  background: #ffffff;
  border: 2px solid #000000;
  border-radius: 18px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.staging-panel.is-hidden {
  display: none;
}

.staging-panel__header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  padding: 10px 18px 12px;
  background: #000000;
  border-radius: 12px 12px 0 0;
}

.scansion-header-container {
  display: none;
  flex-direction: column;
  flex: 1 1 auto;
}

#header-row.tbv-has-scansion .scansion-header-container {
  display: flex;
}

.scansion-box {
  display: flex;
  flex-direction: column;
  gap: 0;
  font-size: 1.2em;
  line-height: 1.4;
  max-height: 260px;
  overflow-y: auto;
}

.scansion-box.is-hidden {
  display: none;
}

.scansion-status,
.scansion-error,
.scansion-note {
  font-size: 0.95em;
  color: #475569;
}

.scansion-error {
  color: #b91c1c;
}

.scansion-row {
  border: none;
  padding: 0;
  background: transparent;
  box-shadow: none;
  margin: 0;
}

.scansion-line {
  font-size: inherit;
  line-height: inherit;
  font-family: 'DM Sans', sans-serif;
  color: #0f172a;
  letter-spacing: normal;
  font-weight: 400;
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.scansion-line-text {
  font-size: inherit;
  line-height: inherit;
}

.scansion-row-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-weight: 600;
  color: #0f172a;
}

.scansion-line-number {
  font-weight: 700;
  cursor: pointer;
}

.scansion-line-number:hover,
.scansion-line-number:focus {
  text-decoration: underline;
}

.scansion-pattern {
  font-family: 'DM Sans', sans-serif;
  letter-spacing: 0.05em;
}

.scansion-row.is-missing .scansion-pattern {
  color: #b91c1c;
  font-style: italic;
}

.scansion-verse {
  margin-top: 4px;
  font-size: 0.95em;
  color: #334155;
}

.scansion-note {
  font-style: italic;
}
.scansion-table {
  border-collapse: collapse;
  table-layout: auto;
  font-family: 'DM Sans', sans-serif;
  display: inline-table;
  margin: 0;
  width: auto;
}

.scansion-table__cell {
  border: 1px solid #cbd5f5;
  padding: 4px 8px;
  text-align: center;
  font-size: 0.96rem;
  color: #0f172a;
  background: #f8fafc;
  white-space: nowrap;
}

.scansion-table__cell--label {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  font-weight: 600;
  color: #ffffff;
  background: #000000;
  cursor: pointer;
  width: 72px;
}

.scansion-table__cell--analysis {
  text-align: left;
  white-space: normal;
  font-size: 0.9rem;
  line-height: 1.35;
  background: #ffffff;
  color: #1f2937;
  font-family: 'DM Sans', sans-serif;
}



.scansion-foot-text {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.scansion-table__cell--dactyl .scansion-foot-text {
  background: #fdfdf9;
  color: #0f172a;
}

.scansion-table__cell--spondee .scansion-foot-text {
  background: #0f172a;
  color: #ffffff;
}

.scansion-table__cell--trochee .scansion-foot-text {
  background: #d1d5db;
  color: #111827;
}

.scansion-table__cell--unknown .scansion-foot-text {
  background: #eaecf0;
  color: #475569;
}
.scansion-table__cell--foot {
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
}

.scansion-table__cell--dactyl {
  background: #ffffff;
}

.scansion-table__cell--spondee {
  background: #ffffff;
}

.scansion-table__cell--trochee {
  background: #ffffff;
}

.scansion-table__cell--unknown {
  background: #f8fafc;
  color: #94a3b8;
  font-style: italic;
}


.staging-panel__title {
  margin: 0;
  font-family: "DINNextRounded", "DM Sans", sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: left;
  color: #ffffff;
  font-weight: 800;
}




.staging-panel__meta {
  font-size: 0.85rem;
  color: #1f2937;
  white-space: nowrap;
}

.staging-panel__list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  border: 2px dashed #000000;
  border-radius: 12px;
  padding: 16px;
  min-height: 72px;
  background: rgba(0, 0, 0, 0.04);
  transition: border-color 0.2s ease, background 0.2s ease;
}



.staging-panel--highlight .staging-panel__list {
  border-color: #000000;
  background: rgba(0, 0, 0, 0.08);
}





.word-staging-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 12px;
  border: 2px solid #000000;
  background: rgba(0, 0, 0, 0.06);
  color: #111111;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: grab;
  user-select: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.word-staging-item.word-dragging {
  opacity: 0.82;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.25);
}

body:not(.edit-mode) .staging-panel {
  display: none;
}



[data-word-id].highlighted {
  font-weight: 500;
  border: 2.75px solid black !important;
  outline: 0px solid black !important;
  text-shadow: 0 0 .75px rgba(0, 0, 0, .75);
  outline-offset: px;
  z-index: 500 !important;
   box-shadow:
    0 2px 6px rgba(0, 0, 0, 0.5),
    0 0 4px 2px rgba(255, 255, 255, 0.6);

  border-radius: 6px;
  /* remove conflicting secondary z-index */

  transition:
    box-shadow 0.2s ease,
    outline 0.2s ease;
    transform: translateY(-1px);
}

.tree-panel [data-word-id].highlighted {
  border-color: #0a0a0a !important;
  border-width: 3px !important;
  background: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.28),
    0 4px 12px rgba(0, 0, 0, 0.2);
  transform: translateY(-1.5px) scale(1.012);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.25s ease,
    border-color 0.2s ease;
}

.tree-panel .word-box.composite-word.highlighted {
  background-color: #00ff00 !important;
  border-color: #000000 !important;
  border-width: 3px !important;
}

.clause-word.highlighted {
  border: 1.5px solid #0f172a !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.45), 0 1px 3px rgba(15, 23, 42, 0.15) !important;
  transform: translateY(-0.3px);
}

/* 🌟 Participle styling - case color + green halo (additive, not overriding) */
.participle {
  box-shadow: 
    0 2px 4px rgba(0, 0, 0, 0.1),  /* Keep original shadow */
    0 0 8px 2px rgba(34, 139, 34, 0.6); /* Add green halo */
  border: 2px solid rgba(34, 139, 34, 0.8);
  /* Don't override background color - let case colors show through */
}

/* 🎯 Composite infinitives (e.g., profectos esse, inventurum esse) */
.word-box.composite-word {
  position: relative;
}

.word-box.composite-word .word-inner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}


.composite-display {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 14px;
  position: relative;
  background: linear-gradient(90deg, rgba(0, 255, 0, 0.16), rgba(0, 255, 0, 0.04));
  box-shadow:
    0 0 10px rgba(0, 255, 0, 0.18),
    inset 0 0 0 1px rgba(0, 160, 0, 0.28);
}

.composite-display::before {
  content: '';
  position: absolute;
  inset: -4px -8px;
  border-radius: 16px;
  background: radial-gradient(circle at 30% 50%, rgba(0, 255, 0, 0.22), transparent 60%);
  filter: blur(2px);
  z-index: 1;
  pointer-events: none;
}


.composite-part {
  display: inline-block;
  font-size: inherit;
  line-height: inherit;
  cursor: pointer;
  position: relative;
}

.composite-part-primary {
  z-index: 6;
  box-shadow: 0 0 8px rgba(0, 255, 0, 0.35);
}

.composite-part-secondary {
  z-index: 6;
}

#latin-box .composite-part,
#latin-box .composite-part-primary,
#latin-box .composite-part-secondary {
  display: inline;
  padding: 0 3px;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  font-weight: 400;
}

#latin-box .composite-part.highlighted {
  border: none !important;
  box-shadow: none !important;
}

#latin-box .composite-wrapper {
  display: inline-block;
  border-radius: 0;
  padding: 0;
}

#latin-box .composite-wrapper.highlighted {
  border-radius: 0 !important;
}

.word-summary-table .composite-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: transparent;
  border: none;
  padding: 6px 10px;
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
}

.word-summary-table .composite-wrapper.highlighted {
  border: none !important;
  box-shadow: none !important;
  text-shadow: none !important;
  outline: none !important;
  transform: none !important;
}

.word-summary-table [data-word-id].highlighted {
  font-weight: 400 !important;
}

.composite-part:hover {
  transform: none;
}
/* Frozen footer: minimal dictionary bar */
/* Parsing table styling (inspector) */
.parse-table {
  border-collapse: collapse;
  width: 100%;
  background: #fff;
  border: none;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  outline: none;
  font-size: 1.2em;   /* match Latin/English */
  line-height: 1.4;   /* match Latin/English */
  margin: 0;
}
.parse-table thead th {
  background: #000;
  color: #fff;
  text-align: center;
  font-weight: 700;
  padding: 2px 4px;
  border-right: none;
  border-bottom: none;
}
.parse-table thead th:last-child { border-right: none; }
.parse-table tbody td {
  background: #fff;
  color: #000;
  text-align: center;
  padding: 2px 4px;
  border-top: 1px solid #e0e0e0; /* subtle row divider */
  border-right: none;
}
.parse-table tbody td:last-child { border-right: none; }

.parse-layout {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.parse-chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 4px;
}

.parse-chip {
  display: flex;
  flex-direction: column;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #d1d5db;
}

.parse-chip .chip-label {
  background: #111827;
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
}

.parse-chip .chip-value {
  padding: 3px 6px;
  font-size: 0.66rem;
  color: #111827;
}

.parse-table.parse-table-vertical {
  font-size: 0.66rem;
  border-radius: 6px;
  overflow: hidden;
  line-height: 1.15;
}

.parse-table.parse-table-vertical tbody {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0;
}

.parse-table.parse-table-vertical tr {
  display: flex;
  flex-direction: column;
}

.parse-table.parse-table-vertical th {
  background: #111827;
  color: #ffffff;
  font-weight: 600;
  padding: 3px 6px;
  text-align: left;
  border: none;
  border-radius: 4px 4px 0 0;
}

.parse-table.parse-table-vertical td {
  background: #ffffff;
  color: #111827;
  padding: 3px 6px;
  border: 1px solid #d1d5db;
  border-top: none;
  border-radius: 0 0 4px 4px;
  word-break: break-word;
}

/* (reverted) iframe-specific borders removed */
#content .structure-label .label-handle {
  display: none;
}

/* Clause/phrase labels: smaller, white tags that sit below the node to avoid crowding */
#content .structure-label {
  background: #ffffff;
  color: #000;
  border: 2px solid #ffffff;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.25;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
  transform: translateY(12px);
}
/* Label dragging UX */
body.edit-mode #content .structure-label {
  cursor: grab;
  transition: box-shadow 80ms ease, outline-color 80ms ease, outline-width 80ms ease;
}
body.edit-mode #content .structure-label.dragging {
  cursor: grabbing;
}
body.edit-mode #content .structure-label.label-selected {
  outline: 2px dashed #27c;
}
/* Resize handles for clause/phrase boxes (edit mode only) */
.box-resize-handle { display: none; }
body.edit-mode .structure-box.box-selected .box-resize-handle { display: block; }
body.edit-mode .structure-box.box-selected {
  outline: 2px dashed #27c;
  outline-offset: 2px;
}
.structure-label[data-word-id] {
  cursor: pointer;
}

.structure-label[data-word-id].highlighted {
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.35);
  border-color: #000 !important;
}

.clause-english-container {
  pointer-events: auto;
}

.clause-english-segment {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1.2;
  padding: 4px 9px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
  cursor: grab;
  user-select: none;
  transition: box-shadow 120ms ease, transform 120ms ease, opacity 120ms ease;
  color: #111827;
  background: #f3f4f6;
}

.clause-english-segment.dragging {
  opacity: 0.85;
  transform: scale(1.02);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35);
}

.english-viewer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
  z-index: 1200;
  transition: transform 180ms ease, opacity 180ms ease;
}

.english-viewer.is-open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.english-viewer__panel {
  width: min(96vw, 1280px);
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -12px 28px rgba(15, 23, 42, 0.25);
  padding: 16px 24px 28px;
  box-sizing: border-box;
  border: 1px solid rgba(17, 24, 39, 0.1);
}

.english-viewer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.english-viewer__title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #111827;
}

.english-viewer__close {
  border: none;
  background: rgba(17, 24, 39, 0.08);
  color: #111827;
  border-radius: 999px;
  font-size: 16px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 120ms ease, transform 120ms ease;
}

.english-viewer__close:hover {
  background: rgba(17, 24, 39, 0.16);
  transform: scale(1.05);
}

.english-viewer__content {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px;
  max-height: 40vh;
  overflow-y: auto;
  padding-bottom: 8px;
}

.tree-english-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: 16px;
  padding: 22px 26px;
  width: 100%;
  border-radius: 28px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.18);
  font-family: 'DINNextRounded', sans-serif;
  font-size: 18px;
  line-height: 1.3;
  transition: background-color 0.28s ease, box-shadow 0.28s ease;
}

.tree-english-strip--viewer {
  box-shadow: none;
  background: transparent;
  border: none;
}

.english-clause {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 18px 16px;
  border-radius: 20px;
  border: 1.5px solid rgba(148, 163, 184, 0.55);
  background: rgba(241, 245, 249, 0.92);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.14);
  min-width: 160px;
  max-width: 100%;
  transition: transform 0.28s ease, box-shadow 0.28s ease, background-color 0.28s ease;
}

.english-clause--plain {
  border-color: rgba(203, 213, 225, 0.7);
  background: rgba(248, 250, 252, 0.85);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.1);
}

.english-clause__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  color: #0f172a;
}

.english-clause__label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.01em;
}

.english-clause__handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: none;
  background: rgba(15, 23, 42, 0.1);
  color: #0f172a;
  font-size: 16px;
  cursor: grab;
  transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.english-clause__handle:hover {
  background: rgba(15, 23, 42, 0.18);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.15);
}

.english-clause__handle:active {
  cursor: grabbing;
  transform: translateY(1px);
}

.english-clause__handle:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.75);
  outline-offset: 2px;
}

.english-clause__words {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.english-clause__words--plain {
  gap: 6px;
}

.english-clause--dragging {
  transform: scale(1.02);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.24);
  opacity: 0.96;
}

.english-clause-gap {
  flex: 0 0 18px;
  width: 18px;
  height: 52px;
  border-radius: 12px;
  background: rgba(148, 163, 184, 0.2);
  transition: background-color 0.2s ease, transform 0.22s ease, box-shadow 0.22s ease;
}

.english-clause-gap--drop {
  background: rgba(37, 99, 235, 0.26);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.22);
  transform: scaleY(1.08);
}

.tree-english-strip__item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  margin: 0;
  border-radius: 16px;
  border: 1.25px solid rgba(148, 163, 184, 0.45);
  background: rgba(248, 250, 252, 0.92);
  color: #0f172a;
  cursor: grab;
  user-select: none;
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
  transition:
    transform 0.28s ease,
    box-shadow 0.28s ease,
    background-color 0.28s ease,
    border-color 0.28s ease,
    opacity 0.28s ease;
}

.tree-english-strip__item:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.26);
}

.tree-english-strip__item::before {
  display: none;
}

.tree-english-strip__item--head::before {
  display: none;
}

.tree-english-strip__item--dragging {
  transform: scale(1.04) rotate(-1deg);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.28);
  opacity: 0.96;
}

.tree-english-strip__item--selected {
  border-color: rgba(37, 99, 235, 0.85) !important;
  box-shadow:
    0 0 0 3px rgba(59, 130, 246, 0.2),
    0 12px 28px rgba(15, 23, 42, 0.24);
  transform: translateY(-4px) scale(1.012);
}

.text-box.is-hidden {
  display: none !important;
}

.clause-order-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 26px;
  height: 26px;
  padding: 2px 8px;
  border-radius: 14px;
  background: #111827;
  color: #f9fafb;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.35);
  cursor: grab;
  user-select: none;
  z-index: 6;
  pointer-events: auto;
}

.clause-order-badge.dragging {
  opacity: 0.7;
  cursor: grabbing;
}

.word-box.word-drop-target {
  outline: 2px dashed #2563eb;
  outline-offset: 4px;
}

.word-box.word-dragging {
  opacity: 0.78;
}

.composite-word-wrapper {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
}

.composite-wrapper {
  display: inline-block;
  position: relative;
  padding: 0;
  margin: 0;
  background: transparent;
  border-radius: 14px;
}

.composite-wrapper.highlighted {
  border: 2px solid #000 !important;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.8), 0 2px 6px rgba(0,0,0,0.35) !important;
}

.composite-word-wrapper.word-text {
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

.composite-word-display {
  cursor: pointer;
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.32);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.loading-overlay.is-visible {
  display: flex;
}

.loading-overlay-content {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 18px 28px;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  min-width: 220px;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 4px solid rgba(79, 70, 229, 0.2);
  border-top-color: #4f46e5;
  border-radius: 50%;
  animation: loading-spin 1s linear infinite;
}

.loading-message {
  font-size: 0.95rem;
  color: #111827;
  font-weight: 600;
  text-align: center;
}

.anthology-heading {
  margin: 0 0 1rem;
  font-size: 1.3rem;
  font-weight: 700;
  text-align: left;
}

.anthology-line {
  font-size: 1rem;
  line-height: 1.55;
  margin: 0 0 0.85rem;
  color: #111827;
}

.anthology-subheading {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: #1f2937;
}

.anthology-section {
  margin-bottom: 1rem;
}

.loading-progress {
  width: 100%;
  height: 6px;
  background: rgba(79, 70, 229, 0.15);
  border-radius: 999px;
  overflow: hidden;
}

.loading-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1 0%, #4f46e5 100%);
  border-radius: 999px;
  transition: width 0.25s ease;
}

@keyframes loading-spin {
  to {
    transform: rotate(360deg);
  }
}

#toggle-selectors {
  background: #fff;
  color: #000;
  border-color: #000;
}

#toggle-selectors:hover,
#toggle-selectors.is-active {
  background: #000;
  color: #fff;
  border-color: #fff;
}
.fullscreen-active .logo-row {
  display: none;
}

/* --- Create Treebank Layout --- */
.featured-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 16px;
  font-family: 'Montserrat', 'DM Sans', sans-serif;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: #000;
  color: #fff;
  border: 2px solid #fff;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease;
  text-decoration: none;
  box-shadow: 0 18px 42px rgba(15, 15, 15, 0.35);
}

.featured-button:hover,
.featured-button:focus-visible {
  transform: translateY(-2px);
  background: #fff;
  color: #000;
  border-color: #000;
  box-shadow: 0 22px 50px rgba(15, 15, 15, 0.45);
}

.treebank-create {
  min-height: calc(100vh - 140px);
  padding: clamp(48px, 6vw, 88px) clamp(16px, 6vw, 72px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: #f5f5f5;
}

.create-card {
  width: min(1180px, 100%);
  background: #ffffff;
  border: 2px solid #000;
  border-radius: 24px;
  padding: clamp(32px, 5vw, 48px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
  color: #222;
  font-family: 'Neon', 'DM Sans', sans-serif;
}

.create-card h1 {
  margin: 0 0 12px;
  font-size: clamp(1.8rem, 2.2vw, 2.25rem);
  font-weight: 700;
  color: #000;
  font-family: 'Neon', 'DM Sans', sans-serif;
}

.create-card .muted {
  margin: 0 0 28px;
  color: #000;
  font-family: 'Neon', 'DM Sans', sans-serif;
  line-height: 1.6;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.render-options {
  gap: 12px;
}

.render-options legend {
  font-size: 0.92rem;
  font-weight: 600;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: 'Neon', 'DM Sans', sans-serif;
}

.render-options__row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.render-options__row--indented {
  padding-left: 6px;
}

.checkbox-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #0f172a;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.04);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.checkbox-pill input[type="checkbox"] {
  accent-color: #0f172a;
}

.checkbox-pill:hover {
  border-color: #111;
  background: rgba(15, 23, 42, 0.08);
}

.checkbox-pill span {
  pointer-events: none;
}

.form-field label,
.create-card legend {
  font-size: 0.92rem;
  font-weight: 600;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: 'Neon', 'DM Sans', sans-serif;
}

.create-card small {
  font-size: 0.75rem;
  color: #64748b;
  font-family: 'DM Sans', sans-serif;
}

.create-card input[type="text"],
.create-card textarea,
.create-card select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid #000;
  background: #ffffff;
  color: #0f172a;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  resize: vertical;
  min-height: 52px;
}

.create-card input[type="text"]:focus,
.create-card textarea:focus,
.create-card select:focus {
  border-color: #000;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.15);
  outline: none;
}

.create-card textarea {
  min-height: 140px;
}

.create-card fieldset {
  border: 1px solid #000;
  border-radius: 18px;
  padding: 18px 22px 12px;
  margin-bottom: 24px;
  background: #ffffff;
}

.create-card fieldset label {
  font-size: 0.95rem;
  font-weight: 500;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: 22px;
}

.create-card input[type="radio"] {
  accent-color: #000;
}

.form-actions {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

.create-card .primary,
.create-card button,
.create-card .secondary {
  border-radius: 14px;
  padding: 12px 22px;
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.create-card .primary,
.create-card button.secondary,
#preview-button {
  background: #000;
  color: #fff;
  border: 2px solid #000;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.18);
}

.create-card .primary:hover,
.create-card button.secondary:hover,
#preview-button:hover {
  transform: translateY(-2px);
  background: #fff;
  color: #000;
  border-color: #000;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
}

#preview-panel {
  margin-top: 36px;
  padding: 24px;
  border-radius: 20px;
  background: #ffffff;
  border: 1px solid #000;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
}

#preview-panel.hidden {
  display: none;
}

#preview-panel h2 {
  margin: 0 0 12px;
  font-size: 1.25rem;
  color: #f8fafc;
}

#preview-panel .muted {
  margin-bottom: 18px;
}

#preview-errors {
  margin-top: -8px;
  margin-bottom: 18px;
  color: #475569;
  font-size: 0.85rem;
  line-height: 1.4;
}

#preview-errors.warning {
  color: #ef4444;
}

#preview-errors ul {
  margin: 8px 0 0 18px;
  padding: 0;
  list-style: disc;
}

#preview-errors li {
  margin-bottom: 4px;
}

#preview-errors .preview-ok {
  color: #0d9488;
}

#preview-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
}

#preview-table th,
#preview-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  text-align: left;
  font-size: 0.9rem;
  vertical-align: top;
}

#preview-table th {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: #0f172a;
  background: rgba(15, 15, 15, 0.08);
}

#preview-table td:first-child {
  width: 3rem;
  font-weight: 600;
  color: #1f2937;
}

#preview-table tr:last-child td {
  border-bottom: none;
}

.helper {
  font-size: 0.78rem;
  color: #000;
  margin: 4px 0 18px;
  font-family: 'DM Sans', sans-serif;
}

.form-field.compact {
  margin-bottom: 0;
}

.form-field.compact label {
  font-size: 0.78rem;
}

.form-field.compact select,
.form-field.compact input[type="text"] {
  min-height: 46px;
}

.passages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 32px;
  margin: 32px 0;
  align-items: start;
}

@media (max-width: 768px) {
  .treebank-create {
    padding: 32px 14px 64px;
  }

  .create-card {
    padding: 28px 22px;
  }

  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  #preview-panel {
    padding: 20px;
  }
}

.custom-path-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  align-items: start;
}

.custom-path-grid input[type="text"] {
  width: 100%;
  min-width: 0;
}

.folder-grid .form-field,
.passages-grid .form-field {
  width: 100%;
  min-width: 0;
}

.create-card input[type="text"],
.create-card textarea,
.create-card select {
  box-sizing: border-box;
}

.toggle-field {
  border: 1px solid #000;
  border-radius: 18px;
  padding: 20px;
  background: #ffffff;
  margin-bottom: 28px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.toggle-label {
  font-family: 'Neon', 'DM Sans', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.9rem;
  color: #000;
}

.toggle-buttons {
  display: inline-flex;
  gap: 12px;
}

.mode-btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid #000;
  background: #fff;
  color: #000;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.mode-btn.is-active {
  background: #000;
  color: #fff;
}

.mode-btn:hover {
  transform: translateY(-2px);
}

.folder-mode {
  display: block;
}

.folder-mode.is-hidden {
  display: none;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  align-items: start;
}

.extra-section {
  margin-top: 18px;
  border: 1px dashed #000;
  border-radius: 14px;
  padding: 14px 18px;
  background: #f8fafc;
}

.extra-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  font-family: 'Neon', 'DM Sans', sans-serif;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: #0f172a;
}

.extra-add {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid #000;
  background: #fff;
  color: #000;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.extra-add:hover {
  background: #000;
  color: #fff;
}

.extra-list {
  display: grid;
  gap: 12px;
}

.extra-input {
  display: flex;
  align-items: center;
  gap: 12px;
}

.extra-input input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid #000;
  border-radius: 12px;
  background: #fff;
}

.extra-remove {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: #000;
}

/* Collaborative presence */
.presence-remote-highlight {
  position: relative;
  box-shadow: 0 0 0 2px var(--presence-color, #845ef7);
  border-radius: 6px;
}

.presence-remote-badge {
  position: absolute;
  top: -1.4em;
  left: 0;
  transform: translateX(-4px);
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #000;
  background: var(--presence-color, #845ef7);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  pointer-events: none;
  z-index: 5;
}

.presence-roster {
  position: fixed;
  top: 16px;
  right: 24px;
  min-width: 200px;
  background: rgba(17, 24, 39, 0.92);
  border-radius: 14px;
  padding: 12px 16px;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.35);
  font-family: 'DM Sans', sans-serif;
  color: #f8fafc;
  backdrop-filter: blur(10px);
  z-index: 1600;
}

.presence-roster--inline {
  position: static;
  top: auto;
  right: auto;
  min-width: 0;
  padding: 0;
  background: transparent;
  color: #0f172a;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.presence-roster--inline .presence-roster__title {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #475569;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-start;
  cursor: default;
  user-select: none;
}

.presence-roster--inline .presence-roster__list {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.presence-roster--inline .presence-roster__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  color: inherit;
  font-size: 0.78rem;
}

.presence-roster--inline .presence-roster__dot {
  width: 8px;
  height: 8px;
  box-shadow: none;
}

.presence-roster--inline .presence-roster__name {
  color: inherit;
}

.presence-roster--inline .presence-roster__name--you {
  color: #0b7285;
}

.presence-roster--inline .presence-roster__status {
  display: none;
}

.presence-roster.is-hidden {
  display: none;
}

.presence-roster.is-dragging {
  cursor: grabbing;
}

.presence-roster__title {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #cbd5f5;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.presence-roster.is-dragging .presence-roster__title {
  cursor: grabbing;
}

.presence-roster__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.word-editor {
  position: fixed;
  bottom: 32px;
  right: 24px;
  width: min(340px, 95vw);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 16px;
  background: rgba(248, 250, 252, 0.95);
  box-shadow: 0 28px 56px rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(148, 163, 184, 0.25);
  font-family: 'DM Sans', sans-serif;
  z-index: 1650;
  color: #0f172a;
}

.word-editor.is-hidden {
  display: none;
}

.word-editor__header {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.word-editor__title {
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #475569;
}

.word-editor__tabs {
  display: flex;
  gap: 6px;
}

.word-editor__tab {
  flex: 1 1 auto;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(226, 232, 240, 0.6);
  color: #0f172a;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.word-editor__tab.is-active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
}

.word-editor__tab:not(.is-active):hover {
  background: rgba(203, 213, 225, 0.85);
}

.word-editor__body {
  position: relative;
}

.word-editor__input-wrapper {
  position: relative;
}

.word-editor__input {
  width: 100%;
  padding: 12px 14px;
  font-size: 0.95rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: transparent;
  color: #0f172a;
  font-family: 'DM Sans', sans-serif;
  position: relative;
  z-index: 1;
}

.word-editor__input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.word-editor__ghost {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 0.95rem;
  font-family: 'DM Sans', sans-serif;
  color: rgba(15, 23, 42, 0.35);
  white-space: pre;
  width: calc(100% - 28px);
  overflow: hidden;
}

.word-editor__ghost.is-empty {
  display: none;
}

.word-editor__ghost-prefix {
  color: transparent;
}

.word-editor__ghost-suffix {
  color: rgba(15, 23, 42, 0.35);
}

.word-editor__footer {
  font-size: 0.74rem;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.presence-roster__item {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

.presence-roster__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--presence-color, #845ef7);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.presence-roster__name {
  font-weight: 600;
  color: #f8fafc;
}

.presence-roster__name--you {
  color: #8ef1ff;
}

.presence-roster__status {
  grid-column: 2;
  font-size: 0.72rem;
  color: rgba(248, 250, 252, 0.7);
}



body.treebanks-page {
  /* 🔹 Main layout variables */
  --tbv-header-gap: clamp(72px, 9vh, 140px);
  --tbv-slot-delta: 10px;       /* green + orange areas */
  --tbv-zoom-extra: 0px;        /* blue area (#zoom-wrap) */
  --tbv-panel-height: 100dvh;
  --tbv-table-header: 72px;
}


/* 🔹 Core height calculation shared by main panels */
body.treebanks-page #workspace,
body.treebanks-page #left-area,
body.treebanks-page #word-table-panel {
  min-height: var(--tbv-panel-height);
  height: var(--tbv-view-h, var(--tbv-panel-height));
  box-sizing: border-box;
}

/* 🟦 Independent control for the visible zoom area */
body.treebanks-page #zoom-wrap {
  min-height: max(var(--tbv-view-h, var(--tbv-panel-height)), calc(var(--tbv-content-h, 0px) + var(--tbv-tree-extra, 0px)));
  height: max(var(--tbv-view-h, var(--tbv-panel-height)), calc(var(--tbv-content-h, 0px) + var(--tbv-tree-extra, 0px)));
  box-sizing: border-box;
}

.primer-overlay[hidden] {
  display: none !important;
}

.primer-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 5vw, 56px);
}

.primer-overlay__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(2px);
}

.primer-overlay__dialog {
  position: relative;
  max-width: min(1180px, 96vw);
  width: min(1180px, 96vw);
  max-height: 90vh;
  background: #0f172a;
  color: #f8fafc;
  border-radius: 18px;
  box-shadow: 0 24px 56px rgba(15, 23, 42, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.primer-overlay__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(16px, 3vw, 22px) clamp(18px, 3.6vw, 32px);
  background: rgba(15, 23, 42, 0.92);
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.primer-overlay__title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.primer-overlay__header h2 {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  margin: 0;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #f8fafc;
}

.primer-overlay__search {
  flex: 1;
  max-width: 360px;
  position: relative;
}

.primer-overlay__search-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.7);
  color: #f8fafc;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.primer-overlay__search-input:focus {
  outline: none;
  border-color: rgba(59, 130, 246, 0.6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
  background: rgba(15, 23, 42, 0.92);
}

.primer-overlay__close {
  background: transparent;
  border: 2px solid rgba(248, 250, 252, 0.65);
  border-radius: 999px;
  color: inherit;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}

.primer-overlay__close:hover,
.primer-overlay__close:focus-visible {
  outline: none;
  background: #f8fafc;
  color: #0f172a;
  border-color: #0f172a;
}

.primer-overlay__body {
  padding: clamp(16px, 3vw, 28px);
  overflow-y: auto;
}

.primer-overlay__search-results {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(30, 41, 59, 0.55);
}

.primer-overlay__search-results[hidden] {
  display: none;
}

.primer-overlay__search-results .primer-overlay__item {
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.primer-overlay__search-results .primer-overlay__item + .primer-overlay__item {
  margin-top: 10px;
}

.primer-overlay__tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.primer-overlay__tab {
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(30, 41, 59, 0.6);
  color: rgba(226, 232, 240, 0.85);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.primer-overlay__tab.is-active {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.65);
  color: #f8fafc;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.25);
}

.primer-overlay__tab:focus-visible {
  outline: 2px solid rgba(191, 219, 254, 0.8);
  outline-offset: 2px;
}

.primer-overlay__panel[hidden] {
  display: none;
}

.primer-overlay__panel {
  margin-top: 4px;
}

.primer-overlay__intro {
  font-size: 0.9rem;
  margin: 0 0 18px;
  color: rgba(226, 232, 240, 0.85);
}

.primer-overlay__section {
  margin-bottom: 18px;
}

.primer-overlay__section-title {
  margin: 0 0 10px;
  font-size: 1rem;
  color: #ffffff;
  font-weight: 700;
}

.primer-overlay__subsection-title {
  margin: 8px 0 6px;
  font-size: 0.92rem;
  color: #ffffff !important;
  font-weight: 700;
}

.primer-overlay__section-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.primer-overlay__empty {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.08);
  color: #cbd5e1;
  font-size: 0.9rem;
  border: 1px dashed rgba(148, 163, 184, 0.35);
}

.primer-overlay__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 12px;
}

.primer-overlay__item {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  padding: 14px 16px;
  display: grid;
  gap: 4px;
  cursor: pointer;
}

.primer-overlay__item:hover,
.primer-overlay__item:focus {
  border-color: rgba(148, 163, 184, 0.55);
  background: rgba(30, 41, 59, 0.75);
}

.primer-overlay__item:focus {
  outline: 2px solid rgba(191, 219, 254, 0.8);
  outline-offset: 2px;
}

.primer-overlay__code {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(248, 250, 252, 0.92);
}

.primer-overlay__label {
  font-size: 0.88rem;
  color: rgba(226, 232, 240, 0.86);
}

.primer-overlay__category {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(148, 163, 184, 0.9);
}

.primer-overlay__detail {
  font-size: 0.78rem;
  line-height: 1.5;
  color: rgba(203, 213, 225, 0.85);
}

.primer-overlay--apposition .primer-overlay__body {
  padding-bottom: 12px;
}

.primer-overlay__list .apposition-helper {
  grid-column: 1 / -1;
}

.apposition-helper {
  margin-top: 8px;
}

.primer-overlay__item.is-apposition-active {
  border-color: rgba(129, 140, 248, 0.8);
  background: rgba(79, 70, 229, 0.2);
}

.primer-overlay__vce-sections {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.primer-overlay__vce-section {
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 16px;
  padding: 18px;
  background: rgba(15, 23, 42, 0.45);
}

.primer-overlay__vce-heading {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: rgba(226, 232, 240, 0.9);
}

.primer-overlay__vce-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.primer-overlay__vce-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.primer-overlay__vce-tag {
  align-self: flex-start;
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.5);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.95);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.primer-overlay__vce-tag:hover,
.primer-overlay__vce-tag:focus-visible {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.7);
  color: #f8fafc;
}

.primer-overlay__vce-tag:focus-visible {
  outline: 2px solid rgba(191, 219, 254, 0.8);
  outline-offset: 2px;
}

.primer-overlay__vce-detail {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: rgba(203, 213, 225, 0.9);
}

.primer-emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 4px 0;
}

.primer-emoji-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(248, 250, 252, 0.18);
  background: rgba(15, 23, 42, 0.5);
  color: #e2e8f0;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.primer-emoji-card:hover,
.primer-emoji-card:focus-visible {
  border-color: rgba(94, 234, 212, 0.7);
  background: rgba(59, 130, 246, 0.2);
  transform: translateY(-1px);
  outline: none;
}

.primer-emoji-card__icon {
  font-size: 1.4rem;
  line-height: 1;
}

.primer-emoji-card__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.primer-emoji-card__label {
  font-weight: 700;
  font-size: 0.95rem;
  color: #f8fafc;
}

.primer-emoji-card__note {
  font-size: 0.85rem;
  line-height: 1.4;
  color: rgba(226, 232, 240, 0.9);
}

#dictionary-technique-badge,
#frieze-technique-badge {
  display: none !important;
}

.apposition-helper__card {
  background: linear-gradient(135deg, rgba(255, 248, 240, 0.98), rgba(239, 246, 255, 0.98));
  border: 1px solid rgba(99, 102, 241, 0.18);
  border-radius: 20px;
  padding: 24px 26px 22px;
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.12);
  color: #1f2937;
  position: relative;
  overflow: hidden;
}

.apposition-helper__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 700;
  color: #7c3aed;
  background: rgba(124, 58, 237, 0.1);
  padding: 4px 10px;
  border-radius: 999px;
  width: fit-content;
}

.apposition-helper__header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.apposition-helper__title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  color: #1e1b4b;
}

.apposition-helper__subtitle {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
  color: #4338ca;
}

.apposition-helper__section {
  margin-bottom: 20px;
}

.apposition-helper__section--target {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.16);
  padding: 16px 18px;
  border-radius: 16px;
}

.apposition-helper__badge {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #1d4ed8;
}

.apposition-helper__word {
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
}

.apposition-helper__note {
  margin: 0;
  font-size: 0.85rem;
  color: #334155;
}

.apposition-helper__section-title {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #1e293b;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.apposition-helper__options {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding: 2px 0;
}

.apposition-option {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  background: rgba(239, 246, 255, 0.9);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 18px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
  outline: none;
  text-align: left;
  min-width: 120px;
  max-width: 200px;
  box-shadow: 0 4px 12px rgba(14, 116, 144, 0.05);
}

.apposition-option:hover,
.apposition-option:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(59, 130, 246, 0.18);
  border-color: rgba(59, 130, 246, 0.55);
  background: rgba(219, 234, 254, 0.95);
}

.apposition-option.is-selected {
  border-color: rgba(124, 58, 237, 0.85);
  background: rgba(124, 58, 237, 0.12);
  box-shadow: 0 16px 30px rgba(124, 58, 237, 0.2);
}

.apposition-option__latin {
  font-size: 1rem;
  font-weight: 600;
  color: #1e1b4b;
}

.apposition-option__english {
  font-size: 0.85rem;
  color: #334155;
}

.apposition-option__meta {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #0f766e;
}

.apposition-option[data-head-match="true"] .apposition-option__meta {
  color: #2563eb;
}

.apposition-option[data-clause-match="false"] .apposition-option__meta {
  color: #b45309;
}

.apposition-helper__empty {
  margin-top: 6px;
  font-size: 0.9rem;
  color: #475569;
  background: rgba(250, 204, 21, 0.16);
  border: 1px dashed rgba(250, 204, 21, 0.45);
  border-radius: 12px;
  padding: 10px 14px;
}

.apposition-helper__manual {
  display: flex;
  gap: 10px;
  align-items: center;
}

.apposition-helper__input {
  flex: 1 1 auto;
  border: 1px solid rgba(148, 163, 184, 0.6);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.92);
  color: #1f2937;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.apposition-helper__input:focus {
  border-color: rgba(59, 130, 246, 0.75);
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.apposition-helper__apply {
  flex: 0 0 auto;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.apposition-helper__apply:hover,
.apposition-helper__apply:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(124, 58, 237, 0.25);
}

.apposition-helper__hint {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: #475569;
}

.apposition-helper__error {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
  font-weight: 600;
  font-size: 0.9rem;
}

.apposition-helper__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.apposition-helper__secondary,
.apposition-helper__primary {
  border-radius: 999px;
  padding: 11px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.apposition-helper__secondary {
  background: rgba(15, 23, 42, 0.04);
  color: #1f2937;
}

.apposition-helper__secondary:hover,
.apposition-helper__secondary:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.apposition-helper__primary {
  background: linear-gradient(135deg, #ec4899, #6366f1);
  color: #fff;
  box-shadow: 0 18px 38px rgba(99, 102, 241, 0.25);
}

.apposition-helper__primary:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
}

.apposition-helper__primary:not(:disabled):hover,
.apposition-helper__primary:not(:disabled):focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 20px 44px rgba(236, 72, 153, 0.3);
}

.primer-overlay--technique .primer-overlay__body {
  padding-bottom: 12px;
}

.technique-helper__slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.technique-helper__slot {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px dashed rgba(99, 102, 241, 0.35);
  border-radius: 14px;
  padding: 10px 12px;
}

.technique-helper__slot-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1e1b4b;
}

.technique-helper__slot-select {
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.65);
  padding: 8px 10px;
  font-size: 0.92rem;
  color: #0f172a;
  background: #fff;
}

.technique-helper__note-input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  padding: 10px 12px;
  font-size: 0.95rem;
  color: #111827;
  min-height: 68px;
  resize: vertical;
}

.technique-helper__note-input:focus {
  outline: 2px solid rgba(59, 130, 246, 0.35);
  outline-offset: 2px;
  border-color: rgba(59, 130, 246, 0.8);
}

.technique-helper__actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.technique-helper__clear {
  background: rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.45);
}

@media (max-width: 640px) {
  .primer-overlay {
    padding: clamp(12px, 6vw, 24px);
  }

  .primer-overlay__dialog {
    border-radius: 14px;
  }
}



/* 🔹 Adaptive tweaks for taller screens */
@media (min-height: 900px) {
  body.treebanks-page { --tbv-header-gap: clamp(72px, 8vh, 128px); }
}
@media (min-height: 1080px) {
  body.treebanks-page { --tbv-header-gap: clamp(64px, 7vh, 112px); }
}
@media (min-height: 1200px) {
  body.treebanks-page { --tbv-slot-delta: 340px; }
}
@media (min-height: 1440px) {
  body.treebanks-page { --tbv-slot-delta: 380px; }
}
@media (min-height: 1600px) {
  body.treebanks-page { --tbv-slot-delta: 420px; }
}

/* 📐 Fit the tree viewer + word table to the viewport on all screens */
body.treebanks-page {
  --tbv-zoom-extra: 0px;
  --tbv-output-extra: 0px;
  --tbv-left-extra: 0px;
  --tbv-svg-extra: 0px;
  --tbv-table-extra: 0px;
}

body.treebanks-page #workspace {
  min-height: var(--tbv-panel-height);
  height: var(--tbv-panel-height);
}

body.treebanks-page #output,
body.treebanks-page svg.treebank-svg {
  min-height: max(var(--tbv-panel-height), calc(var(--tbv-content-h, 0px) + var(--tbv-tree-extra, 0px)));
  height: max(var(--tbv-panel-height), calc(var(--tbv-content-h, 0px) + var(--tbv-tree-extra, 0px)));
}

body.treebanks-page #zoom-wrap {
  min-height: max(var(--tbv-panel-height), calc(var(--tbv-content-h, 0px) + var(--tbv-tree-extra, 0px)));
  height: max(var(--tbv-panel-height), calc(var(--tbv-content-h, 0px) + var(--tbv-tree-extra, 0px)));
  overflow: auto;
}

body.treebanks-page svg.treebank-svg {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  pointer-events: none;
  overflow: visible;
  background-color: transparent;
  border: none;
}

body.treebanks-page #word-table-panel {
  overflow: visible;
}

body.treebanks-page #word-table-panel .panel-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
  padding-bottom: 0; /* remove bottom strip of empty space */
}
.tree-english-strip__gap {
  flex: 0 0 12px;
  min-width: 12px;
  height: 20px;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: transparent;
  border: 1px dashed transparent;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    transform 200ms ease;
  pointer-events: none;
}

body.edit-mode .tree-english-strip__gap,
.english-viewer.is-open .tree-english-strip__gap {
  pointer-events: auto;
}

.tree-english-strip__gap::after {
  content: '';
  width: 8px;
  height: 2px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
}

.tree-english-strip__gap--drop {
  border-color: rgba(37, 99, 235, 0.45);
  background: rgba(59, 130, 246, 0.2);
  transform: scale(1.22);
}

.tree-english-strip__item--drop {
  border-color: rgba(37, 99, 235, 0.95) !important;
  box-shadow:
    0 0 0 4px rgba(59, 130, 246, 0.24),
    0 18px 34px rgba(15, 23, 42, 0.28);
  transform: translateY(-4px) scale(1.015);
}

.tree-english-strip__item--shift-prev {
  transform: translateX(-12px) scale(0.98);
}

.tree-english-strip__item--shift-next {
  transform: translateX(12px) scale(0.98);
}

.tree-english-strip__item--drop-before::before,
.tree-english-strip__item--drop-after::after {
  display: none;
}

.tree-english-strip__text {
  font-size: 1.04rem;
  font-weight: 600;
  letter-spacing: 0.004em;
}

.tree-english-strip__item--appear {
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition: transform 180ms ease, opacity 180ms ease;
}
.english-header-container {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

.english-header-container .text-box {
  width: 100%;
  padding-right: 120px;
}

.english-header-actions {
  position: absolute;
  top: 8px;
  right: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.english-action-btn,
.clause-toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #0f172a;
  background: #ffffff;
  color: #0f172a;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, color 0.18s ease, opacity 0.18s ease;
  opacity: 0;
  pointer-events: none;
}

.english-header-container:hover .english-action-btn,
.english-header-container:hover .clause-toggle-btn,
.english-header-container:focus-within .english-action-btn,
.english-header-container:focus-within .clause-toggle-btn,
.english-action-btn:focus-visible,
.clause-toggle-btn:focus-visible {
  opacity: 1;
  pointer-events: auto;
}

.english-action-btn:hover,
.english-action-btn:focus-visible,
.clause-toggle-btn:hover,
.clause-toggle-btn:focus-visible {
  background: #0f172a;
  color: #f8fafc;
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.28);
  outline: none;
}

.english-action-btn.is-active,
.clause-toggle-btn.is-active {
  background: #2563eb;
  color: #ffffff;
  border-color: #1d4ed8;
}

.english-action-btn[disabled],
.english-action-btn.is-disabled,
.clause-toggle-btn[disabled],
.clause-toggle-btn.is-disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
  box-shadow: none;
  background: #e2e8f0;
  color: #64748b;
  border-color: #cbd5f5;
}

.english-action-btn[disabled]:hover,
.english-action-btn[disabled]:focus-visible,
.clause-toggle-btn[disabled]:hover,
.clause-toggle-btn[disabled]:focus-visible {
  transform: none;
  box-shadow: none;
  background: #e2e8f0;
  color: #64748b;
  outline: none;
}



.staging-panel__title {
  margin: 0;
  font-family: "DINNextRounded", "DM Sans", sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
  color: #ffffff;
  font-weight: 800;
}

body.tree-view-active #treebank-card-browser {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.treebank-card-browser {
  margin: 32px 0 48px;
  max-width: none;
  width: 100%;
  padding: 0;
}

.treebank-card-browser__panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.treebank-card-browser__panel.home-recommendations--single {
  max-width: none;
  margin: 0;
  width: 100%;
}

.treebank-card-browser__header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px;
}

.treebank-card-browser__header h2 {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: 'NeonMedium', 'DM Sans', sans-serif;
  color: #111111;
}

.treebank-nav-search {
  display: block;
  width: 100%;
  margin-left: 0;
}

.treebank-nav-search input[type="search"] {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid rgba(17, 17, 17, 0.18);
  border-radius: 999px;
  font-size: 0.9rem;
  font-family: 'DM Sans', sans-serif;
}

.treebank-nav-search input[type="search"]:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.22);
}


.treebank-card-browser__layout {
  display: flex;
  flex-wrap: nowrap;
  gap: 24px;
  width: 100%;
  align-items: stretch;
}

.treebank-nav-info {
  flex: 0 0 280px;
  max-width: 320px;
  background: #ffffff;
  border: 2px solid #111111;
  border-radius: 24px;
  box-shadow: 0 18px 36px rgba(17, 17, 17, 0.15);
  padding: 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.treebank-nav-info__title {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-family: 'NeonMedium', 'DM Sans', sans-serif;
  color: #111111;
}

.treebank-nav-info__trail {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.treebank-nav-info__crumb {
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(17, 17, 17, 0.08);
  color: #111111;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.18s ease, transform 0.18s ease;
}

.treebank-nav-info__crumb:hover,
.treebank-nav-info__crumb:focus-visible {
  background: rgba(17, 17, 17, 0.2);
  transform: translateY(-1px);
  outline: none;
}

.treebank-nav-info__crumb[disabled],
.treebank-nav-info__crumb[aria-current="true"] {
  cursor: default;
  transform: none;
  background: #111111;
  color: #ffffff;
  opacity: 1;
}

.treebank-nav-info__meta {
  margin: 0;
  font-size: 0.92rem;
  color: #4b5563;
  font-family: 'DM Sans', sans-serif;
  line-height: 1.45;
}

.treebank-nav-info__hint {
  margin: 0;
  font-size: 0.82rem;
  color: #6b7280;
  font-family: 'DM Sans', sans-serif;
}

.treebank-pane-stack {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.treebank-pane__track {
  display: flex;
  flex-wrap: nowrap;
  gap: 20px;
  overflow-x: auto;
  padding: 8px 4px 12px;
  scroll-snap-type: x proximity;
  width: 100%;
}

.treebank-pane__track::-webkit-scrollbar {
  height: 8px;
}

.treebank-pane__track::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.06);
  border-radius: 999px;
}

.treebank-pane__track::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.28);
  border-radius: 999px;
}

.treebank-pane__track .alpha-card {
  flex: 0 0 auto;
  min-width: 240px;
  max-width: 320px;
  scroll-snap-align: start;
}

@media (max-width: 900px) {
  .treebank-card-browser__layout {
    flex-direction: column;
  }

  .treebank-nav-info {
    flex: 0 0 auto;
    max-width: none;
  }

  .treebank-nav-search {
    width: 100%;
    margin-left: 0;
  }

  .treebank-nav-search input[type="search"] {
    width: 100%;
  }
}

.treebank-pane__empty {
  padding: 32px;
  text-align: center;
  border: 2px dashed rgba(148, 163, 184, 0.45);
  border-radius: 20px;
  font-size: 0.95rem;
  color: #6b7280;
  font-family: 'DM Sans', sans-serif;
  flex: 0 0 auto;
  min-width: 260px;
}

.treebank-card-browser .alpha-card__copy {
  color: #374151;
}

.treebank-card-browser .alpha-card__meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #6b7280;
  font-family: 'DM Sans', sans-serif;
}

.treebank-card-browser .alpha-card__status {
  color: #4b5563;
}

.treebank-card-browser .alpha-card__cta {
  justify-content: center;
}

.treebank-card-browser .alpha-card.is-active {
  background: #111111;
  color: #ffffff;
  border-color: #111111;
  box-shadow: 0 24px 48px rgba(17, 17, 17, 0.28);
}

.treebank-card-browser .alpha-card.is-active .alpha-card__copy,
.treebank-card-browser .alpha-card.is-active .alpha-card__status,
.treebank-card-browser .alpha-card.is-active .alpha-card__cta,
.treebank-card-browser .alpha-card.is-active .alpha-card__meta {
  color: rgba(255, 255, 255, 0.92);
}

@media (max-width: 640px) {
  .treebank-pane__track .alpha-card {
    min-width: 220px;
  }
}
.tbv-inline-english-editor {
  position: fixed;
  z-index: 10030;
  padding: 6px 10px;
  border: 1px solid rgba(15, 23, 42, 0.35);
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.25);
  color: #0f172a;
  box-sizing: border-box;
  font: inherit;
}

.clause-reorder-item__english-input {
  width: 100%;
  margin: 4px 0 6px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(15, 23, 42, 0.25);
  background: #ffffff;
  color: inherit;
  font: inherit;
  box-sizing: border-box;
  outline: none;
}

.clause-reorder-item__english-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18);
}
.word-summary-table td.dictionary-cell--frieze,
.word-summary-table td.dictionary-cell--whitaker,
.word-summary-table td.dictionary-cell--lewis,
.word-summary-table td.dictionary-cell--parsing,
.word-summary-table td.dictionary-cell--notes {
  vertical-align: top;
}

.word-summary-table td.dictionary-cell--frieze {
  width: var(--frieze-col-width, 1400px);
}

.word-summary-table td.dictionary-cell--whitaker {
  width: var(--dictionary-col-width, 520px);
  min-width: var(--dictionary-col-width, 520px);
  max-width: var(--dictionary-col-width, 520px);
}

.word-summary-table td.dictionary-cell--lewis {
  width: var(--lewis-col-width, 320px);
}

.word-summary-table td.dictionary-cell--parsing {
  width: var(--parsing-col-width, 260px);
  min-width: var(--parsing-col-width, 260px);
  max-width: none;
}

.word-summary-table td.dictionary-cell--notes {
  width: var(--notes-col-width, 220px);
}
