/*
 * RusTemple Design System
 * ─────────────────────────────────────────────────────────────
 *
 * Origin: Extracted from x.dance — refined across 17 development sessions.
 *
 * Philosophy:
 * - Mobile-first, responsive via a single breakpoint at 720px
 * - Design tokens in :root for easy per-project overrides
 * - No CSS framework, no build step — just variables and vanilla CSS
 * - Inter font for clean, modern typography
 *
 * To customize for your project, override the :root variables in your own
 * stylesheet loaded after this one, or edit the tokens directly.
 */

/* ── Design tokens ─────────────────────────────────────────── */
:root {
  --bg:        #fafaf8;
  --surface:   #f2f2ee;
  --border:    #e5e5e0;
  --text:      #0f0f0f;
  --muted:     #767676;
  --accent:    #c9a84c;
  --accent-bg: #fdf6e3;
  --danger:    #c0392b;
  --radius:    4px;
  --nav-w:     200px;
  --max-w:     740px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
img { display: block; max-width: 100%; }

/* ── Typography helpers ─────────────────────────────────────── */
.muted     { color: var(--muted); font-size: 13px; }
.label     { font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
             text-transform: uppercase; color: var(--muted); }
.accent    { color: var(--accent); }
.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--surface);
  color: var(--muted);
  letter-spacing: 0.03em;
}

/* ── Layout shell ───────────────────────────────────────────── */
#shell {
  display: flex;
  min-height: 100vh;
}

/* ── Side rail (desktop only) ──────────────────────────────── */
#rail {
  display: none;
}

/* ── Main content ───────────────────────────────────────────── */
#content {
  flex: 1;
  min-width: 0;
  padding: 28px 20px;
}

/* ── Bottom tab bar (mobile) ────────────────────────────────── */
#tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(64px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 50;
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.1s;
}
.tab.active { color: var(--text); }
.tab.active .tab-icon { color: var(--accent); }
.tab:hover { color: var(--text); }
.tab-icon { width: 18px; height: 18px; display: block; }
.tab-icon svg { width: 100%; height: 100%; fill: currentColor; display: block; }

/* ── Section heading ────────────────────────────────────────── */
.section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ── List card (shared component) ────────────────────────────── */
.list-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}
.list-card:last-child { border-bottom: none; }
.list-card:hover .list-card-name { color: var(--accent); }
.list-card-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  overflow: hidden;
  flex-shrink: 0;
}
.list-card-avatar img { width: 100%; height: 100%; object-fit: cover; }
.list-card-avatar.round { border-radius: 50%; }
.list-card-body { min-width: 0; }
.list-card-name { font-size: 15px; font-weight: 600; margin-bottom: 1px; }
.list-card-meta { font-size: 12px; color: var(--muted); }

/* ── Stats bar ──────────────────────────────────────────────── */
.stats-bar {
  display: flex;
  gap: 24px;
  margin-bottom: 32px;
}
.stat { display: flex; flex-direction: column; }
.stat-n    { font-size: 28px; font-weight: 600; line-height: 1; }
.stat-label { font-size: 11px; color: var(--muted); margin-top: 2px;
              font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; }

/* ── Page title ─────────────────────────────────────────────── */
.page-title {
  font-size: clamp(22px, 5vw, 32px);
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 6px;
}
.page-sub {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 28px;
}

/* ── Empty state ────────────────────────────────────────────── */
.empty {
  padding: 48px 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* ── Detail page ────────────────────────────────────────────── */
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-bottom: 20px;
}
.detail-meta .meta-item {
  font-size: 13px;
  color: var(--muted);
}
.detail-meta .meta-item strong { color: var(--text); }
.detail-body {
  font-size: 15px;
  line-height: 1.75;
  color: #333;
  margin: 20px 0;
  max-width: 600px;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  letter-spacing: 0.02em;
  font-family: inherit;
}
.btn:hover { background: #b8943e; color: #fff; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #a93226; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text);
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
}
.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

/* ── Copyable text ─────────────────────────────────────────── */
.copyable {
  cursor: pointer;
  position: relative;
}
.copyable:hover { color: var(--accent); }
.copy-toast {
  position: absolute;
  left: 0;
  top: -22px;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.05em;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.copy-toast.show { opacity: 1; }

/* ── Desktop overrides ──────────────────────────────────────── */
@media (min-width: 720px) {
  body { padding-bottom: 0; }

  #rail {
    display: flex;
    flex-direction: column;
    width: var(--nav-w);
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    padding: 32px 0 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
  }
  .rail-brand {
    padding: 0 24px 32px;
  }
  .rail-brand a {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    display: block;
  }
  .rail-brand a span { color: var(--accent); }
  .rail-nav { flex: 1; }
  .rail-link {
    display: block;
    padding: 9px 24px;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: color 0.12s;
  }
  .rail-link:hover { color: var(--text); }
  .rail-link.active {
    color: var(--text);
    border-left-color: var(--accent);
  }
  .rail-user {
    padding: 12px 24px;
    border-top: 1px solid var(--border);
    font-size: 13px;
  }
  .rail-user-name {
    display: block;
    color: var(--text);
    font-weight: 500;
    font-size: 13px;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .rail-user-logout {
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    font-size: 12px;
    color: var(--muted);
    cursor: pointer;
  }
  .rail-user-logout:hover { color: var(--text); }
  .rail-signin {
    display: block;
    padding: 9px 24px;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
  }
  .rail-signin:hover { color: var(--accent); }

  #tabbar { display: none; }

  #content {
    padding: 40px 48px;
    max-width: calc(var(--max-w) + 96px);
  }
}

/*
 * ── Idish — Design System Extensions ─────────────
 * Extends RusTemple's design system with:
 * - Yiddish theme colors (warm, scholarly)
 * - RTL support for Hebrew-script Yiddish
 * - Typography for Frank Ruhl Libre (Yiddish) + Inter (English)
 * - Lesson-specific components
 */

/* ── Override design tokens ───────────────────────────────── */
:root {
  --accent:     #8b6914;
  --accent-bg:  #fef9ee;
  --bg:         #fdfcfa;
  --surface:    #f5f3ed;
  --border:     #e8e4da;
  --text:       #1a1a1a;
  --muted:      #8c8c8c;
  --muted-dim:  #b5b0a8;
  --surface-dim:#e8e4da;
  --radius:     6px;
  /* Hebrew display font — switched to Rashi via html.script-rashi (toggle). */
  --font-hebrew: 'Frank Ruhl Libre', 'Arial Hebrew', serif;
}

/* Rashi-script mode: swap the Hebrew font and render it at weight 300.
   Noto Rashi Hebrew also carries Latin glyphs, so the family is applied only to
   the Hebrew-text selectors (via --font-hebrew), never to body/Latin. */
html.script-rashi {
  --font-hebrew: 'Noto Rashi Hebrew', 'Frank Ruhl Libre', 'Arial Hebrew', serif;
}
html.script-rashi .yiddish-word,
html.script-rashi .result-item-hebrew,
html.script-rashi .suggestion-hebrew,
html.script-rashi .prompt-yiddish,
html.script-rashi .utt-yiddish {
  font-weight: 300;
}

/* Hebrew elements that otherwise inherit the body (Latin) font. */
.prompt-yiddish,
.utt-yiddish {
  font-family: var(--font-hebrew);
}

/* Floating Rashi-script toggle. */
.rashi-toggle {
  position: fixed;
  right: 16px;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  z-index: 50;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.rashi-toggle:hover { color: var(--text); }
.rashi-toggle.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
@media (min-width: 720px) {
  .rashi-toggle { bottom: 16px; }
}

/* ── Yiddish typography ───────────────────────────────────── */
.yiddish-word {
  font-family: var(--font-hebrew);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.5;
  direction: rtl;
  color: var(--text);
}

.transliteration {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  font-style: italic;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.translation {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  color: var(--text);
  font-weight: 500;
}

.grammar-note {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.5;
}

/* ── RTL support ──────────────────────────────────────────── */
.rtl {
  direction: rtl;
  text-align: right;
}

.ltr {
  direction: ltr;
  text-align: left;
}

/* ── Lesson layout ────────────────────────────────────────── */
.lesson {
  max-width: 680px;
}

.lesson-description {
  font-size: 16px;
  line-height: 1.7;
  color: #444;
  margin-bottom: 32px;
}

.lesson-section {
  margin-bottom: 40px;
}

/* ── Vocabulary cards ─────────────────────────────────────── */
.vocab-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.vocab-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.vocab-card .yiddish-word {
  margin-bottom: 2px;
}

.vocab-card .transliteration {
  margin-bottom: 2px;
}

.vocab-card .translation {
  margin-bottom: 6px;
}

.vocab-card .grammar-note {
  margin-top: 0;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* ── Sentence cards ───────────────────────────────────────── */
.sentence-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sentence-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sentence-card .yiddish-word {
  font-size: 20px;
}

.sentence-card .transliteration {
  font-size: 14px;
}

.sentence-card .translation {
  font-size: 14px;
}

/* ── Grammar blocks ───────────────────────────────────────── */
.grammar-block {
  margin-bottom: 20px;
  padding-left: 16px;
  border-left: 3px solid var(--accent);
}

.grammar-block h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.grammar-block p {
  font-size: 14px;
  line-height: 1.7;
  color: #444;
}

/* ── Cultural note ────────────────────────────────────────── */
.cultural-note {
  background: var(--accent-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.cultural-note p {
  font-size: 14px;
  line-height: 1.7;
  color: #555;
  margin-bottom: 10px;
}

.cultural-note p:last-child {
  margin-bottom: 0;
}

/* ── Module card ─────────────────────────────────────────────── */
.module-card {
  display: block;
  padding: 20px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
}
.module-card:hover { border-color: var(--accent); }
.module-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.module-card-pos { font-size: 20px; font-weight: 600; }
.module-card-name { font-size: 17px; font-weight: 600; flex: 1; }
.module-card-desc { font-size: 14px; color: var(--muted); margin-bottom: 12px; }

/* ── Module item list ────────────────────────────────────────── */
.module-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.module-item-locked { opacity: 0.5; }
.module-item-icon { width: 24px; text-align: center; font-size: 16px; }
.module-item-status-done { color: #1e7e34; }
.module-item-status-open { color: var(--border); }
.module-item-title { font-size: 15px; font-weight: 500; }
.module-item-title a { color: inherit; text-decoration: none; }
.module-item-title a:hover { color: var(--accent); }
.module-item-req { font-size: 11px; color: var(--muted); margin-left: 6px; }
.module-item-type { font-size: 12px; color: var(--muted); }

/* ── Progress bar ────────────────────────────────────────────── */
.progress-bar { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 3px; }
.progress-text { font-size: 12px; color: var(--muted); white-space: nowrap; }
.progress-bar-lg { height: 8px; border-radius: 4px; }

/* ── Breadcrumb ──────────────────────────────────────────────── */
.breadcrumb { margin-bottom: 24px; font-size: 13px; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { color: var(--muted); margin: 0 6px; }
.breadcrumb-current { color: var(--text); }

/* ── Prerequisites box ───────────────────────────────────────── */
.prereq-box {
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
}

/* ── Completion banner ───────────────────────────────────────── */
.completion-banner {
  margin-top: 32px;
  padding: 20px;
  background: #e6f4ea;
  border-radius: var(--radius);
  text-align: center;
}
.completion-banner p { font-weight: 600; color: #1e7e34; }

/* ── Module subheader ────────────────────────────────────────── */
.module-subheader {
  padding: 12px 0 6px;
  border-bottom: 1px solid var(--border);
}

/* ── Home card ───────────────────────────────────────────────── */
.home-card {
  display: block;
  padding: 16px 20px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
}
.home-card:hover { border-color: var(--accent); }
.home-card-inner { display: flex; align-items: center; gap: 10px; }
.home-card-pos { font-size: 18px; font-weight: 600; }
.home-card-name { font-size: 16px; font-weight: 600; }
.home-card-desc { font-size: 13px; color: var(--muted); margin-top: 2px; }
.home-card-count { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── Interactive lesson player ───────────────────────────────────── */
.player {
  max-width: 560px;
}

.player-header {
  margin-bottom: 28px;
}

.player-lesson-title {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 500;
}

.player-progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.player-step-label {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.player-type-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}

details.player-flip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  margin-bottom: 20px;
  text-align: center;
  cursor: pointer;
  user-select: none;
}

details.player-flip summary {
  list-style: none;
  outline: none;
}
details.player-flip summary::-webkit-details-marker { display: none; }
details.player-flip summary::marker { display: none; }

.player-flip-hint {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 16px;
}

details.player-flip[open] .player-flip-hint { display: none; }

.player-flip-back {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.player-flip-back .transliteration { margin-bottom: 4px; }
.player-flip-back .translation { font-size: 17px; font-weight: 600; }
.player-flip-back .grammar-note { margin-top: 10px; }

.player-audio {
  display: block;
  margin: 14px auto 0;
  width: 100%;
  max-width: 280px;
}

.player-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  margin-bottom: 20px;
}

.player-exercise-prompt {
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  line-height: 1.5;
}

.exercise-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.exercise-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  font-size: 15px;
}

.exercise-option:hover { border-color: var(--accent); }

.exercise-option input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.player-result {
  text-align: center;
  padding: 40px 24px;
}

.result-icon {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 8px;
}

.result-correct { color: #1e7e34; }
.result-wrong   { color: var(--danger); }

.result-label {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}

.result-answer {
  font-size: 14px;
  color: var(--muted);
  margin-top: 6px;
}

.player-done {
  text-align: center;
  padding: 48px 24px;
  margin-bottom: 20px;
}

.done-star {
  font-size: 48px;
  color: var(--accent);
  margin-bottom: 12px;
}

.player-done-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.player-next {
  display: block;
  text-align: center;
}

/* ── Admin detail header ─────────────────────────────────────── */
.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}
.detail-actions {   display: flex; gap: 8px; flex-shrink: 0; }

/* ── Dictionary search ─────────────────────────────────────── */
.search-form {
  max-width: 640px;
  margin: 0 auto 24px;
}
.search-box {
  display: flex;
  gap: 8px;
}
.search-input {
  flex: 1;
  font-size: 18px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}
.search-input:focus {
  border-color: var(--accent);
  outline: none;
}
.search-btn {
  padding: 12px 24px;
  font-size: 15px;
}
.search-spinner {
  text-align: center;
  padding: 24px;
  color: var(--muted);
}
.htmx-indicator {
  opacity: 0;
  transition: opacity 200ms;
}
.htmx-request.htmx-indicator {
  opacity: 1;
}
.result-count {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}
.results-section {
  margin-bottom: 24px;
}
.results-heading {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 12px;
}
.result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}
.result-item:last-child { border-bottom: none; }
.result-item:hover .result-item-hebrew { color: var(--accent); }
.result-item-hebrew {
  font-size: 18px;
  font-weight: 500;
  font-family: var(--font-hebrew);
  min-width: 70px;
}
.result-item-transliteration {
  font-size: 13px;
  color: var(--muted);
  min-width: 100px;
}
.result-item-english {
  flex: 1;
  font-size: 14px;
}
.result-item-source {
  font-size: 11px;
  color: var(--muted-dim);
  text-transform: capitalize;
}
.search-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
  font-size: 15px;
}
.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.suggestion {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 8px 16px;
  border-radius: 99px;
  background: var(--accent-bg);
  border: 1px solid var(--border);
  font-size: 14px;
  text-decoration: none;
  color: inherit;
}
.suggestion:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.suggestion:hover .suggestion-english { color: inherit; opacity: 0.8; }
.suggestion-hebrew {
  font-family: var(--font-hebrew);
  font-weight: 500;
}
.suggestion-english {
  font-size: 12px;
  color: inherit;
  opacity: 0.7;
}

/* ── Word detail — bilingual entry ─────────────────────────────
   The word as sound and script: YIVO romanization leftmost and largest
   (center stage), the Hebrew headword in Rashi on the right, meeting across
   a single brass hairline like facing columns of a bilingual dictionary. */
.entry {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 4px 0;
  overflow-x: clip; /* nothing (e.g. the variants table) can push the page wide */
}
.entry-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 30px;
}
.entry-eyebrow {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--accent);
}
.entry-id {
  font-size: 11px;
  color: var(--muted-dim);
  font-family: monospace;
}

/* Facing-scripts hero. Mobile: stacked (romanization above, Rashi below,
   right-aligned). Desktop (>=720px): side by side across a brass rule. */
.entry-hero {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-bottom: 30px;
}
.entry-roman  { min-width: 0; }
.entry-script { min-width: 0; text-align: right; }
.entry-rule { display: none; }

@media (min-width: 720px) {
  .entry-hero { flex-direction: row; align-items: baseline; gap: clamp(20px, 5vw, 44px); }
  .entry-roman  { flex: 1 1 56%; }
  .entry-script { flex: 1 1 44%; }
  .entry-rule { display: block; }
}

.entry-roman-word {
  font-family: 'Frank Ruhl Libre', 'Arial Hebrew', serif;
  font-weight: 400;
  font-size: clamp(40px, 9vw, 78px);
  line-height: 1.0;
  letter-spacing: -0.01em;
  color: var(--text);
  overflow-wrap: anywhere;
}
.entry-hebrew {
  font-family: 'Noto Rashi Hebrew', 'Frank Ruhl Libre', serif; /* Rashi, always */
  font-weight: 300;
  font-size: clamp(34px, 7vw, 60px);
  line-height: 1.15;
  color: var(--text);
  overflow-wrap: anywhere;
}
.entry-label {
  margin-top: 12px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
}
.entry-pron {
  margin-top: 7px;
  font-family: monospace;
  font-size: 13px;
  color: var(--muted-dim);
}
.entry-rule {
  align-self: stretch;
  flex: 0 0 1px;
  min-height: 76px;
  background: linear-gradient(var(--accent), transparent);
  opacity: 0.55;
}

.entry-def {
  font-size: clamp(17px, 2.5vw, 20px);
  line-height: 1.55;
  color: var(--text);
  padding: 22px 0 4px;
  border-top: 1px solid var(--border);
}
.entry-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin: 18px 0 40px;
}
.entry-base { font-size: 13px; color: var(--muted); }
.source-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--surface);
  color: var(--muted);
  text-transform: capitalize;
}

.entry-variants { margin: 0 0 40px; max-width: 100%; }
.variants-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.variant-row td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.variant-script-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  white-space: nowrap;
  width: 4.75rem;
}
.variant-text { font-size: 15px; }
.variant-system-tag {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  width: 30%;
}

/* One orchestrated entrance: the two forms settle toward the gutter. */
@media (prefers-reduced-motion: no-preference) {
  .entry-roman  { animation: entry-in-left  0.5s ease both; }
  .entry-script { animation: entry-in-right 0.5s ease both; }
  @keyframes entry-in-left  { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
  @keyframes entry-in-right { from { opacity: 0; transform: translateX(14px);  } to { opacity: 1; transform: none; } }
}

/* ── Pagination (admin) ────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}
.page-info {
  font-size: 13px;
  color: var(--muted);
}

/* ── Dictionary deep-link in player ────────────────────────── */
.player-dict-link {
  display: inline-block;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}
.player-dict-link:hover { color: var(--accent); }
