/* === Fonts === */

@font-face {
  font-family: 'Bernie Sans Beta';
  src: url('fonts/BernieSansBetaVF.ttf') format('truetype');
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: 'InterAlia';
  src: url('fonts/InterAlia-VF.otf') format('opentype');
  font-weight: 100 900;
  font-display: swap;
}

/* === Reset & Base === */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #fafafa;
  --bg-pane: #ffffff;
  --bg-toolbar: #1a1a2e;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --text-toolbar: #e8e8f0;
  --border: #e2e4e8;
  --accent: #4f46e5;
  --radius-sm: 4px;
}

html, body {
  height: 100%;
  font-family: 'Bernie Sans Beta', 'InterAlia', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
}

/* === Toolbar === */

.toolbar {
  display: flex;
  align-items: center;
  padding: 0 20px;
  height: 48px;
  gap: 16px;
  background: var(--bg-toolbar);
  color: var(--text-toolbar);
  flex-shrink: 0;
}

/* Middle group: by default `display: contents` so children act as
   direct flex children of `.toolbar` and the layout is unchanged.
   Narrow-screen rules below break it out as its own row. */
.toolbar-middle {
  display: contents;
}

@media (max-width: 768px) {
  .toolbar {
    flex-wrap: wrap;
    height: auto;
    min-height: 48px;
    padding-top: 6px;
    padding-bottom: 6px;
    row-gap: 6px;
  }
  .toolbar-middle {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-basis: 100%;
    /* `order: 99` pushes the middle group below all primary-row
       siblings (which keep the default order of 0). */
    order: 99;
    flex-wrap: wrap;
  }
}

.logo {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Wordmark on the left of the toolbar — Shavian "𐑖𐑱𐑝", styled to
   match the favicon: red glyph, bold (700), wide (font-stretch 150%),
   italic, on a snug white rounded pill. */
.toolbar-logo {
  font-family: 'Bernie Sans Beta', 'InterAlia', system-ui, sans-serif;
  font-size: 18px;
  font-weight: 700;
  font-style: italic;
  font-stretch: 150%;
  color: #b81d22;
  background: #fff;
  padding: 0 6px;
  margin-right: 4px;
  border-radius: 999px;
  line-height: 1;
  user-select: none;
}

.toolbar-nav {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-toolbar);
  text-decoration: none;
  opacity: 0.6;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: opacity 0.15s, background 0.15s;
}

.toolbar-nav:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
}

.toolbar-nav.active {
  opacity: 1;
}

.select-dialect {
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-toolbar);
  font-size: 13px;
  cursor: pointer;
  outline: none;
}

.select-dialect option {
  background: var(--bg-toolbar);
  color: var(--text-toolbar);
}

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

.toolbar-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-toolbar);
  font-size: 0.85em;
  cursor: pointer;
  opacity: 0.8;
  user-select: none;
}

.toolbar-toggle:hover {
  opacity: 1;
}

.toolbar-toggle input[type="radio"] {
  accent-color: var(--accent);
}

.toolbar-slider {
  gap: 6px;
}

.toolbar-slider input[type="range"] {
  width: 80px;
  accent-color: var(--accent);
}

.toolbar-spacer {
  flex: 1;
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  height: 24px;
  flex-shrink: 0;
  background: #ffffff;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}
.app-footer a,
.app-footer a:link,
.app-footer a:visited,
.app-footer a:hover,
.app-footer a:active {
  color: inherit;
  text-decoration: none;
}
.app-footer a:hover { text-decoration: underline; }

.toolbar-btn {
  padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-toolbar);
  font-size: 13px;
  cursor: pointer;
  outline: none;
  font-family: inherit;
  line-height: 1.4;
}

.toolbar-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
}
.toolbar-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.toolbar-btn-icon {
  font-size: 16px;
  padding: 3px 10px;
  line-height: 1;
}

/* === Burger menu + modals === */

.toolbar-burger-wrap {
  position: relative;
}

.burger-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-toolbar);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  min-width: 160px;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  padding: 4px;
}

.burger-menu-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: 0;
  color: var(--text-toolbar);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.burger-menu-item:hover {
  background: rgba(255,255,255,0.08);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--bg, #fff);
  color: var(--text, #111);
  border-radius: var(--radius-md, 8px);
  min-width: 360px;
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.35);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border, #e5e5e5);
}
.modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}
.modal-close {
  background: transparent;
  border: 0;
  font-size: 22px;
  line-height: 1;
  color: var(--text-muted, #777);
  cursor: pointer;
  padding: 4px 8px;
}
.modal-close:hover { color: var(--text, #111); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border, #e5e5e5);
  background: var(--bg-pane, #fafafa);
}

/* Settings inside the modal use a lighter colour scheme than the
   original toolbar-dropdown incarnation. Override the dark-on-dark
   bits of .settings-label / .settings-radio-group. */
.modal-body .settings-label {
  color: var(--text-muted, #555);
  opacity: 1;
}
.modal-body .settings-radio-group label {
  color: var(--text, #111);
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.5;
  color: var(--text-toolbar);
}

/* Override .select-dialect's dark-toolbar palette for the light modal. */
.settings-select {
  width: 100%;
  background: var(--bg-pane);
  color: var(--text);
  border: 1px solid var(--border);
}
.settings-select option {
  background: var(--bg-pane);
  color: var(--text);
}

.settings-radio-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-radio-group label {
  font-size: 13px;
  color: var(--text-toolbar);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.settings-radio-group input[type="radio"] {
  accent-color: var(--accent);
}

.settings-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}
.settings-checkbox input[type="checkbox"] {
  accent-color: var(--accent);
}

/* Custom dictionary modal */
.dict-modal { min-width: 480px; max-width: 640px; }
.dict-hint {
  font-size: 13px;
  color: var(--text-muted, #6b7280);
  margin: 0;
}
.dict-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 4px 0;
}
.dict-row {
  display: grid;
  grid-template-columns: 1fr 1fr 140px auto;
  gap: 8px;
  align-items: center;
}
.dict-row input,
.dict-row select {
  padding: 6px 10px;
  border: 1px solid var(--border, #d1d5db);
  border-radius: var(--radius-sm, 4px);
  background: var(--bg, #fff);
  color: var(--text, #111);
  font-size: 14px;
  font-family: inherit;
}
.dict-row input.dict-shavian {
  font-family: 'Bernie Sans Beta', 'InterAlia', system-ui, sans-serif;
  font-size: 16px;
}
.dict-row select.dict-pos {
  padding-right: 4px;
}
.dict-row-delete {
  background: transparent;
  border: 0;
  color: var(--text-muted, #9ca3af);
  font-size: 18px;
  cursor: pointer;
  padding: 2px 8px;
  line-height: 1;
}
.dict-row-delete:hover { color: #dc2626; }
.dict-add-row {
  align-self: flex-start;
}
.dict-empty {
  font-size: 13px;
  color: var(--text-muted, #6b7280);
  font-style: italic;
  padding: 12px 0;
}

/* === URL bar === */

.url-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 20px;
  background: var(--bg-pane);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.url-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.url-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
}

.btn-fetch {
  padding: 6px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.btn-fetch:hover {
  background: #4338ca;
}

.btn-fetch:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-url-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.btn-url-close:hover {
  color: var(--text);
}

/* === Drop overlay === */

.drop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(79, 70, 229, 0.08);
  border: 2px dashed var(--accent);
  border-radius: 4px;
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  pointer-events: none;
}

.drop-overlay.active {
  display: flex;
}

/* === Editor Panes === */

.editor {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

@media (max-width: 768px) {
  /* Stack panes vertically on narrow screens; the splitter between them
     is interpreted by JS as a y-axis drag (see splitter.js currentAxis). */
  .editor { flex-direction: column; }
  .editor > .splitter-h {
    width: auto;
    height: 1px;
    cursor: ns-resize;
  }
  .editor > .splitter-h .splitter-handle {
    /* Horizontal divider on mobile: handle on the left so it stays
       clear of the Clear/Copy pane-header buttons on the right. */
    left: 18px;
    right: auto;
    top: -11px;
    bottom: auto;
    cursor: ns-resize;
  }
  .editor > .splitter-h .splitter-handle::before { content: '↕'; }
}

.pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  container-type: inline-size;
}

.pane-divider {
  width: 1px;
  background: var(--border);
  flex-shrink: 0;
}

/* Draggable pane splitters. Shared between text and ebook modes — wired
   up by gui/splitter.js. The splitter itself is a thin 1px sliver; the
   visible affordance is a circular handle pinned to one end. */
.splitter {
  position: relative;
  z-index: 49;
  flex-shrink: 0;
  background: var(--border, #d1d5db);
}
.splitter-h { width: 1px; cursor: ew-resize; }
.splitter-v { height: 1px; cursor: ns-resize; }

.splitter-handle {
  position: absolute;
  z-index: 50;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-pane, #fff);
  border: 1px solid var(--border, #d1d5db);
  color: var(--text-muted, #6b7280);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  user-select: none;
  opacity: 0.7;
  transition: opacity 120ms ease, background 120ms ease, color 120ms ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  touch-action: none;
}
.splitter-handle:hover,
.splitter.dragging .splitter-handle {
  opacity: 1;
  background: var(--text-muted, #6b7280);
  color: var(--bg-pane, #fff);
}
.splitter-h .splitter-handle {
  left: -11px;
  bottom: 18px;
  cursor: ew-resize;
}
.splitter-h .splitter-handle::before { content: '↔'; }
.splitter-v .splitter-handle {
  bottom: -11px;
  right: 18px;
  cursor: ns-resize;
}
.splitter-v .splitter-handle::before { content: '↕'; }
.splitter.dragging { background: var(--text-muted, #6b7280); }

@media (pointer: coarse) {
  .splitter-handle { width: 28px; height: 28px; opacity: 0.9; font-size: 16px; }
  .splitter-h .splitter-handle { left: -14px; }
  .splitter-v .splitter-handle { bottom: -14px; }
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 12px 4px 16px;
  min-height: 32px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-pane);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.pane-header-label {
  flex: 1;
  min-width: 0;
}

.pane-header-btn {
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.pane-header-btn:hover {
  background: var(--bg);
  color: var(--text);
  border-color: var(--text-muted);
}
.pane-header-btn:active {
  background: var(--border);
}
.pane-header-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Source-pane wrapper that hosts both #source-text and the drop overlay.
   Must participate in flex sizing so the inner #source-text gets a
   bounded height (and thus scrolls instead of pushing the pane open). */
.pane-content-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

.pane-content {
  flex: 1;
  padding: 24px 48px;
  overflow-y: auto;
  min-height: 0;
  background: var(--bg-pane);
  /* Unitless line-height so headings can override compactly. Body
     paragraphs land at 16 × 1.6 = 25.6px; same multiplier on the
     Shavian side keeps the two panes visually balanced. */
  line-height: 1.6;
  font-size: 16px;
  outline: none;
  resize: none;
  border: none;
  font-family: inherit;
  color: var(--text);
  word-wrap: break-word;
}

/* Document typography for the two text-mode panes. Both source and
   target render HTML directly (welcome copy + transliterated mirror),
   so they get the same vertical rhythm. */
#source-text.pane-content,
#shavian-output.pane-content {
  white-space: normal;
}
#source-text.pane-content h1,
#shavian-output.pane-content h1 {
  margin: 0.4em 0 0.2em;
  line-height: 1.05;
}
#source-text.pane-content h2,
#shavian-output.pane-content h2 {
  margin: 1.4em 0 0.5em;
  line-height: 1.25;
  font-size: 22px;
  font-weight: 600;
}
#source-text.pane-content h3,
#shavian-output.pane-content h3 {
  margin: 1.2em 0 0.4em;
  line-height: 1.3;
  font-size: 18px;
  font-weight: 600;
}
#source-text.pane-content p,
#shavian-output.pane-content p {
  margin: 0 0 0.9em;
}
#source-text.pane-content code,
#shavian-output.pane-content code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 3px;
}
#source-text.pane-content a,
#shavian-output.pane-content a {
  color: var(--accent);
}
#source-text.pane-content a:hover,
#shavian-output.pane-content a:hover {
  text-decoration: underline;
}

/* Welcome page heading. Lives in both panes — the engine transliterates
   it across so the title appears in Roman on the left and Shavian on
   the right. */
.welcome-title {
  font-size: clamp(80px, 24cqi, 144px);
  text-align: center;
  margin: 0.2em 0 0;
  line-height: 1;
  letter-spacing: -0.02em;
}

.pane-content:focus {
  box-shadow: inset 0 0 0 2px rgba(79, 70, 229, 0.15);
}

.pane-content:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  font-style: italic;
  pointer-events: none;
}

.shavian-text {
  font-family: 'Bernie Sans Beta', 'InterAlia', system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.shavian-text.placeholder {
  color: var(--text-muted);
  font-family: inherit;
  font-size: 16px;
  font-style: italic;
}

.shavian-text.error {
  color: #991b1b;
}

/* Wrap so the drop overlay can position itself over the editor pane. */
.pane-content-wrap {
  position: relative;
  flex: 1;
  display: flex;
  min-height: 0;
}

/* === Debug Highlights === */

.hl-green {
  background: rgba(34, 197, 94, 0.15);
  border-bottom: 2px solid #22c55e;
  cursor: help;
}

.hl-yellow {
  background: rgba(234, 179, 8, 0.15);
  border-bottom: 2px solid #eab308;
  cursor: help;
}

.hl-red {
  background: rgba(239, 68, 68, 0.15);
  border-bottom: 2px solid #ef4444;
  cursor: help;
}

.hl-orange {
  background: rgba(249, 115, 22, 0.15);
  border-bottom: 2px solid #f97316;
  cursor: help;
}

/* Punctuation / symbol ambiguity — distinct from green/yellow/red (confidence),
   orange (unknown), and purple (user-edit). */
.hl-teal {
  background: rgba(20, 184, 166, 0.15);
  border-bottom: 2px dotted #14b8a6;
  cursor: help;
}

/* === Edited highlight === */

.hl-edited {
  background: rgba(139, 92, 246, 0.15);
  border-bottom: 2px dashed #8b5cf6;
}

/* Accepted words. Quieter than the per-confidence highlights — once
   the user has signed off on a word, the marking is just a faint
   reminder that it's been touched, not a call for attention. */
.hl-done {
  background: transparent;
  border-bottom: 1px dotted rgba(34, 197, 94, 0.6);
  cursor: pointer;
}

/* === Source pane highlights === */

.source-span {
  /* Default: no decoration */
}

/* Source-side event spans render visually invisible — they exist as
   click/hover anchors only. The .bi-highlight class supplies the
   transient indication on mouseover. */
.source-hl-green,
.source-hl-yellow,
.source-hl-red,
.source-hl-orange,
.source-hl-teal {
  /* No decoration. */
}

/* === Bidirectional hover highlight === */

.bi-highlight {
  background: rgba(79, 70, 229, 0.12);
  border-radius: 2px;
}

/* === CorrectionWidget (shared between text-mode popup and ebook review) === */

/* Shared button colours used by .cw-actions buttons. */
.btn-primary,
.btn-secondary {
  padding: 6px 14px;
  border: 0;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
}
.btn-primary:not(:disabled),
.btn-secondary:not(:disabled) {
  cursor: pointer;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: #4338ca; }
.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-pane); }
.btn-primary:disabled,
.btn-secondary:disabled {
  opacity: 0.5;
}

.cw-root {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-pane);
}

.cw-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.cw-word {
  font-size: 20px;
  font-weight: 600;
}
.cw-type {
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 3px;
}
.cw-location {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: auto;
}

.cw-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 6px;
  font-size: 20px;
  outline: none;
  background: var(--bg-pane);
  box-sizing: border-box;
}
.cw-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

/* Read-only widget: damp the chrome so the input doesn't look
   inviting. Dotted border, muted background, no focus halo, default
   text cursor instead of the I-beam. */
.cw-readonly .cw-input {
  border-style: dashed;
  border-color: var(--border);
  background: var(--bg, #f3f4f6);
  color: var(--text-muted, #6b7280);
  cursor: default;
}
.cw-readonly .cw-input:focus {
  border-color: var(--border);
  box-shadow: none;
}
.cw-readonly .cw-alt { cursor: default; opacity: 0.65; }
.cw-readonly .cw-alt:hover { background: transparent; }

.cw-error {
  margin-top: -4px;
  padding: 8px 12px;
  border-radius: 4px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 13px;
  border: 1px solid #fca5a5;
}

.cw-alts {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-height: 0;
}
.cw-alt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 4px;
}
.cw-alt:hover { background: var(--bg); }
.cw-alt.selected { background: rgba(79, 70, 229, 0.08); }
.cw-alt-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  width: 18px;
  text-align: right;
  flex-shrink: 0;
}
.cw-alt-text {
  font-size: 18px;
  flex-shrink: 0;
}
.cw-alt-conf {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
  width: 36px;
}
.cw-alt-bar {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.cw-alt-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.2s;
}
.cw-alt-bar-fill.green  { background: #22c55e; }
.cw-alt-bar-fill.yellow { background: #eab308; }
.cw-alt-bar-fill.red    { background: #ef4444; }
.cw-alt-bar-fill.orange { background: #f97316; }

.cw-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
/* Undo/redo are global (book-level), not per-issue — push them to the
   far right with a separator gap so they don't read as part of the
   per-issue action group. */
.cw-actions .cw-btn-undo { margin-left: auto; }

/* Compact (text-mode) popup variant */
.cw-root.cw-compact {
  position: fixed;
  z-index: 100;
  min-width: 280px;
  max-width: 380px;
  padding: 10px 12px;
  gap: 8px;
  background: var(--bg-pane);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.cw-compact .cw-word { font-size: 14px; }
.cw-compact .cw-type { font-size: 11px; padding: 1px 6px; }
.cw-compact .cw-location { display: none; }
.cw-compact .cw-input { padding: 6px 10px; font-size: 16px; }
.cw-compact .cw-alt { padding: 4px 8px; gap: 8px; }
.cw-compact .cw-alt-text { font-size: 16px; }
.cw-compact .cw-alt-bar { display: none; }
.cw-compact .cw-actions { gap: 4px; }
.cw-compact .cw-actions .btn-primary,
.cw-compact .cw-actions .btn-secondary {
  padding: 3px 8px;
  font-size: 12px;
}

