/* ===================================================================
   Vocabulary panel (right column, floating window)
=================================================================== */
#vocab-panel {
  grid-column: 3;
  grid-row: 1;
  background: var(--glass-bg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid var(--glass-border);
  border-radius: var(--win-radius);
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 52px 8px 52px 8px;
  align-self: start;
  max-height: calc(100vh - 104px);
  height: calc(100vh - 104px);
  box-sizing: border-box;
  position: relative;
}
#vocab-panel::after {
  content: none;
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(255,255,255,0.07);
  box-shadow: inset -8px -6px 0 -9px rgba(255,255,255,0.9),
              inset 0 -7px 0 -6px rgba(255,255,255,0.6);
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}
#vocab-panel.open {
  align-self: stretch;
}
#vocab-panel .lcw-body {
  flex: 1;
  overflow-y: auto;
  max-height: 0;
  transition: max-height 0.28s ease, padding 0.28s ease;
}
#vocab-panel.open .lcw-body {
  max-height: calc(100vh - 118px);
  padding: 0;
}

.panel-title {
  padding: 7px 12px;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Search row */
.search-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px 12px 8px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.search-row-bottom {
  display: flex;
  gap: 5px;
}
.search-row input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.6);
  border: 1px solid rgba(180,175,168,0.5);
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--txt);
  outline: none;
  transition: border-color 0.15s;
}
.search-row input:focus {
  border-color: hsl(215,45%,65%);
  background: rgba(255,255,255,0.85);
}
.search-row-bottom input {
  flex: 1;
}
.search-row-bottom input:first-child:focus {
  border-color: hsl(215,55%,60%);
}
.search-row-bottom input:last-child:focus {
  border-color: hsl(28,55%,55%);
}

.search-row input, .search-row select {
  background: rgba(255,255,255,0.65);
  border: 1px solid rgba(175,170,163,0.50);
  color: var(--txt);
  padding: 5px 9px;
  border-radius: 5px;
  font: 12px/1 var(--mono);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

.search-row input { flex: 1; }
.search-row select { flex: 0 0 auto; color: var(--dim); }


/* ── Search-field category combo ────────────────────────────────── */
.search-combo {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.search-combo input { width: 100%; box-sizing: border-box; text-align: center; }
.search-combo input::placeholder { text-align: center; }
.search-combo-full { width: 100%; }

.scc-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 2px); left: 0;
  width: max(100%, 220px);
  max-height: 280px; overflow-y: auto;
  /* SOLID, not nearly-solid (owner 2026-08-05: "the various tooltip menus or search category list
     should not be transparent"). It was rgba(...,0.98), and 2% is enough to show through because
     this list sits on top of the vocab panel, whose own background is --glass-bg at 62% -- so the
     panel's content AND whatever is behind the panel both bleed into the category names. Same
     complaint, and the same fix, as the wordbank note tooltip got on 2026-07-13. */
  background: #faf8f4;
  border: 1px solid rgba(175,170,163,0.45);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.14);
  z-index: 500;
  padding: 4px 0;
  scrollbar-width: thin;
}
.scc-dropdown.open { display: block; }
.scc-item {
  padding: 5px 12px;
  font-size: 11px; color: var(--dim);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s;
}
.scc-item:hover { background: rgba(53,116,196,0.08); color: var(--txt); }
.scc-item-parent { font-weight: 600; font-size: 11px; }
.scc-item-child  { padding-left: 24px; font-size: 10px; }
.scc-item.scc-focused { background: rgba(53,116,196,0.10); color: var(--txt); }
/* Tri-state: applied (left-click) = green accent. Excluded (right-click) = red accent. */
.scc-item.is-include {
  background: rgba(58,122,74,0.10);
  color: rgb(45,95,58);
  box-shadow: inset 2px 0 0 0 rgba(58,122,74,0.6);
}
.scc-item.is-include:hover { background: rgba(58,122,74,0.16); color: rgb(35,80,48); }
.scc-item.is-exclude {
  background: rgba(180,60,60,0.09);
  color: rgb(150,40,40);
  box-shadow: inset 2px 0 0 0 rgba(180,60,60,0.6);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(180,60,60,0.4);
}
.scc-item.is-favor { color: #5ba3ff; }
.scc-item.is-favor .scc-state-mark { color: #5ba3ff; }
.scc-item.is-disfavor { color: #e8a040; }
.scc-item.is-disfavor .scc-state-mark { color: #e8a040; }
.cat-filter-chip-fav { background: rgba(91,163,255,0.15); border-color: #5ba3ff; }
.cat-filter-chip-dis { background: rgba(232,160,64,0.15); border-color: #e8a040; }
.scc-item.is-exclude:hover { background: rgba(180,60,60,0.16); color: rgb(130,30,30); }
.scc-item .scc-state-mark {
  float: right;
  font-size: 10px;
  font-weight: 700;
  margin-left: 8px;
  opacity: 0.85;
}
.scc-divider { height: 1px; background: var(--line); margin: 3px 0; }
.scc-section-head {
  padding: 5px 12px 2px;
  font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--faint); font-weight: 600; pointer-events: none;
}
.scc-section-head.is-applied  { color: rgb(55,105,70); }
.scc-section-head.is-excluded { color: rgb(150,50,50); }

/* Per-field count badge inside input (B). Shows +N / -M when this field's
   dropdown has applied/excluded cats. Clicking reopens the dropdown. */
.search-combo { position: relative; }
.scc-count-badge {
  position: absolute;
  top: 50%; right: 6px; transform: translateY(-50%);
  font-size: 9px; font-weight: 700; line-height: 1;
  padding: 2px 5px; border-radius: 8px;
  background: rgba(58,122,74,0.15); color: rgb(45,95,58);
  user-select: none; cursor: pointer;
  display: none;
  pointer-events: auto;
  z-index: 10;
}
.lr-swap-btn {
  background: none; border: 1px solid var(--border, #444); border-radius: 4px;
  color: var(--text-dim, #888); font-size: 12px; padding: 1px 4px; cursor: pointer;
  line-height: 1; margin: 0 2px; min-width: 20px; flex-shrink: 0;
}
.lr-swap-btn:hover { color: var(--text, #ccc); border-color: var(--text-dim, #888); }
.scc-count-badge.has-count { display: inline-block; }
.scc-count-badge.has-exclude:not(.has-include) {
  background: rgba(180,60,60,0.15); color: rgb(150,40,40);
}
.scc-count-badge.has-include.has-exclude {
  background: rgba(95,90,85,0.18); color: var(--dim);
}
.scc-count-badge:hover { filter: brightness(0.96); }

/* ── Category filter chips ───────────────────────────────────── */
#cat-filter-row {
  display: none; /* shown when there are chips or dropdown is open */
  align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 3px 2px 1px;
}
#cat-filter-row.has-chips,
#cat-filter-row.open { display: flex; }
#cat-filter-chips { display: flex; flex-wrap: wrap; gap: 3px; flex: 1; }
.cat-filter-chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px 2px 8px; border-radius: 10px; font-size: 10px;
  background: rgba(42,90,165,0.12); border: 1px solid rgba(42,90,165,0.22);
  color: #2a5aa5; cursor: default; user-select: none;
}
.cat-filter-chip .chip-x {
  font-size: 9px; cursor: pointer; opacity: 0.6; margin-left: 1px;
  border-radius: 50%; padding: 0 2px;
}
.cat-filter-chip .chip-x:hover { opacity: 1; background: rgba(42,90,165,0.18); }
#cat-filter-btn {
  font-size: 10px; padding: 2px 7px; border-radius: 8px;
  border: 1px solid rgba(180,170,155,0.35);
  background: rgba(255,255,255,0.6); color: var(--dim);
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
}
#cat-filter-btn:hover { background: rgba(255,255,255,0.9); }
#cat-filter-btn.active { background: rgba(42,90,165,0.1); border-color: rgba(42,90,165,0.3); color: #2a5aa5; }
#cat-filter-dropdown-wrap { position: relative; }
#cat-filter-dropdown {
  display: none; position: absolute; top: calc(100% + 4px); right: 0; z-index: 200;
  width: 200px; max-height: 260px; overflow-y: auto;
  background: var(--bg); border: 1px solid rgba(180,170,155,0.35);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  padding: 4px 0;
}
#cat-filter-dropdown.open { display: block; }
.cfd-section-head {
  padding: 4px 12px 2px; font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--faint); font-weight: 600;
}
.cfd-sep { border-top: 1px solid rgba(180,170,155,0.2); margin: 3px 0; }
.cfd-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 3px 8px 3px 12px; gap: 4px;
}
.cfd-row:hover { background: rgba(255,255,255,0.6); }
.cfd-row-child { padding-left: 22px; }
.cfd-parent-label { font-size: 11px; font-weight: 600; color: var(--dim); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cfd-child-label  { font-size: 10px; color: var(--dim); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cfd-actions { display: flex; gap: 2px; flex-shrink: 0; }
.cfd-btn {
  font-size: 11px; font-weight: 700; line-height: 1;
  width: 18px; height: 18px; border-radius: 4px;
  border: 1px solid rgba(53,116,196,0.3); background: transparent; color: rgba(53,116,196,0.7);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.1s, color 0.1s;
}
.cfd-btn:hover { background: rgba(53,116,196,0.12); color: #2a5aa5; }
.cfd-btn-on { background: rgba(53,116,196,0.2) !important; color: #2a5aa5 !important; border-color: rgba(53,116,196,0.5) !important; }
.cfd-btn-excl { border-color: rgba(180,60,60,0.3); color: rgba(180,60,60,0.7); }
.cfd-btn-excl:hover { background: rgba(180,60,60,0.1); color: rgb(160,40,40); }
.cfd-btn-excl-on { background: rgba(180,60,60,0.18) !important; color: rgb(150,35,35) !important; border-color: rgba(180,60,60,0.5) !important; }
/* Exclude chip variant */
.cat-filter-chip.cat-filter-chip-excl {
  background: rgba(180,60,60,0.09); border-color: rgba(180,60,60,0.25); color: rgb(150,40,40);
}
.cat-filter-chip.cat-filter-chip-excl .chip-x:hover { background: rgba(180,60,60,0.18); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
}

/* Depth selector (1-deep/2-deep/3-deep), owner fix (2026-08-07): was rendered `position:sticky`
   INSIDE #entry-list's own scrolling innerHTML, so it visually rode on top of the scrolling
   suggestion rows as a floating overlay instead of sitting in the page's normal flex-column flow.
   Now a real, permanent sibling row between the search/category controls and #entry-list -- never
   part of the scrolling content, so it can never overlap it. Hidden by default (only suggest mode
   populates and shows it); js/02d-suggest-runner.js toggles display and writes the button markup.
   flex:1 on each button mirrors .search-row-bottom's own even L/R split immediately above it. */
#wb-depth-bar {
  display: flex;
  gap: 5px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
#wb-depth-bar button { flex: 1; }

/* Entry list */
#entry-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

/* Owner order 2026-09-20: Verb ban Abbrev. | Warp Raw | Mess 'em on ONE line. The pills were
   tightened (padding 8px, white-space:nowrap) and the ↺ reset absolutely positioned at the right
   edge (css/13-ctx-gami.css), so the row fits without wrapping. Earlier (2026-08-07) this wrapped to
   a second line to avoid clipping; that is no longer needed. */
/* Owner 2026-10-04: Warp raw | Mess 'em on one line, "Verb ban Abbrev." on the line beneath (index.html). */
#wordbank-footer { flex-direction: column; flex-wrap: nowrap; gap: 6px; }
#wordbank-footer .wb-footer-row { display: flex; gap: 6px; justify-content: center; }

/* [#5 2026-06-18] Re-search dim. After a seam edit the wordbank is refreshing, but the list stays
   visible and clickable -- the apply-time backstop re-validates every click, so a stale one is
   refused (not garbage) and a still-valid one still applies. Dimming just signals the refresh so a
   click during it is never silently lost. runSuggest removes the class when fresh results render. */
#entry-list.wb-restale { opacity: 0.45; transition: opacity 0.12s ease; }

.empty-msg {
  color: var(--faint);
  font-size: 12px;
  text-align: center;
  padding: 24px 16px;
  line-height: 1.8;
}

/* Pinned section divider */
.section-divider {
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 6px 4px 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(180,175,168,0.40);
}

.section-divider.pinned-section {
  color: var(--pin);
  opacity: 0.7;
}

.entry-card {
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(185, 180, 173, 0.42);
  border-radius: 6px;
  padding: 9px 11px;
  margin-bottom: 5px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
  position: relative;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.entry-card:hover { border-color: rgba(120,145,195,0.65); background: rgba(255,255,255,0.75); }
.entry-card.selected { border-color: var(--blue); background: rgba(53,116,196,0.10); }
.entry-card.pinned {
  border-color: rgba(154,110,24,0.40);
  background: rgba(255,248,235,0.55);
}
.entry-card.pinned:hover { border-color: rgba(154,110,24,0.65); }
.entry-card.pinned.selected { border-color: var(--pin); background: rgba(255,248,220,0.72); }

/* Category favor match (owner Wordbank-unify ruling, 2026-07-25): a chosen (include/favor)
   category NEVER excludes an entry -- matching entries are re-sorted to the top and get this
   subtle pink highlight instead, in BOTH the suggestion-results list (.suggest-item, see
   css/06-merge-insert.css companion rule) and the DB-browse list (.entry-card, here). Applies
   after .pinned/.selected so a pinned+favored or selected+favored card still reads clearly;
   the pink is a left-border + faint wash, never a solid fill, so it layers without fighting
   those other states. */
.entry-card.entry-cat-match {
  background: rgba(214, 51, 132, 0.07);
}
.entry-card.entry-cat-match:hover { background: rgba(214, 51, 132, 0.13); }
body.dark-mode .entry-card.entry-cat-match {
  background: rgba(235, 110, 175, 0.10);
}
body.dark-mode .entry-card.entry-cat-match:hover { background: rgba(235, 110, 175, 0.17); }

/* Pin indicator badge */
.pin-badge {
  position: absolute;
  top: 7px;
  right: 9px;
  font-size: 11px;
  color: var(--pin);
  opacity: 0.8;
  line-height: 1;
}

/* Wordbank entry text layout  -  measurement-driven, no hover dependency.
   Rule (set by _layoutTextItems after render, js/02e-suggest-render.js): two modes, picked at
   render time based on actual content size.
   - layout-single: entry fits on one line. Default flex-row, center dot.
   - layout-flow  : it doesn't. One continuous full-width text flow (owner ruling 2026-08-12);
                    see .entry-pair.layout-flow below and its .suggest-item twin in
                    css/06-merge-insert.css, which carries the full reasoning.
   Hover no longer changes layout  -  full text is always visible at rest.

   DEAD PATH, kept deliberately (2026-08-12): nothing emits .entry-pair markup any more. Both WB2
   branches moved onto _renderSuggestProgressive's .suggest-item rows in the 2026-08-12 display
   unification, and _layoutEntryCards has no caller left. These rules stay as the .entry-card
   template's definition rather than being deleted with it, since js/01c-undo-merge.js and
   js/03e-vocab-crud.js still carry defensive .entry-card selectors.
   TRAP IF IT EVER COMES BACK: css/13-ctx-gami.css's `.entry-card .entry-pair { display: grid }` has
   equal specificity to `.entry-pair.layout-flow { display: block }` below and loads later, so it
   would WIN and silently disable the flow tier while the children still went inline. Scope the
   layout-flow rule to .entry-card, or move the geometry out of the reskin file, before relying on
   it again. */
.entry-pair {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.entry-left  {
  color: hsl(215,55%,40%);
  flex: 0 1 auto;
  text-align: right;
  padding-right: 5px;
  white-space: normal;
  overflow-wrap: break-word;
  min-width: 0;
}
.entry-right {
  color: hsl(28,65%,38%);
  flex: 0 1 auto;
  text-align: left;
  padding-left: 5px;
  white-space: normal;
  overflow-wrap: break-word;
  min-width: 0;
}
.entry-arrow {
  flex: 0 0 auto;
  color: rgba(120,114,108,0.45);
  font-size: 15px;
  line-height: 1;
  user-select: none;
}

/* Mode A: single line (default). */
.entry-pair.layout-single {
  flex-direction: row;
}

/* Mode B: one continuous full-width text flow, mirroring .suggest-item.layout-flow in
   css/06-merge-insert.css (owner ruling 2026-08-12) -- see that rule for the full reasoning.
   Retires layout-two-line (each half confined to a third of the width, the rest dead space) and
   layout-wrap (full width, but the two halves could never share a line). */
.entry-pair.layout-flow {
  display: block;
  text-align: left;
}
.entry-pair.layout-flow .entry-left,
.entry-pair.layout-flow .entry-arrow,
.entry-pair.layout-flow .entry-right {
  display: inline;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: break-word;
  hyphens: none;
}
.entry-pair.layout-flow .entry-arrow {
  padding: 0 3px;
  opacity: 0.75;
}

.entry-note {
  font-size: 11px;
  color: var(--dim);
  margin-top: 3px;
  font-style: italic;
}

/* Dark theme for the category dropdown. It had no dark rule at all, so in dark mode the list
   rendered in the light near-white -- a second way for it to look wrong, on top of the transparency.
   (owner 2026-08-05) */
/* Type-ahead narrowing (owner 2026-08-05). Rows that do not match what you have typed are hidden
   rather than removed, so every click handler, data attribute and badge count keeps working on the
   same nodes. */
.scc-dropdown .scc-hidden { display: none !important; }

body.dark-mode .scc-dropdown {
  background: #1e1c1a;
  border-color: rgba(255,255,255,0.18);
  box-shadow: 0 8px 24px rgba(0,0,0,0.55);
}

#card-note-tooltip {
  position: fixed;
  z-index: 9999;
  max-width: 240px;
  /* Fully opaque (Hadrian 2026-07-13: wordbank tips should not sit in a transparent div). */
  background: #181c26;
  color: #d8dce8;
  font-size: 12px;
  font-style: italic;
  line-height: 1.45;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid rgba(120,145,195,0.35);
  box-shadow: 0 4px 16px rgba(0,0,0,0.45);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s;
  white-space: pre-wrap;
  word-break: break-word;
}
#card-note-tooltip.visible { opacity: 1; }

.entry-source {
  font-size: 10px;
  color: #556;
  margin-top: 2px;
}

.entry-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 5px;
}

.tag {
  background: rgba(88,72,160,0.10);
  color: var(--purple);
  border: 1px solid rgba(88,72,160,0.25);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 9px;
  letter-spacing: 0.05em;
}

.entry-btns {
  display: flex;
  gap: 5px;
  margin-top: 7px;
}

/* Add form */
#add-form {
  flex-shrink: 0;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: rgba(215, 211, 205, 0.48);
}

#add-form .panel-title {
  padding: 0 0 8px 0;
  border-bottom: none;
}

.field { margin-bottom: 7px; }
.field label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--faint);
  margin-bottom: 3px;
  text-transform: uppercase;
}

.field input, .field textarea {
  width: 100%;
  background: rgba(255,255,255,0.65);
  border: 1px solid rgba(175,170,163,0.50);
  color: var(--txt);
  padding: 5px 9px;
  border-radius: 5px;
  font: 12px/1.3 var(--mono);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

.field textarea { resize: none; height: 40px; line-height: 1.4; }

.pair-fields { display: flex; gap: 6px; }
.pair-fields .field { flex: 1; }

.form-error {
  color: var(--red);
  font-size: 11px;
  margin-top: 5px;
  min-height: 16px;
}

