/* Yiddish Phonikud TTS — research demo UI.
   Every colour is a token defined for light mode on :root, then re-defined once
   under prefers-color-scheme: dark. No colour is ever defined only in the dark block. */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-sunken: #f8fafc;
  --surface-raised: #ffffff;
  --border: #e2e5ea;
  --border-strong: #cbd2da;

  --text: #16191d;
  --text-muted: #5c6570;
  --text-faint: #8a929c;

  --accent: #2f5d8a;
  --accent-hover: #24486c;
  --accent-soft: rgba(47, 93, 138, 0.08);

  --ok: #1f7a4d;
  --ok-soft: rgba(31, 122, 77, 0.1);
  --warn: #9a6510;
  --warn-soft: rgba(154, 101, 16, 0.1);
  --err: #a32f2f;
  --err-soft: rgba(163, 47, 47, 0.1);
  --info-soft: rgba(47, 93, 138, 0.07);

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 19, 23, 0.06), 0 6px 18px rgba(16, 19, 23, 0.05);

  --sans: "Noto Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --hebrew: "Noto Sans Hebrew", "Noto Sans", "Frank Ruhl Libre", "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171b;
    --surface: #1c2025;
    --surface-sunken: #191d21;
    --surface-raised: #22272d;
    --border: #2e343b;
    --border-strong: #3d454e;

    --text: #e6e9ed;
    --text-muted: #a2abb5;
    --text-faint: #7c858f;

    --accent: #7fb0e0;
    --accent-hover: #a2c7ec;
    --accent-soft: rgba(127, 176, 224, 0.12);

    --ok: #63c48f;
    --ok-soft: rgba(99, 196, 143, 0.14);
    --warn: #dfae5c;
    --warn-soft: rgba(223, 174, 92, 0.14);
    --err: #e8817c;
    --err-soft: rgba(232, 129, 124, 0.14);
    --info-soft: rgba(127, 176, 224, 0.09);

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 18px rgba(0, 0, 0, 0.3);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  /* The page itself must never scroll sideways; wide content scrolls in its own box. */
  overflow-x: hidden;
  max-width: 100%;
}

body {
  margin: 0;
  padding: 28px 16px 48px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0;
}

a {
  color: var(--accent);
}

a:hover {
  color: var(--accent-hover);
}

.mono {
  font-family: var(--mono);
  font-variant-ligatures: none;
}

.small {
  font-size: 0.82rem;
}

.muted {
  color: var(--text-muted);
}

/* ---------- header ---------- */

.header {
  margin-bottom: 18px;
}

.header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.auth-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  flex-shrink: 0;
}

.auth-link {
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}

.auth-who {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.lexicon-editor {
  margin-top: 18px;
}

.lexicon-editor .action-row {
  margin-top: 12px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* The status line under the editor fields. */
.lex-status:empty {
  display: none;
}

.status-ok {
  color: var(--ok);
}

.status-warn {
  color: var(--warn);
}

.status-err {
  color: var(--err);
}

/* Legend: the authority chain, in the order the engine consults it. */
.lex-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 14px 0 4px;
  padding: 10px 12px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.lex-legend-label {
  font-weight: 600;
  color: var(--text);
  margin-right: 2px;
}

.lex-chip {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Tier colour tracks authority, not category: the darker the chip, the more
   the reading has been vouched for. Tier 4 is deliberately the loud one. */
.lex-tier-1 {
  background: var(--ok-soft);
  color: var(--ok);
}

.lex-tier-2 {
  background: var(--accent-soft);
  color: var(--accent);
}

.lex-tier-3 {
  background: var(--info-soft);
  color: var(--text-muted);
}

.lex-tier-4 {
  background: var(--warn-soft);
  color: var(--warn);
}

.lex-chip-edited {
  background: var(--accent);
  color: #fff;
  margin-left: 4px;
}

.lex-chip-flagged {
  background: var(--err-soft);
  color: var(--err);
  margin-left: 4px;
}

.lex-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin: 16px 0 4px;
}

.lex-search {
  flex: 1 1 260px;
}

.lex-new-btn {
  flex: 0 0 auto;
}

.control-hint {
  margin: 4px 0 0;
}

/* Edit panel, opened by picking a row. */
.lex-edit {
  margin: 14px 0;
  padding: 14px 16px;
  background: var(--surface-sunken);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}

.lex-edit-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.lex-edit-mode {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-right: 6px;
}

.lex-edit-word {
  font-family: var(--hebrew);
  font-size: 1.25rem;
  font-weight: 600;
}

.lex-edit-meta {
  display: block;
  margin-top: 2px;
}

.lex-close {
  background: none;
  border: 0;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.lex-close:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.lex-count {
  margin: 10px 0 6px;
}

.token-table.lex-table {
  min-width: 640px;
}

.lex-table .lex-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.lex-row {
  cursor: pointer;
}

.lex-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.lex-row-edited .lex-cell-word {
  box-shadow: inset 3px 0 0 var(--accent);
}

.lex-cell-word {
  font-family: var(--hebrew);
  font-size: 1.05rem;
}

.lex-pointed {
  display: block;
  font-size: 0.85rem;
  color: var(--text-faint);
}

.lex-cell-ipa {
  white-space: nowrap;
}

.lex-table .lex-cell-action {
  text-align: right;
  width: 1%;
}

.lex-edit-btn {
  background: none;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 2px 10px;
  font-size: 0.78rem;
  cursor: pointer;
}

.lex-row:hover .lex-edit-btn {
  border-color: var(--accent);
  color: var(--accent);
}

.lex-empty {
  padding: 22px 12px;
  text-align: center;
}

.lex-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 12px;
}

@media (max-width: 640px) {
  .lex-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

.header h1 {
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  color: var(--text);
}

.header h1 i {
  color: var(--accent);
  font-size: 1.4rem;
  margin-right: 6px;
}

.header-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 68ch;
}

/* ---------- notices ---------- */

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 0.9rem;
  background: var(--surface-sunken);
  color: var(--text);
}

.notice-icon {
  margin-top: 2px;
  flex: 0 0 auto;
}

.notice-body {
  min-width: 0;
}

.notice-warn {
  background: var(--warn-soft);
  border-color: var(--warn);
  color: var(--text);
  margin-top: 12px;
}

.notice-warn .notice-icon {
  color: var(--warn);
}

/* ---------- card + tabs ---------- */

.main-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.tabs-container {
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--border);
}

.nav-tabs {
  border: none;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-tabs .nav-link {
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 13px 16px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-muted);
  background: transparent;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.nav-tabs .nav-link:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.nav-tabs .nav-link.active {
  color: var(--accent);
  background: var(--surface);
  border-bottom-color: var(--accent);
}

.nav-tabs .nav-link i {
  margin-right: 6px;
}

.tab-content {
  padding: 22px;
}

/* ---------- inputs ---------- */

.input-section {
  margin-bottom: 14px;
}

.section-title {
  font-size: 1.02rem;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title i {
  color: var(--text-faint);
  font-size: 0.9rem;
}

.form-control {
  display: block;
  width: 100%;
  min-height: 116px;
  resize: vertical;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.2rem;
  line-height: 1.7;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control::placeholder {
  color: var(--text-faint);
  font-size: 1rem;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.rtl {
  direction: rtl;
  text-align: right;
  font-family: var(--hebrew);
  font-size: 1.45rem;
}

.phoneme-input {
  font-family: var(--mono);
  font-size: 1.1rem;
  direction: ltr;
}

/* ---------- helper keys ---------- */

.helper-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.helper-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-right: 4px;
}

.helper-btn {
  padding: 4px 9px;
  font-size: 0.85rem;
  font-family: var(--sans);
  color: var(--text);
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.helper-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.helper-btn.mono {
  font-family: var(--mono);
  min-width: 34px;
}

/* ---------- action row ---------- */

.action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.btn-generate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 132px;
  padding: 10px 20px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #ffffff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

@media (prefers-color-scheme: dark) {
  .btn-generate {
    color: #10141a;
  }
}

.btn-generate:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-generate:disabled {
  opacity: 0.55;
  cursor: progress;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface-sunken);
  color: var(--text-muted);
}

.status-generating {
  background: var(--warn-soft);
  border-color: var(--warn);
  color: var(--warn);
}

.status-ready {
  background: var(--ok-soft);
  border-color: var(--ok);
  color: var(--ok);
}

.status-error {
  background: var(--err-soft);
  border-color: var(--err);
  color: var(--err);
}

/* ---------- samples ---------- */

.samples {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-sunken);
}

.samples-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  margin-bottom: 8px;
}

.samples-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sample-btn {
  font-family: var(--hebrew);
  font-size: 1.05rem;
  padding: 6px 12px;
  color: var(--text);
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: right;
  max-width: 100%;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.sample-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* ---------- results ---------- */

.results {
  border-top: 1px solid var(--border);
  padding: 22px;
}

.result-block + .result-block {
  margin-top: 26px;
}

.result-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 6px;
}

.result-title i {
  color: var(--text-faint);
  font-size: 0.9rem;
}

.token-count {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-faint);
}

#audio {
  width: 100%;
  max-width: 460px;
}

/* ---------- token table ---------- */

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  -webkit-overflow-scrolling: touch;
}

.token-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.token-table th,
.token-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.token-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface-sunken);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}

.token-table tbody tr:last-child td {
  border-bottom: none;
}

.token-table tbody tr:hover {
  background: var(--accent-soft);
}

.cell-word,
.cell-nikud {
  direction: rtl;
  text-align: right;
  font-family: var(--hebrew);
  font-size: 1.18rem;
  line-height: 1.8;
  white-space: nowrap;
}

.cell-ipa {
  direction: ltr;
  unicode-bidi: isolate;
  font-family: var(--mono);
  font-size: 0.95rem;
  white-space: nowrap;
}

.cell-layer {
  font-family: var(--mono);
  color: var(--text-muted);
}

.cell-reason {
  color: var(--text-muted);
  font-size: 0.82rem;
  min-width: 16ch;
}

.badge-route {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  border: 1px solid var(--border-strong);
  background: var(--surface-sunken);
  color: var(--text-muted);
  white-space: nowrap;
}

.route-lexicon {
  border-color: var(--ok);
  background: var(--ok-soft);
  color: var(--ok);
}

.route-rule {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.route-fallback {
  border-color: var(--warn);
  background: var(--warn-soft);
  color: var(--warn);
}

.conf {
  display: inline-block;
  padding: 1px 7px;
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.conf-high {
  background: var(--ok-soft);
  border-color: var(--ok);
  color: var(--ok);
}

.conf-med {
  background: var(--warn-soft);
  border-color: var(--warn);
  color: var(--warn);
}

.conf-low {
  background: var(--surface-sunken);
  border-color: var(--border-strong);
  color: var(--text-muted);
  cursor: help;
  border-bottom-style: dotted;
}

/* ---------- phone chips ---------- */

.phone-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  vertical-align: middle;
}

.chip {
  display: inline-block;
  padding: 1px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-sunken);
  color: var(--text);
  font-size: 0.85rem;
}

.chip-warn {
  border-color: var(--warn);
  background: var(--warn-soft);
  color: var(--warn);
}

/* ---------- voice / runtime controls ---------- */

.voice-panel {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-sunken);
}

.control-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: flex-end;
}

.control {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  flex: 1 1 210px;
}

.control-narrow {
  flex: 0 1 120px;
}

.control-label {
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.control-input {
  width: 100%;
  max-width: 100%;
  padding: 8px 10px;
  font: inherit;
  font-size: 0.92rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  appearance: none;
}

select.control-input {
  /* A chevron drawn in the token colour, so it follows the theme. */
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 14px center, right 9px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

.control-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.control-input:disabled {
  color: var(--text-muted);
  background: var(--surface-sunken);
  cursor: not-allowed;
}

.advanced {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.advanced > summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  list-style: none;
}

.advanced > summary::-webkit-details-marker {
  display: none;
}

.advanced > summary::before {
  content: "\203A";
  display: inline-block;
  width: 1em;
  color: var(--text-faint);
  transition: transform 0.12s ease;
}

.advanced[open] > summary::before {
  transform: rotate(90deg);
}

.advanced > summary:hover {
  color: var(--text);
}

.advanced .control-grid {
  margin-top: 12px;
}

/* ---------- footer ---------- */

.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
  padding: 0 4px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer a {
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

.footer-version {
  margin-left: auto;
  color: var(--text-faint);
}

/* ---------- responsive ---------- */

@media (max-width: 720px) {
  body {
    padding: 18px 10px 36px;
  }

  .header h1 {
    font-size: 1.4rem;
  }

  .tab-content,
  .results,
  .samples,
  .voice-panel {
    padding: 16px 14px;
  }

  /* Narrow screens: one control per row rather than three squeezed ones. */
  .control,
  .control-narrow {
    flex: 1 1 100%;
  }

  .nav-tabs .nav-link {
    padding: 12px 6px;
    font-size: 0.85rem;
  }

  .form-control {
    font-size: 1.05rem;
  }

  .rtl {
    font-size: 1.25rem;
  }

  .action-row {
    align-items: stretch;
    flex-direction: column;
  }

  .btn-generate {
    width: 100%;
  }

  .status-indicator {
    justify-content: center;
  }

  .footer-version {
    margin-left: 0;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* ---------- plain-language additions ---------- */

.pane-hint {
  margin: 0 0 10px;
  max-width: 70ch;
}

.char-count {
  margin: 4px 2px 0;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.char-count-max {
  color: var(--err);
  font-weight: 600;
}

.key-hint {
  align-self: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-size: 0.75rem;
  color: var(--text-faint);
  white-space: nowrap;
}

.read-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}

.read-summary:empty {
  display: none;
}

.chip-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.chip-neutral {
  background: var(--info-soft);
  color: var(--text-muted);
}

.chip-err {
  background: var(--err-soft);
  color: var(--err);
}

#derivation-details > summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}

#derivation-details > summary::-webkit-details-marker {
  display: none;
}

#derivation-details > summary::before {
  content: "\25B8";
  display: inline-block;
  margin-right: 6px;
  color: var(--text-faint);
  transition: transform 0.15s ease;
}

#derivation-details[open] > summary::before {
  transform: rotate(90deg);
}

@media (prefers-reduced-motion: reduce) {
  #derivation-details > summary::before {
    transition: none;
  }
}

.token-table tr.row-low td {
  background: var(--warn-soft);
}

.token-table tr.row-skipped td {
  background: var(--err-soft);
}

/* After .btn-generate, so the quiet variant actually wins. */
.btn-quiet {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
}

.btn-quiet:hover:not(:disabled) {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

/* "Fix" on each row of the results table, and the IPA pad inside the editor.
   Both are solid, not ghost buttons: a transparent button whose text colour
   comes from a token reads as an invisible or black smudge the moment anything
   about the surrounding cell changes. Every colour here also carries a literal
   fallback, so a missing token degrades to a readable button rather than a
   black one. Last in the sheet so the .btn-generate rules cannot take them. */

.tok-fix-col {
  width: 1%;
  white-space: nowrap;
  text-align: end;
}

.token-table .btn-fix {
  display: inline-block;
  font: inherit;
  font-size: 0.85em;
  font-weight: 600;
  line-height: 1;
  padding: 0.4em 0.85em;
  border-radius: 6px;
  cursor: pointer;
  background: #2f5d8a;
  background: var(--accent, #2f5d8a);
  color: #ffffff;
  border: 1px solid transparent;
}

.token-table .btn-fix:hover {
  background: #24486c;
  background: var(--accent-hover, #24486c);
  color: #ffffff;
}

.token-table .btn-fix:focus-visible {
  outline: 2px solid var(--accent, #2f5d8a);
  outline-offset: 2px;
}

.ipa-pad {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.ipa-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}

.ipa-group-label {
  flex: 0 0 5.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #5c6570;
  color: var(--text-muted, #5c6570);
}

.ipa-pad .ipa-key {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  min-width: 2.7rem;
  padding: 0.32rem 0.45rem;
  font: inherit;
  line-height: 1.15;
  cursor: pointer;
  border-radius: 6px;
  background: #ffffff;
  background: var(--surface-raised, #ffffff);
  color: #16191d;
  color: var(--text, #16191d);
  border: 1px solid #cbd2da;
  border-color: var(--border-strong, #cbd2da);
}

.ipa-pad .ipa-key:hover {
  background: rgba(47, 93, 138, 0.08);
  background: var(--accent-soft, rgba(47, 93, 138, 0.08));
  border-color: #2f5d8a;
  border-color: var(--accent, #2f5d8a);
}

.ipa-pad .ipa-key:focus-visible {
  outline: 2px solid var(--accent, #2f5d8a);
  outline-offset: 2px;
}

.ipa-pad .ipa-key-sym {
  font-family: var(--mono, ui-monospace, Menlo, monospace);
  font-size: 1rem;
  color: inherit;
}

.ipa-pad .ipa-key-ex {
  font-family: var(--hebrew, inherit);
  font-size: 0.7rem;
  color: #5c6570;
  color: var(--text-muted, #5c6570);
}

.ipa-pad .ipa-key-tool {
  min-width: 0;
  font-size: 0.8rem;
  color: #5c6570;
  color: var(--text-muted, #5c6570);
}

/* After .btn-generate, so the quiet variant actually wins. */
.btn-quiet {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
}

.btn-quiet:hover:not(:disabled) {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}
