/* ── Base ──────────────────────────────────────────────────── */

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

/* Palette aligns with the Osage Nation Language Department site
   (osageculture.com). Brand purple #722ED1 sourced directly from
   their stylesheet; lime #9CD13C is approximated from the hero
   banner artwork (no published hex). Older code uses --osage-color;
   that name is kept as an alias for backward compatibility. */
:root {
  --primary:        #722ED1;   /* Osage Nation purple */
  --primary-dark:   #5A23A8;   /* hover / banner depth */
  --primary-darker: #3F1A6B;   /* hero gradient bottom */
  --primary-tint:   #ede1f8;   /* lavender surface */
  --accent:         #9CD13C;   /* lime — banner art / active accents */

  --bg:             #fafaf8;
  --surface:        #fff;
  --surface-alt:    #f4f0fa;   /* lavender-tinted surface */
  --border:         #d0d2d9;
  --rule:           #e5dfee;   /* purple-tinted divider */
  --text:           #303233;
  --text-dim:       #55627d;
  --dim:            #55627d;   /* alias */
  --apa-color:      #55627d;

  --osage-color:    var(--primary);   /* alias for legacy rules */

  --pratt-badge:    #5a23a8;   /* deep purple */
  --online-badge:   #4a8b3f;   /* muted green, plays nice with lime */
  --quintero-badge: #c97a18;   /* warm amber */

  --radius: 6px;
  --radius-lg: 10px;
}

body {
  font-family: 'Noto Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Header / Hero banner ─────────────────────────────────── */

header.hero-banner {
  background:
    linear-gradient(135deg, var(--primary-darker) 0%, var(--primary) 60%, var(--primary-dark) 100%);
  color: #fff;
  border-bottom: 3px solid var(--accent);
  position: relative;
  overflow: hidden;
}

header.hero-banner::before {
  /* Subtle geometric motif echoing the diamond pattern in the ON
     Language Department banner. Kept light so it doesn't fight the
     foreground type. */
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(45deg,  rgba(156, 209, 60, 0.10) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(156, 209, 60, 0.10) 25%, transparent 25%),
    linear-gradient(45deg,  transparent 75%, rgba(156, 209, 60, 0.10) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(156, 209, 60, 0.10) 75%);
  background-size: 28px 28px;
  background-position: 0 0, 0 14px, 14px -14px, -14px 0;
  opacity: 0.55;
  pointer-events: none;
}

.hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.4rem 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  position: relative;   /* sit above the ::before motif */
}

.hero-text { max-width: 60%; }

.hero-eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.35rem;
}

header.hero-banner h1 {
  font-size: clamp(1.75rem, 2.2vw + 1rem, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: #fff;
}

.hero-sub {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 300;
}

.hero-script {
  font-family: 'Noto Sans Osage', 'Gadugi', sans-serif;
  font-size: clamp(1.6rem, 3.5vw, 3rem);
  font-weight: 400;
  color: var(--accent);
  line-height: 1;
  text-align: right;
  flex-shrink: 0;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
}

@media (max-width: 640px) {
  .hero-inner { flex-direction: column; align-items: flex-start; padding: 1.6rem 1rem; }
  .hero-text { max-width: 100%; }
  .hero-script { font-size: 1.8rem; align-self: flex-end; }
}

/* ── Tabs ─────────────────────────────────────────────────── */

nav#tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 0.75rem;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

.tab {
  background: none;
  border: none;
  padding: 0.85rem 1.1rem;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  color: var(--text-dim);
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.tab:hover { color: var(--primary); background: var(--surface-alt); }

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--accent);
  font-weight: 700;
}

/* Experimental / verify-with-speakers disclaimer.
   Persistent on Translate, Teacher, and AI Teacher tabs so users
   are reminded that nothing here replaces a fluent speaker. */
.experimental-notice {
  max-width: 800px;
  margin: 1rem auto 0;
  padding: 0.55rem 0.9rem;
  background: var(--surface-alt);
  border-left: 3px solid var(--accent);
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.5;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.experimental-notice strong {
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.experimental-notice .osage-text {
  font-family: 'Noto Sans Osage', 'Gadugi', sans-serif;
  font-weight: 600;
  color: var(--text);
}
/* Translate panel: extra breathing room between disclaimer and the
   input/output boxes so the disclaimer sits as its own block. */
.experimental-notice.translate-notice {
  margin-bottom: 1.6rem;
}

/* Translate-tab preferences strip. Sits below the result, separated
   visually so the auto-send setting doesn't compete with the input
   box for attention. The primary action is the per-result
   'Send for review' button — this just controls whether that click
   posts to the server or queues locally. */
.translate-prefs {
  max-width: 800px;
  margin: 1.5rem auto 0;
  padding: 0.6rem 0.9rem;
  border-top: 1px dashed var(--rule);
  font-size: 0.78rem;
  color: var(--text-dim);
  display: flex;
  justify-content: flex-end;
}
#report-auto-label {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  cursor: pointer;
  user-select: none;
  line-height: 1.35;
}
#report-auto-label > input[type="checkbox"] {
  vertical-align: middle;
}
.report-auto-help {
  flex-basis: 100%;
  font-size: 0.72rem;
  color: var(--text-dim);
  opacity: 0.78;
  font-style: italic;
  display: block;
  text-align: right;
}

/* Teacher engine toggle: switches between T1 (verified-only) and
   AI-augmented modes. iOS-style pill that picks up brand purple
   when on, neutral grey when off. */
.teacher-engine-row {
  margin: 0.5rem 0 0.6rem;
  display: flex;
  justify-content: flex-end;
}
.engine-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.88rem;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.engine-toggle input[type="checkbox"] {
  /* Hide the native checkbox but keep it focusable for keyboard users */
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.engine-toggle .toggle-pill {
  width: 38px;
  height: 22px;
  background: #c7c9d0;
  border-radius: 999px;
  position: relative;
  transition: background 0.15s;
  flex-shrink: 0;
}
.engine-toggle .toggle-pill-inner {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 999px;
  transition: transform 0.15s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}
.engine-toggle input:checked ~ .toggle-pill {
  background: var(--primary);
}
.engine-toggle input:checked ~ .toggle-pill .toggle-pill-inner {
  transform: translateX(16px);
}
.engine-toggle input:focus-visible ~ .toggle-pill {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.engine-toggle .toggle-label .ai-badge-header {
  margin-left: 0.2rem;
}

/* ── Search ───────────────────────────────────────────────── */

#search-panel {
  max-width: 800px;
  margin: 1.5rem auto 0;
  padding: 0 1rem;
}

.search-bar {
  position: relative;
}

#search-input {
  width: 100%;
  padding: 0.8rem 1rem;
  font-size: 1.1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s;
}

#search-input:focus {
  border-color: var(--osage-color);
}

#search-filters {
  display: flex;
  gap: 1rem;
  padding: 0.5rem 0;
  font-size: 0.85rem;
  color: var(--dim);
}

#search-filters label {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

#search-info {
  font-size: 0.85rem;
  color: var(--dim);
  padding: 0.3rem 0;
}

/* ── Results ──────────────────────────────────────────────── */

#results {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

.result-group-header {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 1rem 0 0.5rem;
  border-bottom: 2px solid var(--accent);
  margin-bottom: 0.5rem;
}

.entry {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  transition: background 0.1s;
}

.entry:hover {
  background: var(--surface-alt);
}

.entry-header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hw-osage {
  font-family: 'Noto Sans Osage', 'Gadugi', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--osage-color);
}

.hw-apa {
  font-size: 0.9rem;
  color: var(--apa-color);
  font-style: italic;
}

.pos-tag {
  font-size: 0.75rem;
  background: #eee;
  color: #555;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}

.source-badge {
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  color: #fff;
  font-weight: 600;
}

.source-badge.online { background: var(--online-badge); }
.source-badge.pratt { background: var(--pratt-badge); }
.source-badge.quintero { background: var(--quintero-badge); }
.source-badge.class-materials { background: #c97a1c; }
.source-badge.generated { background: #8a6d3b; }

.needs-review {
  display: inline-block;
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  background: #fff4d6;
  color: #8a5a00;
  border: 1px solid #e6c97a;
  margin-left: 0.25rem;
  font-weight: 600;
}
.entry-unreviewed {
  opacity: 0.82;
}

.entry-def {
  margin-top: 0.3rem;
  color: #444;
}

.entry-example {
  margin-top: 0.3rem;
  padding-left: 1rem;
  font-size: 0.9rem;
}

.entry-example .ex-osage {
  font-family: 'Noto Sans Osage', 'Gadugi', sans-serif;
  color: var(--osage-color);
}

.entry-example .ex-english {
  color: var(--dim);
}

.audio-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0 0.2rem;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.audio-btn:hover { opacity: 1; }

/* ── Detail view ──────────────────────────────────────────── */

#detail {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
}

#detail.hidden { display: none; }

/* Generic hidden utility. Until 2026-04-25 the codebase only had
   per-panel `#X.hidden { display:none }` rules — fine for the top-
   level tab panels, but inner elements that toggle .hidden (Teacher
   engine toggle, future merges) need a class-level rule too. */
.hidden { display: none !important; }

/* Grammar tab — Dialogue view (chat-bubble layout).
   Each unique speaker is assigned a column (first → left, second
   → right, third+ cycles). Adjacent same-speaker turns stack as
   continuations without repeating the speaker label. */
.dialogue-view .dialogue-bubbles {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0 0.2rem;
}
.dialogue-row {
  display: flex;
  width: 100%;
}
.dialogue-row--left  { justify-content: flex-start; }
.dialogue-row--right { justify-content: flex-end; }
.dialogue-row--cont .dialogue-bubble {
  /* Tighten the visual gap on continuation bubbles */
  margin-top: -0.2rem;
}
.dialogue-bubble {
  max-width: 78%;
  padding: 0.55rem 0.85rem 0.65rem;
  border-radius: 14px;
  position: relative;
  line-height: 1.4;
}
.dialogue-row--left .dialogue-bubble {
  background: var(--surface-alt);
  border: 1px solid var(--rule);
  border-bottom-left-radius: 4px;
}
.dialogue-row--right .dialogue-bubble {
  background: var(--primary-tint);
  border: 1px solid #d8c5ee;
  border-bottom-right-radius: 4px;
}
.dialogue-bubble .dialogue-speaker {
  font-size: 0.7rem;
  color: var(--primary-dark);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.2rem;
  opacity: 0.8;
}
.dialogue-row--right .dialogue-bubble .dialogue-speaker {
  text-align: right;
}
.dialogue-bubble .dialogue-osage {
  font-family: 'Noto Sans Osage', 'Gadugi', sans-serif;
  font-size: 1.05rem;
  color: var(--text);
}
.dialogue-bubble .dialogue-apa {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 0.05rem;
}
.dialogue-bubble .dialogue-english {
  font-size: 0.92rem;
  color: var(--text);
  margin-top: 0.4rem;
  padding-top: 0.35rem;
  border-top: 1px dashed var(--rule);
}
.dialogue-bubble .dialogue-english--none {
  color: var(--text-dim);
  font-style: italic;
  font-size: 0.78rem;
  border-top-style: dotted;
  opacity: 0.7;
}
.dialogue-auto-tag {
  display: inline-block;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.05rem 0.4rem;
  border: 1px dashed var(--rule);
  border-radius: 999px;
  margin-left: 0.35rem;
  vertical-align: 1px;
  cursor: help;
}
.dialogue-footnote {
  margin-top: 1rem;
  padding: 0.55rem 0.8rem;
  background: var(--surface-alt);
  border-left: 3px solid var(--rule);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.78rem;
  line-height: 1.5;
}
@media (max-width: 600px) {
  .dialogue-bubble { max-width: 88%; }
}

/* Per-answer "Flag as incorrect" button in Teacher / AI Teacher.
   Subtle by default, lights up to brand purple on hover. */
.teacher-flag-btn {
  background: var(--surface);
  border: 1px solid var(--rule);
  color: var(--text-dim);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  margin-left: 0.4rem;
  vertical-align: middle;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.teacher-flag-btn:hover {
  background: var(--primary-tint);
  color: var(--primary-dark);
  border-color: var(--primary);
}
.teacher-flag-btn:disabled {
  background: var(--surface-alt);
  color: var(--text-dim);
  border-color: var(--rule);
  cursor: default;
  opacity: 0.7;
}

/* About tab — saved-flags export panel */
.about-reports {
  margin-top: 1.2rem;
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.about-reports h3 {
  font-size: 1rem;
  margin: 0 0 0.4rem;
  color: var(--text);
}
.about-export-btn {
  background: var(--primary-tint);
  color: var(--primary-dark);
  border: 1px solid transparent;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  margin-right: 0.5rem;
  transition: background 0.12s, color 0.12s;
}
.about-export-btn:hover {
  background: var(--primary);
  color: #fff;
}
.about-export-btn-alt {
  background: var(--surface);
  color: var(--text-dim);
  border-color: var(--rule);
}
.about-export-btn-alt:hover {
  background: var(--surface-alt);
  color: var(--primary);
}

/* About tab build-info footer */
.about-build {
  margin-top: 2rem;
  padding: 0.9rem 1rem;
  background: var(--surface-alt);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius) var(--radius) 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  font-size: 0.82rem;
  color: var(--text-dim);
}
.about-build code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  background: rgba(114, 46, 209, 0.08);
  color: var(--primary-dark);
  padding: 0 0.3rem;
  border-radius: 3px;
}
.about-build a { color: var(--primary); }

#detail-close {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  color: var(--dim);
}

#detail-close:hover { color: var(--text); border-color: var(--text); }

.detail-heading {
  font-family: 'Noto Sans Osage', 'Gadugi', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--osage-color);
  margin: 0.5rem 0;
}

.detail-section {
  margin: 1rem 0;
}

.detail-section h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--dim);
  letter-spacing: 0.03em;
  margin-bottom: 0.3rem;
}

.detail-def-list {
  list-style: decimal;
  padding-left: 1.5rem;
}

.detail-def-list li {
  margin-bottom: 0.3rem;
}

.detail-example {
  padding: 0.5rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.detail-meta {
  font-size: 0.85rem;
  color: var(--dim);
}

/* ── Grammar / Examples entries ────────────────────────────── */

.grammar-entry, .example-entry {
  padding: 0.8rem 0;
  border-bottom: 1px solid #eee;
}

.grammar-name {
  font-weight: 600;
  color: var(--osage-color);
}

.grammar-location {
  font-size: 0.8rem;
  color: var(--dim);
}

.grammar-excerpt {
  margin-top: 0.3rem;
  font-size: 0.9rem;
  color: #555;
}

.tri-script .osage {
  font-family: 'Noto Sans Osage', 'Gadugi', sans-serif;
  font-weight: 600;
  color: var(--osage-color);
}

.tri-script .apa {
  color: var(--apa-color);
  font-style: italic;
  font-size: 0.9em;
}

.tri-script .english {
  color: #444;
}

/* ── Load more ────────────────────────────────────────────── */

#load-more-container {
  text-align: center;
  padding: 1rem;
  max-width: 800px;
  margin: 0 auto;
}

#load-more-btn {
  padding: 0.5rem 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.9rem;
}

#load-more-btn:hover {
  border-color: var(--osage-color);
  color: var(--osage-color);
}

/* ── About tab ────────────────────────────────────────────── */

.about-section {
  max-width: 700px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.about-section h2 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--osage-color);
}

.about-section p, .about-section ul {
  margin-bottom: 1rem;
  font-size: 0.95rem;
  color: #555;
}

.about-section ul { padding-left: 1.5rem; }

.stats-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.stats-table td, .stats-table th {
  padding: 0.4rem 0.8rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.stats-table td:last-child { text-align: right; font-weight: 600; }

/* ── La Flesche 1932 archival panel ──────────────────────── */

.lf-archival-panel {
  margin-top: 0.8rem;
  border: 1px solid var(--border);
  border-left: 3px solid #b08800;  /* warm ochre to suggest archive */
  border-radius: 0.4rem;
  background: #fdf8ec;             /* parchment-tinted background */
  padding: 0.7rem 0.9rem;
  font-size: 0.85rem;
}

.lf-archival-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  color: #6e5400;
  margin-bottom: 0.3rem;
}
.lf-archival-icon { font-size: 1rem; }
.lf-archival-title { font-size: 0.9rem; }
.lf-archival-badge {
  background: #f5e7b8;
  color: #6e5400;
  padding: 0.1rem 0.45rem;
  border-radius: 0.7rem;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.lf-archival-note {
  font-size: 0.75rem;
  color: #6e5400;
  margin-bottom: 0.5rem;
  line-height: 1.45;
  opacity: 0.9;
}

.lf-entries { display: flex; flex-direction: column; gap: 0.5rem; }

.lf-entry {
  background: rgba(255, 255, 255, 0.65);
  border-radius: 0.3rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid rgba(176, 136, 0, 0.15);
}

.lf-headword {
  font-weight: 600;
  color: #4a3800;
  font-family: "Times New Roman", serif;
}

.lf-correction {
  font-size: 0.85em;
  color: #6e5400;
  margin-left: 0.3rem;
}
.lf-corrected {
  font-weight: 500;
  color: #4a3800;
  font-family: "Times New Roman", serif;
}
.lf-correction-tag {
  font-size: 0.75em;
  color: #806400;
  font-style: italic;
  margin-left: 0.2rem;
}

.lf-def {
  margin-top: 0.2rem;
  font-size: 0.85rem;
  color: #4a3800;
  line-height: 1.45;
}

.lf-modern-link {
  margin-top: 0.3rem;
  padding: 0.25rem 0.4rem;
  background: rgba(114, 46, 209, 0.06);
  border-left: 2px solid var(--primary);
  font-size: 0.8rem;
  color: var(--text);
  border-radius: 0.2rem;
}

.lf-conf {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 0 0.4rem;
  border-radius: 0.5rem;
  font-size: 0.7rem;
  font-weight: 500;
}
.lf-conf-high { background: #e6f4d6; color: #3a5d1d; }
.lf-conf-medium { background: #fcf3cf; color: #6e5b00; }

/* LF→modern transliteration estimate (shown only on the detail page).
   Card view is minimal and clickable; detail page surfaces full info. */
.lf-estimate-apa {
  font-style: italic;
  color: #4a3a20;
  font-size: 1.1rem;
}
.lf-estimate-osage {
  margin-left: 0.4rem;
  opacity: 0.9;
  font-size: 1.2rem;
}

.lf-detail-heading {
  font-family: 'FreeSerif', Georgia, serif;
  color: var(--primary);
}
.lf-detail-disclaimer {
  margin: 0.3rem 0 1rem 0;
  padding: 0.55rem 0.7rem;
  background: rgba(120, 90, 60, 0.06);
  border-left: 3px solid rgba(120, 90, 60, 0.4);
  font-size: 0.85rem;
  color: #5a4a30;
  line-height: 1.45;
  border-radius: 0.2rem;
}
.lf-detail-def {
  font-size: 1rem;
  line-height: 1.55;
}
.lf-detail-modern {
  font-size: 1.05rem;
}
.lf-detail-modern-def {
  margin-top: 0.25rem;
  font-size: 0.95rem;
  color: #444;
}
.lf-detail-estimate {
  font-size: 1.1rem;
  line-height: 1.6;
}
.lf-detail-note {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: #666;
  font-style: italic;
  line-height: 1.45;
}
.lf-detail-xrefs {
  font-size: 0.9rem;
  line-height: 1.7;
}
.lf-detail-cite {
  font-size: 0.85rem;
  color: #555;
  font-style: italic;
}

/* Dictionary tab welcome card — shown when no active query */
.dict-welcome {
  margin: 1.5rem auto;
  max-width: 700px;
  padding: 1.5rem 1.7rem;
  background: linear-gradient(180deg, rgba(96,64,64,0.04) 0%, rgba(96,64,64,0.01) 100%);
  border: 1px solid rgba(96,64,64,0.18);
  border-radius: 0.5rem;
}
.dict-welcome h3 {
  color: var(--primary);
  margin-top: 0;
  font-size: 1.2rem;
}
.dict-welcome p {
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0.6rem 0;
  color: #444;
}
.welcome-chips {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.welcome-chips-label {
  font-size: 0.85rem;
  color: #666;
  margin-right: 0.3rem;
}
.welcome-chip {
  padding: 0.35rem 0.75rem;
  background: #fff;
  border: 1px solid var(--primary);
  color: var(--primary);
  border-radius: 1rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  transition: background 0.15s;
}
.welcome-chip:hover {
  background: var(--primary);
  color: #fff;
}

/* "Share" button on the detail panel — copies the deep-link URL. */
.detail-share-btn {
  float: right;
  margin: 0 0 0.6rem 0.6rem;
  padding: 0.35rem 0.8rem;
  background: #fff;
  border: 1px solid var(--primary);
  color: var(--primary);
  border-radius: 0.3rem;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  transition: background 0.12s;
}
.detail-share-btn:hover {
  background: var(--primary);
  color: #fff;
}
.detail-share-btn:disabled {
  background: #c8e6c8;
  border-color: #2a7e2a;
  color: #1a5e1a;
  cursor: default;
}

/* Grammar tab — flag-as-incorrect affordances */
.grammar-flag-row {
  margin-top: 1.2rem;
  padding-top: 0.8rem;
  border-top: 1px solid #eee;
  text-align: right;
}
.grammar-flag-btn {
  padding: 0.4rem 0.8rem;
  background: #fff;
  border: 1px solid #b03030;
  color: #b03030;
  border-radius: 0.3rem;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  transition: background 0.12s;
}
.grammar-flag-btn:hover {
  background: #b03030;
  color: #fff;
}
/* Per-turn flag in dialogue bubbles — small + unobtrusive */
.dialogue-bubble {
  position: relative;
}
.dialogue-flag-btn {
  position: absolute;
  top: 0.35rem;
  right: 0.4rem;
  padding: 0.05rem 0.35rem;
  background: transparent;
  border: 1px solid transparent;
  color: #b03030;
  border-radius: 0.2rem;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  opacity: 0.5;
  transition: all 0.15s;
}
.dialogue-bubble:hover .dialogue-flag-btn,
.dialogue-flag-btn:focus {
  opacity: 1;
  border-color: rgba(176, 48, 48, 0.4);
}
.dialogue-flag-btn:hover {
  background: rgba(176, 48, 48, 0.1);
  border-color: #b03030;
}

/* Teacher-tab LF historical fallback panel */
.lf-teacher-panel {
  margin-top: 0.6rem;
  padding: 0.7rem 0.85rem;
  background: rgba(120, 90, 60, 0.06);
  border: 1px solid rgba(120, 90, 60, 0.25);
  border-left: 3px solid rgba(120, 90, 60, 0.5);
  border-radius: 0.3rem;
}
.lf-teacher-header {
  font-weight: 600;
  color: #5a4a30;
  font-size: 0.92rem;
  margin-bottom: 0.25rem;
}
.lf-teacher-icon {
  margin-right: 0.3rem;
}
.lf-teacher-note {
  font-size: 0.78rem;
  color: #6e5a3a;
  font-style: italic;
  line-height: 1.45;
  margin-bottom: 0.55rem;
}
.lf-teacher-item {
  margin-top: 0.5rem;
  padding: 0.4rem 0.55rem;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(120, 90, 60, 0.18);
  border-radius: 0.25rem;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.lf-teacher-item:hover, .lf-teacher-item:focus {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(120, 90, 60, 0.45);
  outline: none;
}
.lf-teacher-hw {
  font-family: 'FreeSerif', Georgia, serif;
  font-weight: 600;
  color: #4a3a20;
  font-size: 1rem;
}
.lf-teacher-modern {
  margin-top: 0.15rem;
  font-size: 0.92rem;
  color: #5a4a30;
}
.lf-teacher-modern-tag {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 0 0.35rem;
  background: #f0e8d8;
  color: #6e5a3a;
  font-size: 0.7rem;
  border-radius: 0.4rem;
  vertical-align: 0.05em;
}
.lf-teacher-def {
  margin-top: 0.2rem;
  font-size: 0.88rem;
  color: #444;
  line-height: 1.4;
}
.lf-teacher-cite {
  margin-top: 0.2rem;
  font-size: 0.75rem;
  color: #888;
  font-style: italic;
}

.lf-cite {
  margin-top: 0.3rem;
  font-size: 0.7rem;
  color: #806400;
  opacity: 0.85;
  font-style: italic;
}

/* LF result card variant for the Dictionary tab. Same parchment palette
   as the Teacher panel, but inline with other dictionary results. */
.entry.lf-result {
  background: #fdf8ec;
  border-left: 3px solid #b08800;
}
.lf-headword-card {
  font-family: "Times New Roman", serif;
  color: #4a3800 !important;
}
.lf-source-badge {
  display: inline-block;
  background: #6e5400;
  color: #fdf8ec;
  font-size: 0.65rem;
  padding: 0.1rem 0.45rem;
  border-radius: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-left: 0.3rem;
  vertical-align: middle;
}
.lf-archival-badge-small {
  display: inline-block;
  background: #f5e7b8;
  color: #6e5400;
  font-size: 0.6rem;
  padding: 0.05rem 0.4rem;
  border-radius: 0.5rem;
  font-style: italic;
  margin-left: 0.2rem;
  vertical-align: middle;
}
/* E→O cards: same parchment palette but blue accent so users can tell
   the entry direction at a glance. The English headword is the primary
   line; the Osage forms are the body. */
.lf-e2o-card {
  border-left-color: #527a96 !important;
}
.lf-e2o-card .lf-headword-card {
  color: #2b4d63 !important;
  font-family: var(--font-body, "Inter", sans-serif);
  font-style: normal;
}
.lf-e2o-card .lf-archival-badge-small {
  background: #d4e1eb;
  color: #2b4d63;
}
.lf-e2o-forms {
  font-family: "Times New Roman", serif;
  color: #4a3800;
}
/* LF→LF cross-reference links inside definition text. Match the
   parchment palette but read as clickable. */
.lf-xref {
  color: #6e5400;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
  cursor: pointer;
  font-style: italic;
}
.lf-xref:hover {
  color: #4a3800;
  text-decoration-style: solid;
}

/* "As OCR'd" provenance line: subtle subtitle showing the literal text
   the PDF text layer emits, when we've corrected to LF's intended form. */
.lf-orig-line {
  font-size: 0.78rem;
  color: #6e5400;
  margin-top: 0.15rem;
  font-style: italic;
  letter-spacing: 0.01em;
}
.lf-orig-form {
  font-family: "Times New Roman", serif;
  color: #4a3800;
  font-style: normal;
}

/* Cross-references block: Quintero LFD page + BAE per-word evidence. */
.lf-xrefs {
  font-size: 0.78rem;
  color: #5a4400;
  margin-top: 0.4rem;
  padding-top: 0.3rem;
  border-top: 1px dashed rgba(110, 84, 0, 0.3);
}
.lf-xref-cite {
  display: inline-block;
  margin-right: 0.6rem;
}
.lf-xref-cite em {
  font-family: "Times New Roman", serif;
  font-style: italic;
  color: #4a3800;
}

/* ── Footer ───────────────────────────────────────────────── */

footer {
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  border-top: 1px solid var(--rule);
  background: var(--surface-alt);
  margin-top: 2rem;
}

footer p strong { color: var(--primary); font-weight: 700; }
footer .dim { font-size: 0.75rem; margin-top: 0.3rem; color: var(--text-dim); opacity: 0.75; }

/* ── Loading overlay ──────────────────────────────────────── */

#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.3s;
}

#loading-overlay.done {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--osage-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Translate panel ──────────────────────────────────────── */

#translate-panel {
  max-width: 900px;
  margin: 1.5rem auto 0;
  padding: 0 1rem;
}

#translate-panel.hidden { display: none; }
#teacher-panel.hidden { display: none; }

.translate-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.translate-input-area, .translate-output-area {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem;
  min-height: 150px;
}

.translate-input-area:focus-within {
  border-color: var(--osage-color);
}

.translate-lang-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.5rem;
}

#translate-input {
  width: 100%;
  border: none;
  outline: none;
  font-size: 1.2rem;
  font-family: 'Noto Sans Osage', 'Gadugi', 'Segoe UI', system-ui, sans-serif;
  resize: none;
  background: transparent;
  line-height: 1.5;
}

.translate-input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
}

#translate-detect {
  font-size: 0.8rem;
  color: var(--dim);
}

.translate-btn-small {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--dim);
}

.translate-btn-small:hover {
  border-color: var(--osage-color);
  color: var(--osage-color);
}

.translate-output-area {
  background: #f8f7f5;
}

#translate-output {
  font-size: 1.1rem;
  line-height: 1.6;
  /* Long Osage-script outputs (multi-sentence) must wrap and be fully
     visible. Earlier sibling-grid alignment was cutting off the tail
     of the breakdown. */
  overflow-wrap: anywhere;
  word-break: break-word;
}
#translate-output .tr-teacher-answer,
#translate-output .tr-explain {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.translate-output-area { overflow: visible; }

#translate-output .tr-main {
  font-family: 'Noto Sans Osage', 'Gadugi', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--osage-color);
  margin-bottom: 0.3rem;
}

#translate-output .tr-apa {
  font-size: 0.95rem;
  color: var(--apa-color);
  font-style: italic;
  margin-bottom: 0.3rem;
}

#translate-output .tr-english {
  color: #444;
}

#translate-output .tr-source {
  font-size: 0.75rem;
  color: var(--dim);
  margin-top: 0.3rem;
}

#translate-output .tr-no-match {
  color: var(--dim);
  font-style: italic;
}

/* Pedagogical "explain" chips (E2O output). Each chip shows the role
   of one Osage token; clicking opens the matching Grammar topic. */
.tr-explain {
  margin-top: 0.9rem;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--border);
}
.tr-explain-title {
  font-size: 0.75rem;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}
.tr-explain-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.tr-chip {
  display: inline-flex;
  align-items: stretch;
  padding: 0;
  background: #f7f4ed;
  border: 1px solid #d9ccaf;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.78rem;
  line-height: 1.25;
  transition: background 0.15s, border-color 0.15s;
  overflow: hidden;
}
.tr-chip:hover {
  background: #f0e9d1;
  border-color: #b69a5c;
}
.tr-chip-body {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0.25rem 0.55rem;
}
.tr-chip-play {
  border: none;
  border-left: 1px solid #d9ccaf;
  background: #ece0bf;
  color: #6f5b2a;
  padding: 0 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.tr-chip-play:hover {
  background: #d9c88a;
  color: #3a2c06;
}
.tr-chip-play:active {
  background: #b69a5c;
  color: white;
}
.tr-main-play {
  margin-left: 0.5rem;
  border-radius: 50%;
  border: 1px solid #d9ccaf;
  padding: 0.15rem 0.45rem;
  font-size: 0.8rem;
  vertical-align: middle;
}
/* "Send for review" — primary positive action on each translation.
   Pulls eye toward "you can help improve this" rather than the prior
   negative-framed "Report issue" link. */
.tr-report-btn {
  background: var(--primary-tint);
  border: 1px solid transparent;
  color: var(--primary-dark);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  margin-left: 0.4rem;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.tr-report-btn:hover {
  background: var(--primary);
  color: #fff;
}
.tr-report-btn:disabled {
  background: var(--surface-alt);
  color: var(--text-dim);
  border-color: var(--rule);
  cursor: default;
}

/* ── Practice tab ─────────────────────────────────────────── */
#practice-panel.hidden { display: none; }
.practice-container { max-width: 820px; margin: 0 auto; padding: 1rem; }
.practice-header h2 { margin: 0 0 0.25rem; font-size: 1.4rem; }
.practice-subtitle { color: var(--dim); margin: 0 0 1rem; font-size: 0.9rem; }
.practice-controls {
  display: flex; gap: 0.8rem; flex-wrap: wrap; align-items: flex-end;
  margin-bottom: 1rem;
}
.practice-controls label {
  display: flex; flex-direction: column; font-size: 0.8rem; color: var(--dim);
}
.practice-controls select {
  margin-top: 0.2rem; padding: 0.3rem 0.5rem; border: 1px solid var(--border);
  border-radius: 4px; font-size: 0.9rem; background: white;
}
.practice-btn {
  padding: 0.5rem 1rem; border: 1px solid #b69a5c;
  background: #e0cf96; color: #3a2c06; border-radius: 4px; cursor: pointer;
  font-weight: 600; font-size: 0.9rem;
}
.practice-btn:hover { background: #d0bd80; }
.practice-btn-alt {
  background: #f0ecd9; border-color: #c9bf93; color: #555;
}
.practice-btn-tiny {
  font-size: 0.75rem; padding: 0.2rem 0.55rem; color: #888;
  background: none; border: 1px dashed #c4b68b; cursor: pointer;
  border-radius: 3px; margin-top: 0.4rem;
}
.practice-exercise {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; background: var(--surface);
}
.practice-empty {
  color: var(--dim); font-style: italic; padding: 1rem; text-align: center;
}
.practice-prompt { margin-bottom: 0.4rem; }
.practice-type-badge, .practice-topic-badge {
  display: inline-block; font-size: 0.7rem; padding: 0.1rem 0.5rem;
  border-radius: 10px; margin-right: 0.3rem; font-weight: 600;
}
.practice-type-badge { background: #d9ccaf; color: #3a2c06; }
.practice-topic-badge { background: #c9e0d1; color: #1e4d32; }
.practice-chapter-badge { background: #b8d4e8; color: #0e3a57; cursor: pointer; }
.practice-chapter-badge:hover { background: #9cc3e0; }

/* Course tab: "Continue where you left off" resume CTA */
.course-resume {
  margin: 0.8rem 0;
  padding: 0.75rem 1rem;
  background: #eef4ea;
  border-left: 4px solid #3e7a42;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.1s;
}
.course-resume:hover { background: #dce9d6; }
.course-resume-label {
  font-size: 0.75rem;
  color: #2d5a31;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.course-resume-title { font-size: 1.05rem; font-weight: 600; margin-top: 0.2rem; }
.course-resume-sub { font-size: 0.85rem; color: #555; }

/* Course tab: per-word audio chips inside Osage examples */
.osage-word-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0 0.1rem;
  border-radius: 3px;
  transition: background 0.1s;
}
.osage-word-chip:hover { background: #f2ecdc; }
.osage-word-play {
  font-size: 0.65rem;
  padding: 0 0.3rem;
  line-height: 1.2;
  opacity: 0.55;
  transition: opacity 0.1s;
}
.osage-word-chip:hover .osage-word-play { opacity: 1; }

/* Inline grammar chips: free-form mentions of grammar topics in
   Translate breakdown / Teacher / AI Teacher responses become clickable
   chips that switch to the Grammar tab. */
.grammar-chip,
.course-grammar-chip {
  display: inline-block;
  padding: 0 0.35rem;
  border-radius: 4px;
  background: #e8eef8;
  color: #1e3a5f;
  cursor: pointer;
  text-decoration: underline dotted #7aa4cf;
  text-underline-offset: 2px;
  font-weight: 500;
  transition: background 0.1s;
}
.grammar-chip:hover,
.course-grammar-chip:hover {
  background: #cfdbed;
  text-decoration: none;
}
.practice-question {
  font-size: 1.05rem; margin: 0.6rem 0 0.8rem; line-height: 1.4;
}
.practice-input-row {
  display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem;
}
.practice-input-row input {
  flex: 1; padding: 0.45rem 0.6rem; border: 1px solid var(--border);
  border-radius: 4px; font-size: 1rem;
}
.practice-feedback { padding: 0.3rem 0; font-weight: 600; }
.practice-feedback.correct { color: #1d7a42; }
.practice-feedback.wrong { color: #a53a2a; }
.practice-feedback.neutral { color: var(--dim); font-weight: 400; }
.practice-answer-reveal {
  margin-top: 0.6rem; padding: 0.6rem 0.8rem; background: #fff6de;
  border-left: 3px solid #e6c97a; border-radius: 3px; font-size: 0.95rem;
}
.practice-answer-reveal:empty { display: none; }
.practice-answer-title {
  font-size: 0.7rem; color: var(--dim); text-transform: uppercase;
  letter-spacing: 0.05em; margin-bottom: 0.2rem;
}
.practice-answer-osage {
  font-family: 'Noto Sans Osage', 'Gadugi', sans-serif;
  font-size: 1.3rem; color: var(--osage-color);
}
.practice-answer-apa { color: var(--apa-color); font-style: italic; }
.practice-answer-eng { color: #444; }
.practice-answer-hint { font-size: 0.8rem; color: var(--dim); margin-top: 0.3rem; }
.practice-progress {
  margin-top: 1rem; padding-top: 0.8rem; border-top: 1px dashed var(--border);
  font-size: 0.85rem;
}
.practice-stats { color: #333; }
.practice-topic-chip {
  display: inline-block; font-size: 0.75rem; padding: 0.1rem 0.5rem;
  background: #fdecd4; border: 1px solid #e6c97a; border-radius: 10px;
  margin-right: 0.2rem;
}
.practice-stats-details { margin-top: 0.5rem; }
.practice-stats-details summary {
  cursor: pointer; font-size: 0.8rem; color: var(--dim);
}
.practice-stats-details table {
  margin-top: 0.4rem; border-collapse: collapse; font-size: 0.85rem;
}
.practice-stats-details td {
  padding: 0.2rem 0.6rem; border-bottom: 1px solid var(--border);
}
.practice-stats-sub {
  font-size: 0.75rem; color: var(--dim); text-transform: uppercase;
  letter-spacing: 0.05em; margin: 0.5rem 0 0.25rem;
}
.practice-sr-indicator {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.1rem 0.5rem;
  background: #dfe9f5;
  border: 1px solid #8faed1;
  border-radius: 10px;
  color: #2e4d77;
  cursor: help;
}
.tr-chip-token {
  font-family: 'FreeSerif', 'Times New Roman', serif;
  font-weight: 600;
  color: var(--apa-color);
  font-size: 0.9rem;
}
.tr-chip-role {
  font-size: 0.7rem;
  color: #6f5b2a;
  text-transform: lowercase;
}
.tr-chip-gloss {
  font-size: 0.7rem;
  color: #444;
  font-style: italic;
}

#translate-details {
  max-width: 900px;
}

.tr-section {
  margin: 1rem 0;
  padding: 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.tr-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.6rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}

/* Interlinear gloss table */
.gloss-table {
  border-collapse: collapse;
  width: 100%;
}

.gloss-cell {
  padding: 0.3rem 0.8rem;
  text-align: center;
  vertical-align: top;
  border-right: 1px solid #eee;
}

.gloss-cell:last-child { border-right: none; }

.gloss-osage {
  font-family: 'Noto Sans Osage', 'Gadugi', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--osage-color);
}

.gloss-apa {
  font-size: 0.8rem;
  color: var(--apa-color);
  font-style: italic;
}

.gloss-eng {
  font-size: 0.85rem;
  color: #444;
  margin-top: 0.2rem;
}

.gloss-role {
  font-size: 0.7rem;
  color: var(--dim);
  font-style: italic;
}

.gloss-unknown {
  background: #fff3e0;
}

.gloss-unknown .gloss-osage {
  color: var(--dim);
}

/* Analysis tags */
.tr-analysis {
  margin: 0.3rem 0;
  font-size: 0.95rem;
}

.tr-tag {
  display: inline-block;
  background: #e8f0fe;
  color: var(--osage-color);
  padding: 0.1rem 0.5rem;
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Conjugation grid */
.conj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.5rem;
}

.conj-form {
  padding: 0.4rem 0.6rem;
  border: 1px solid #eee;
  border-radius: 4px;
  background: #fafaf8;
}

.conj-more {
  font-size: 0.85rem;
  color: var(--dim);
  padding: 0.5rem;
}

/* Sentence matches */
.tr-sentence {
  padding: 0.5rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.tr-detail-entry {
  padding: 0.6rem 0;
  border-bottom: 1px solid #eee;
}

.tr-detail-entry .hw-osage {
  font-size: 1.05rem;
}

.tr-detail-entry .tr-def, .tr-sentence .tr-def {
  font-size: 0.9rem;
  color: #555;
  margin-top: 0.2rem;
}

.tr-notice {
  font-size: 0.8rem;
  color: var(--dim);
  font-style: italic;
  padding: 0.5rem;
  text-align: center;
}

/* Ask the Teacher button */
.ask-teacher-btn {
  display: block;
  width: 100%;
  margin-top: 0.8rem;
  padding: 0.6rem 1rem;
  background: var(--osage-color);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: opacity 0.15s;
}

.ask-teacher-btn:hover { opacity: 0.9; }
.ask-teacher-btn:disabled { opacity: 0.5; cursor: not-allowed; }

#teacher-response {
  margin-top: 0.5rem;
  padding: 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre-wrap;
  display: none;
}

#teacher-response.visible { display: block; }

.teacher-loading {
  color: var(--dim);
  font-style: italic;
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 600px) {
  header .osage-text { font-size: 1.4rem; }
  .tab { padding: 0.5rem 0.7rem; font-size: 0.85rem; }
  #search-filters { flex-wrap: wrap; gap: 0.5rem; }
  .hw-osage { font-size: 1.05rem; }
  .translate-container { grid-template-columns: 1fr; }
}

/* ── Teacher Chat ─────────────────────────────────────────── */

.teacher-container {
  max-width: 760px;
  margin: 0 auto 2rem;
  display: flex;
  flex-direction: column;
  /* Let the container size to its content. The chat-area cap below
     prevents runaway height; the prompt-buttons + input row sit just
     below it in normal flow, with margin-bottom to keep the footer
     clear. (Earlier max-height was clipping flex children which then
     overflowed onto the footer — see fix 2026-04-29.) */
  min-height: 0;
  padding: 0 0.5rem;
}

.teacher-header {
  padding: 0.8rem 0 0.6rem;
  border-bottom: 1px solid var(--rule);
}

.teacher-header { position: relative; }
.teacher-header h2 { font-size: 1.25rem; color: var(--text); display: flex; align-items: center; gap: 0.5rem; }
.teacher-subtitle { color: var(--text-dim); font-size: 0.85rem; margin-top: 0.3rem; }

.help-icon {
  width: 1.4rem; height: 1.4rem;
  border-radius: 50%;
  border: 1.5px solid var(--dim);
  background: none;
  color: var(--dim);
  font-size: 0.8rem; font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.help-icon:hover { color: #c8612d; border-color: #c8612d; }

.clear-chat-btn {
  background: none; border: none;
  color: var(--dim); font-size: 0.75rem;
  cursor: pointer; margin-left: auto;
}
.clear-chat-btn:hover { color: #c8612d; }

.teacher-help-popup {
  position: absolute;
  top: 3.5rem; left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  padding: 1rem 1.2rem;
  z-index: 100;
  font-size: 0.82rem;
  line-height: 1.6;
  animation: fadeIn 0.15s ease-out;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; } }

.teacher-help-popup p { margin: 0.2rem 0; }
.teacher-help-popup strong { color: #c8612d; }

.help-close {
  position: absolute; top: 0.4rem; right: 0.6rem;
  background: none; border: none;
  font-size: 1.2rem; color: var(--dim);
  cursor: pointer; line-height: 1;
}
.help-close:hover { color: var(--text); }

.teacher-chat {
  /* Grow as content arrives. The min-height keeps a comfortable reading
     area on first paint; max-height caps runaway growth on long chats so
     the input/prompt rows stay reachable without infinite scrolling.
     Reduced max-height from 70vh to 55vh so the prompt-buttons + input
     fit inside the viewport with the footer below. */
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.6rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-height: 360px;
  max-height: 55vh;
}

.teacher-welcome {
  text-align: center;
  color: var(--text-dim);
  padding: 0.8rem 0 0.4rem;
  font-size: 0.9rem;
}

.teacher-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1rem;
}

.suggestion-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text);
  transition: background 0.15s;
}
.suggestion-btn:hover { background: #f0efe8; }
.suggestion-btn.small { font-size: 0.75rem; padding: 0.25rem 0.6rem; }

.chat-msg {
  max-width: 85%;
  padding: 0.7rem 1rem;
  border-radius: 1rem;
  line-height: 1.5;
  font-size: 0.9rem;
  word-wrap: break-word;
}

.user-msg {
  align-self: flex-end;
  background: #c8612d;
  color: white;
  border-bottom-right-radius: 0.3rem;
}

.teacher-msg {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 0.3rem;
}

.teacher-msg .osage-text {
  font-family: 'Noto Sans Osage', 'Gadugi', sans-serif;
  font-size: 1.1em;
}

.teacher-msg .apa-text { color: #6a6a6a; font-style: italic; }

.teacher-answer { margin-bottom: 0.3rem; }

.conf-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.1rem 0.5rem;
  border-radius: 0.8rem;
  margin-top: 0.4rem;
}
.conf-verified { background: #d4edda; color: #155724; }
.conf-high { background: #cce5ff; color: #004085; }
.conf-medium { background: #fff3cd; color: #856404; }
.conf-ai { background: #e8daef; color: #6c3483; }

.teacher-followup { margin-top: 0.5rem; }

.teacher-msg.error { color: #721c24; background: #f8d7da; border-color: #f5c6cb; }

.teacher-msg.loading { padding: 1rem; }

.dot-pulse {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  background: var(--dim);
  border-radius: 50%;
  animation: pulse 1s infinite;
}
.dot-pulse::before, .dot-pulse::after {
  content: '';
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  background: var(--dim);
  border-radius: 50%;
  animation: pulse 1s infinite;
  margin-left: 0.3rem;
}
.dot-pulse::before { animation-delay: 0.2s; }
.dot-pulse::after { animation-delay: 0.4s; }
@keyframes pulse { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

/* ── Grammar tab ──────────────────────────────────────── */
#grammar-panel.hidden { display: none; }
#grammar-content { max-width: 800px; margin: 0 auto; padding: 0 1rem; }

.grammar-header { text-align: center; margin-bottom: 1.5rem; }
.grammar-header h2 { margin: 0; color: var(--osage-color); }
.grammar-subtitle { color: var(--dim); font-size: 0.9rem; margin: 0.3rem 0 0; }

.grammar-category { margin-bottom: 1.5rem; }
.grammar-cat-title { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--dim); margin: 0 0 0.5rem; }
.grammar-topic-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.grammar-topic-btn {
  padding: 0.5rem 1rem; border: 1px solid var(--border); border-radius: 0.5rem;
  background: white; cursor: pointer; font-size: 0.9rem; transition: all 0.15s;
}
.grammar-topic-btn:hover { background: #f0f4ff; border-color: var(--osage-color); color: var(--osage-color); }

.grammar-topic-view { line-height: 1.7; }
.grammar-topic-view h2 { color: var(--osage-color); margin: 0.5rem 0; }
.grammar-cat-badge { font-size: 0.75rem; background: #e8daef; color: #6c3483;
  padding: 0.15rem 0.5rem; border-radius: 0.8rem; }
.grammar-topic-content { margin-top: 1rem; }
.grammar-topic-content p { margin: 0.5rem 0; }
.grammar-topic-content h4 { margin: 1rem 0 0.3rem; color: var(--osage-color); }

.grammar-table { width: 100%; border-collapse: collapse; margin: 0.7rem 0; font-size: 0.9rem; }
.grammar-table th { background: #f8f9fa; text-align: left; padding: 0.4rem 0.6rem;
  border-bottom: 2px solid var(--border); font-size: 0.8rem; color: var(--dim); }
.grammar-table td { padding: 0.4rem 0.6rem; border-bottom: 1px solid #f0f0f0; }

.grammar-example {
  padding: 0.5rem 0.7rem; margin: 0.5rem 0; background: #f8f9fa;
  border-radius: 0.4rem; border-left: 3px solid var(--osage-color);
}
.example-breakdown { font-size: 0.8rem; color: var(--dim); margin-top: 0.3rem; }
.grammar-tip { font-size: 0.85rem; color: #6c3483; background: #f5eef8;
  padding: 0.5rem 0.7rem; border-radius: 0.4rem; margin-top: 0.5rem; }

.grammar-try-it { margin-top: 1.5rem; padding: 0.7rem; background: #f0f4ff;
  border-radius: 0.4rem; font-size: 0.9rem; }

/* ── Disambiguation ("Did you mean?") ──────────────────── */
.disambig { margin-top: 0.5rem; }
.disambig-title { font-size: 0.8rem; color: var(--dim); margin: 0 0 0.3rem; }
.disambig-btn {
  display: block; width: 100%; text-align: left;
  padding: 0.4rem 0.6rem; margin-bottom: 0.3rem;
  border: 1px solid var(--border); border-radius: 0.4rem;
  background: #f8f9fa; cursor: pointer; font-size: 0.85rem;
  transition: background 0.15s;
}
.disambig-btn:hover { background: #e8f0fe; border-color: var(--osage-color); }

/* ── Prompt selector ─────────────────────────────────────── */
.prompt-selector {
  padding: 0.4rem 0 0.6rem;
  border-top: 1px dashed var(--rule);
}
.prompt-buttons {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
}
.prompt-btn {
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-dim);
  font-family: inherit;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.prompt-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.prompt-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.prompt-btn-link {
  border-style: dashed;
  color: var(--primary);
}
.prompt-btn-link:hover {
  background: var(--primary-tint);
}

.teacher-input-area {
  display: flex;
  gap: 0.5rem;
  padding: 0.7rem 0 0.4rem;
  border-top: 1px solid var(--rule);
}

.teacher-input-area input {
  flex: 1;
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.teacher-input-area input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(114, 46, 209, 0.12);
}

.teacher-input-area button {
  padding: 0.6rem 1.4rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.12s;
}
.teacher-input-area button:hover { background: var(--primary-dark); }

.conj-table {
  border-collapse: collapse;
  margin: 0.5rem 0;
  font-size: 0.85rem;
  width: 100%;
}
.conj-table th, .conj-table td {
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border);
  text-align: left;
}
.conj-table th { background: #f5f4f0; }

.grammar-note {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: #f9f8f4;
  border-left: 3px solid #c8612d;
  font-size: 0.85rem;
  color: #555;
}

/* help-note is used inside the popup */
.help-note {
  margin-top: 0.4rem;
  font-size: 0.78rem;
  color: var(--dim);
}

/* ── Teacher-Enhanced Translation ─────────────────────────── */

.tr-teacher-answer {
  font-size: 0.95rem;
  line-height: 1.6;
  padding: 0.5rem 0;
}
.tr-teacher-answer .osage-text {
  font-family: 'Noto Sans Osage', 'Gadugi', sans-serif;
  font-size: 1.1em;
}

/* ── Teacher Welcome Suggestions ──────────────────────────── */

.welcome-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
  text-align: center;
}

.suggestion-group {
  margin-bottom: 0.75rem;
}

.suggestion-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #c8612d;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
}

/* ── AI Teacher tab ───────────────────────────────────────── */
#ai-teacher-panel.hidden { display: none; }

.ai-badge-header {
  font-size: 0.65rem;
  background: #e8daef;
  color: #6c3483;
  padding: 0.15rem 0.5rem;
  border-radius: 0.8rem;
  vertical-align: middle;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ai-disclaimer {
  font-size: 0.8rem;
  color: var(--dim);
  margin-top: 0.25rem;
  font-style: italic;
}

.ai-t1-source {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}
.ai-t1-source summary {
  cursor: pointer;
  color: var(--dim);
  font-size: 0.8rem;
}
.t1-source-content {
  margin-top: 0.3rem;
  padding: 0.5rem;
  background: #f8f9fa;
  border-radius: 0.4rem;
  font-family: monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
}

/* ── Course tab ───────────────────────────────────────────── */
#course-panel.hidden { display: none; }
#course-content { max-width: 800px; margin: 0 auto; }

.course-header { text-align: center; margin-bottom: 1.5rem; }
.course-header h2 { margin: 0; color: var(--osage-color); }
.course-subtitle { color: var(--dim); margin: 0.3rem 0 0; font-size: 0.9rem; }

.chapter-list { display: flex; flex-direction: column; gap: 0.5rem; }
.chapter-card {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.8rem 1rem; border: 1px solid var(--border); border-radius: 0.5rem;
  cursor: pointer; transition: background 0.15s;
}
.chapter-card:hover { background: #f0f4ff; }
.chapter-title { font-weight: 600; font-size: 0.95rem; }
.chapter-stats { color: var(--dim); font-size: 0.8rem; margin-top: 0.2rem; }
.chapter-progress { display: flex; align-items: center; gap: 0.5rem; min-width: 100px; }
.prog-bar { width: 60px; height: 6px; background: #e0e0e0; border-radius: 3px; overflow: hidden; }
.prog-fill { height: 100%; background: var(--osage-color); border-radius: 3px; transition: width 0.3s; }
.prog-text { font-size: 0.75rem; color: var(--dim); }

.lesson-header { margin-bottom: 1.5rem; }
.lesson-header h2 { margin: 0.5rem 0; color: var(--osage-color); }
.lesson-nav { color: var(--dim); font-size: 0.85rem; }
.back-btn { background: none; border: 1px solid var(--border); border-radius: 0.4rem;
  padding: 0.3rem 0.7rem; cursor: pointer; font-size: 0.85rem; }
.back-btn:hover { background: #f0f0f0; }

.lesson-section { margin-bottom: 1.5rem; }
.lesson-section h3 { color: var(--osage-color); margin: 0 0 0.5rem; font-size: 1.05rem; }
.section-explanation { line-height: 1.7; font-size: 0.95rem; margin-bottom: 1rem; }

.section-examples { margin: 1rem 0; }
.section-examples h4 { margin: 0 0 0.5rem; font-size: 0.9rem; color: var(--dim); }
.example-item {
  padding: 0.5rem 0.7rem; margin-bottom: 0.4rem;
  background: #f8f9fa; border-radius: 0.4rem; border-left: 3px solid var(--osage-color);
}
.example-item .english-text { font-size: 0.9rem; }

.section-dialogues { margin: 1rem 0; }
.dialogue-turn { padding: 0.4rem 0; border-bottom: 1px solid #f0f0f0; }

.section-exercises { margin: 1rem 0; }
.exercise-item { padding: 0.5rem 0; border-bottom: 1px solid #f0f0f0; font-size: 0.9rem; }

.lesson-buttons { display: flex; gap: 0.5rem; align-items: center; margin-top: 1.5rem;
  padding-top: 1rem; border-top: 1px solid var(--border); }
.lesson-btn { padding: 0.5rem 1rem; border: 1px solid var(--border); border-radius: 0.4rem;
  background: white; cursor: pointer; font-size: 0.9rem; }
.lesson-btn:hover { background: #f0f0f0; }
.lesson-btn.primary { background: var(--osage-color); color: white; border-color: var(--osage-color); }
.lesson-btn.primary:hover { opacity: 0.9; }
.completed-badge { color: #155724; background: #d4edda; padding: 0.3rem 0.8rem;
  border-radius: 0.4rem; font-size: 0.85rem; font-weight: 600; }

.practice-prompt { margin-top: 1.5rem; padding: 1rem; background: #f8f9fa; border-radius: 0.5rem; }
.practice-input-area { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.practice-input-area input { flex: 1; padding: 0.5rem 0.8rem; border: 1px solid var(--border);
  border-radius: 0.4rem; font-size: 0.9rem; }
.practice-input-area button { padding: 0.5rem 1rem; background: var(--osage-color); color: white;
  border: none; border-radius: 0.4rem; cursor: pointer; }
.practice-answer { margin-top: 0.5rem; line-height: 1.6; }
#practice-result { margin-top: 0.5rem; }

/* ── Mobile polish (≤720px) ───────────────────────────────── */

@media (max-width: 720px) {
  /* Horizontal-scrolling tab bar with snap — avoids cramped wrap. */
  nav#tabs {
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    padding: 0 0.4rem;
  }
  nav#tabs::-webkit-scrollbar { display: none; }
  .tab {
    flex: 0 0 auto;
    min-height: 44px; /* touch target */
    padding: 0.55rem 0.9rem;
    font-size: 0.9rem;
    scroll-snap-align: start;
  }

  /* Header — dial down type so it doesn't hog the viewport. */
  header { padding: 0.6rem 0.8rem; }
  header .osage-text { font-size: clamp(1.2rem, 5.5vw, 1.6rem); }
  header h1 { font-size: clamp(1rem, 4.5vw, 1.3rem); }

  /* Translate input/output column on mobile. */
  .translate-container { grid-template-columns: 1fr; gap: 0.8rem; }
  .translate-input-footer { flex-wrap: wrap; gap: 0.4rem; }
  #report-auto-label { margin-left: 0; font-size: 0.78rem; }

  /* Translation result scales with viewport. */
  .tr-main { font-size: clamp(1.3rem, 6vw, 2rem); line-height: 1.2; word-wrap: break-word; }
  .tr-english { font-size: clamp(0.95rem, 3.8vw, 1.1rem); }
  .tr-apa { font-size: clamp(0.85rem, 3.4vw, 1rem); }

  /* Pedagogical chips: stack vertically on narrow screens for legibility. */
  .tr-explain-chips { gap: 0.3rem; }
  .tr-chip {
    width: 100%;
    font-size: 0.82rem;
  }
  .tr-chip-body { padding: 0.35rem 0.6rem; flex: 1 1 auto; }
  .tr-chip-play {
    min-width: 44px;
    padding: 0 0.6rem;
    font-size: 0.95rem;
  }

  /* Gloss table: collapse to stacked cards. */
  .gloss-table,
  .gloss-table tbody,
  .gloss-table tr,
  .gloss-cell {
    display: block;
    width: 100%;
  }
  .gloss-table tr {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    padding: 0.5rem 0.6rem;
    background: #fafaf8;
  }
  .gloss-cell {
    text-align: left;
    border: none;
    padding: 0.15rem 0;
  }
  .gloss-osage { font-size: 1.15rem; }
  .gloss-apa::before { content: "APA: "; color: var(--dim); font-style: normal; }
  .gloss-eng::before { content: "EN: "; color: var(--dim); }
  .gloss-role::before { content: "Role: "; color: var(--dim); font-style: normal; }

  /* Conjugation grid: single column, larger touch area. */
  .conj-grid { grid-template-columns: 1fr; gap: 0.4rem; }
  .conj-form { padding: 0.55rem 0.7rem; font-size: 0.95rem; }

  /* 44px tap targets for small buttons. */
  .translate-btn-small,
  .lesson-btn,
  .clear-chat-btn,
  #load-more-btn {
    min-height: 44px;
    padding-top: 0.55rem;
    padding-bottom: 0.55rem;
  }

  /* Filters wrap cleanly. */
  #search-filters { flex-wrap: wrap; gap: 0.5rem 0.9rem; }
  #search-filters label { min-height: 32px; }
}


/* Morpheme breakdown + gloss-label pop-up (task #8) */
.gloss-label {
  position: relative;
  border-bottom: 1px dotted #9a7bb5;
  cursor: help;
  text-decoration: none;
  font-weight: 600;
  color: #6a4a8a;
  outline: none;
}
/* CSS tooltip bubble — instant + reliable (native title had a slow delay
   that read as "hover does nothing"). Shows the data-tip explanation. */
.gloss-label::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translate(-50%, -6px);
  margin-bottom: 2px;
  padding: 0.3rem 0.5rem;
  background: #2c2340;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.25;
  white-space: nowrap;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease;
  z-index: 40;
  pointer-events: none;
}
.gloss-label:hover::after,
.gloss-label:focus::after {
  opacity: 1;
  visibility: visible;
}

/* Inflection template rendering (task #11) */
.infl-line { margin: 0.1rem 0; }
.infl-cls { color: #6a4a8a; font-weight: 600; }
.infl-stem { font-family: "SF Mono", Menlo, monospace; color: #333; }
.infl-slot {
  display: inline-block;
  width: 0.8em;
  border-bottom: 1.5px solid #6a4a8a;
  margin: 0 0.04em;
  vertical-align: baseline;
}
.infl-legend { font-size: 0.8rem; color: #888; margin-top: 0.2rem; }
.mb-block {
  margin: 0.4rem 0;
  padding: 0.45rem 0.7rem;
  background: #f6f4ef;
  border-left: 3px solid var(--osage-color, #6a4a8a);
  border-radius: 3px;
}
.mb-surface { font-style: italic; color: var(--apa-color, #555); }
.mb-morph { font-family: "SF Mono", Menlo, monospace; color: #444; font-size: 0.92rem; }
.mb-gloss { font-size: 0.9rem; color: #444; margin-top: 0.15rem; }
.mb-eng { color: #333; margin-top: 0.15rem; }
.mb-hint { font-size: 0.8rem; color: #888; margin-top: 0.25rem; }
.mb-ref-link { color: #6a4a8a; text-decoration: underline; margin-left: 0.3rem; }
.mb-ref-link:hover { color: #4a2a6a; }
.mb-src { font-size: 0.8rem; color: #888; font-weight: normal; }
