/* ==========================================================================
   Anthologie de la poésie grecque — Robert Brasillach | Édition Didactique & Philologique
   Marc Frenkel - https://frenkel.fr/ - v1950
   Design System & Interface Responsive (Mac M5/M3, iPad, iPhone)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700&family=EB+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,600&family=Inter:wght@300;400;500;600;700&family=Lora:ital,wght@0,400;0,500;0,600;1,400;1,600&display=swap');

:root {
  /* Thème Vélin Attique (Défaut clair) */
  --bg-primary: #fcf9f2;
  --bg-secondary: #f4eee1;
  --bg-card: #ffffff;
  --bg-sidebar: #f7f2e7;
  --text-main: #231f1d;
  --text-secondary: #655b54;
  --text-muted: #8c827a;
  --accent: #9a5d26;
  --accent-light: #e0b072;
  --accent-soft: rgba(154, 93, 38, 0.11);
  --border: #e2d9c8;
  --border-light: #ece4d7;
  --shadow: 0 4px 20px rgba(70, 50, 30, 0.06);
  --shadow-lg: 0 10px 30px rgba(70, 50, 30, 0.12);

  --font-serif: 'EB Garamond', 'Lora', Georgia, serif;
  --font-title: 'Cinzel', 'EB Garamond', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --reader-max-width: 760px;
  --reader-font-size: 20px;
  --reader-line-height: 1.78;
  --sidebar-width: 420px;
  --header-height: calc(84px + env(safe-area-inset-top, 0px));
  --bottom-bar-height: 60px;
}

[data-theme="dark"] {
  --bg-primary: #141518;
  --bg-secondary: #1a1c20;
  --bg-card: #202227;
  --bg-sidebar: #17181c;
  --text-main: #e8e6e3;
  --text-secondary: #a8a5a0;
  --text-muted: #73706a;
  --accent: #d4a754;
  --accent-light: #fad68a;
  --accent-soft: rgba(212, 167, 84, 0.15);
  --border: #2d3037;
  --border-light: #383c44;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);
}

[data-theme="sepia"] {
  --bg-primary: #f2e8d3;
  --bg-secondary: #e6dbc1;
  --bg-card: #faf3e3;
  --bg-sidebar: #ebe1c8;
  --text-main: #33261a;
  --text-secondary: #6e5c49;
  --text-muted: #8f7c67;
  --accent: #8b5120;
  --accent-light: #c27d42;
  --accent-soft: rgba(139, 81, 32, 0.12);
  --border: #d4c5a9;
  --border-light: #dfd2b9;
  --shadow: 0 4px 20px rgba(80, 50, 20, 0.08);
  --shadow-lg: 0 10px 30px rgba(80, 50, 20, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  transition: background-color 0.25s ease, color 0.25s ease;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Header Bar
   ========================================================================== */
.app-header {
  height: var(--header-height);
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top, 0px)) 24px 10px 24px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-logo {
  font-size: 24px;
  cursor: pointer;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.brand-titles {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding-top: 4px;
}

.brand-titles h1 {
  font-family: var(--font-title);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--text-main);
  line-height: 1.25;
}

.brand-titles .author {
  font-family: var(--font-serif);
  font-size: 13px;
  font-style: italic;
  color: var(--accent);
}

.brand-signature {
  font-family: var(--font-sans);
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.1;
  margin-top: 2px;
}

.brand-signature a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s ease;
}

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

.header-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-primary);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text-main);
  background: var(--accent-soft);
}

.tab-btn.active {
  color: #ffffff;
  background: var(--accent);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

/* ==========================================================================
   Main App Container
   ========================================================================== */
.app-container {
  position: absolute;
  top: var(--header-height);
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  overflow: hidden;
}

.view-panel {
  flex: 1;
  height: 100%;
  display: none;
  overflow: hidden;
  position: relative;
}

.view-panel.active {
  display: flex;
}

/* ==========================================================================
   1. VUE LECTURE & EXÉGÈSE (NOTICE + POÈMES GRECS)
   ========================================================================== */
.reader-workspace {
  display: flex;
  width: 100%;
  height: 100%;
}

.reader-main-column {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  position: relative;
  scroll-behavior: smooth;
  padding: 40px 24px 100px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.reader-content-box {
  width: 100%;
  max-width: var(--reader-max-width);
}

.section-meta-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 22px;
  margin-bottom: 30px;
  text-align: center;
}

.tome-badge {
  display: inline-block;
  padding: 5px 14px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: 20px;
  margin-bottom: 14px;
}

.section-headline {
  font-family: var(--font-title);
  font-size: 25px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 8px;
}

.section-part-label {
  font-family: var(--font-serif);
  font-size: 16.5px;
  font-style: italic;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.section-quick-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--text-muted);
}

.section-quick-stats span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.poem-jump-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 18px;
}

.poem-jump-chip {
  padding: 4px 10px;
  font-size: 11.5px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: var(--font-sans);
}

.poem-jump-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.poem-jump-chip.notice-chip {
  font-weight: 600;
  color: var(--accent);
  border-color: var(--accent-light);
}

/* Notice de Robert Brasillach & Corps Poétique */
.brasillach-text-body {
  font-family: var(--font-serif);
  font-size: var(--reader-font-size);
  line-height: var(--reader-line-height);
  color: var(--text-main);
}

.notice-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 24px 28px;
  margin-bottom: 36px;
  box-shadow: var(--shadow);
}

.notice-box.prose-standalone {
  background: transparent;
  border: none;
  border-left: none;
  padding: 0;
  box-shadow: none;
}

.notice-kicker {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.notice-box p {
  margin-bottom: 1.05em;
  text-align: justify;
  text-justify: inter-word;
}

.notice-box p:last-child {
  margin-bottom: 0;
}

.notice-box p.first-drop::first-letter {
  font-family: var(--font-title);
  float: left;
  font-size: 2.9em;
  line-height: 0.85;
  padding-top: 4px;
  padding-right: 10px;
  color: var(--accent);
  font-weight: 700;
}

/* Bloc Poème */
.poem-block {
  margin-bottom: 40px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border-light);
}

.poem-block:last-child {
  border-bottom: none;
  margin-bottom: 16px;
}

.poem-header {
  margin-bottom: 18px;
  padding-left: 40px;
}

.poem-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.poem-title {
  font-family: var(--font-title);
  font-size: 18.5px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.3px;
}

.poem-ref-badge {
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 6px;
}

.poem-subtitle {
  font-family: var(--font-serif);
  font-size: 15px;
  font-style: italic;
  color: var(--text-secondary);
  margin-top: 4px;
}

.poem-stanza {
  margin-bottom: 1.35em;
}

.poem-verse {
  position: relative;
  padding-left: 40px;
  margin-bottom: 0.18em;
}

.verse-num {
  position: absolute;
  left: 0;
  top: 0.35em;
  width: 28px;
  text-align: right;
  font-family: var(--font-sans);
  font-size: 11px;
  color: var(--text-muted);
  user-select: none;
  opacity: 0.75;
}

.verse-line {
  display: block;
}

.speaker-cue {
  padding-left: 40px;
  margin-top: 1em;
  margin-bottom: 0.35em;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent);
}

.poem-prose {
  padding-left: 40px;
}

.poem-prose p {
  margin-bottom: 0.9em;
  text-align: justify;
}

.poem-attribution {
  padding-left: 40px;
  margin-top: 8px;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.88em;
  color: var(--text-secondary);
  text-align: right;
}

/* Navigation bas de page */
.reader-bottom-nav {
  margin-top: 46px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 16px;
}

.reader-colophon {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 0 10px;
}

.reader-colophon a,
.sidebar-colophon-text a,
.section-colophon a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.reader-colophon a:hover,
.sidebar-colophon-text a:hover,
.section-colophon a:hover {
  text-decoration: underline;
}

.sidebar-colophon-card {
  text-align: center;
  padding: 12px 14px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
}

.sidebar-colophon-text {
  font-family: var(--font-sans);
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.section-colophon {
  margin-top: 40px;
  padding: 24px 0 10px 0;
  text-align: center;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.nav-arrow-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-arrow-btn:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.nav-arrow-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Volet Latéral Exégétique */
.exegese-sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), width 0.3s ease;
  overflow: hidden;
  z-index: 50;
}

.exegese-sidebar.collapsed {
  transform: translateX(100%);
  width: 0;
  border-left: none;
}

.sidebar-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-header h3 {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.exegese-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--accent);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-prose {
  font-size: 13.5px;
  line-height: 1.62;
  color: var(--text-secondary);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tag-badge:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.tag-badge.perso { border-left: 3px solid #3b82f6; }
.tag-badge.theme { border-left: 3px solid #10b981; }
.tag-badge.lieu { border-left: 3px solid #f59e0b; }

.specialiste-quote {
  padding: 12px;
  border-radius: 8px;
  background: var(--accent-soft);
  margin-bottom: 12px;
  border-left: 3px solid var(--accent);
}

.specialiste-quote:last-child { margin-bottom: 0; }

.spec-author {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.spec-text {
  font-family: var(--font-serif);
  font-size: 13.5px;
  color: var(--text-main);
  line-height: 1.5;
}

/* ==========================================================================
   2. VUE SOMMAIRE (72 CHAPITRES / 7 CYCLES)
   ========================================================================== */
.sommaire-view {
  flex-direction: column;
  padding: 24px;
  overflow-y: auto;
  width: 100%;
}

.sommaire-header {
  max-width: 1120px;
  margin: 0 auto 24px auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sommaire-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-bar-wrap {
  position: relative;
  flex: 1;
  min-width: 260px;
}

.search-input-field {
  width: 100%;
  padding: 11px 16px 11px 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

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

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.tome-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tome-pill {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tome-pill:hover, .tome-pill.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
  max-width: 1120px;
  margin: 0 auto;
  width: 100%;
  padding-bottom: 80px;
}

.section-grid-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.section-grid-card.current {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.section-grid-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
}

.sec-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.sec-num-badge {
  font-family: var(--font-title);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--accent);
}

.sec-tome-tag {
  font-size: 11px;
  color: var(--text-muted);
}

.sec-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
  line-height: 1.35;
}

.sec-card-epoque {
  font-size: 11.5px;
  color: var(--accent);
  font-style: italic;
  margin-bottom: 8px;
}

.sec-card-incipit {
  font-family: var(--font-serif);
  font-size: 13.5px;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.48;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sec-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
  padding-top: 10px;
}

/* ==========================================================================
   3. VUE RECHERCHE PLEIN TEXTE
   ========================================================================== */
.recherche-view {
  flex-direction: column;
  padding: 24px;
  overflow-y: auto;
  width: 100%;
}

.search-results-container {
  max-width: 900px;
  margin: 20px auto;
  width: 100%;
  padding-bottom: 80px;
}

.result-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.result-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12.5px;
}

.result-title {
  font-weight: 600;
  color: var(--accent);
}

.result-badge {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: 6px;
}

.result-snippet {
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-main);
}

mark {
  background-color: var(--accent-light);
  color: #000;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 600;
}

/* ==========================================================================
   4. VUE LABORATOIRE PHILOLOGIQUE (CONCORDANCIER & DISTRIBUTION)
   ========================================================================== */
.philologie-view {
  flex-direction: column;
  padding: 24px;
  overflow-y: auto;
  width: 100%;
}

.philo-wrapper {
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
  padding-bottom: 80px;
}

.philo-controls-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.philo-input-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.distribution-chart {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 24px;
}

.chart-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
}

.bar-label {
  width: 195px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  color: var(--text-secondary);
}

.bar-track {
  flex: 1;
  height: 20px;
  background: var(--bg-secondary);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 6px;
  transition: width 0.4s ease;
}

.bar-count {
  width: 45px;
  text-align: right;
  font-weight: 600;
  color: var(--text-main);
}

.kwic-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.kwic-row {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  font-family: var(--font-serif);
  font-size: 14.5px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.kwic-row:hover {
  background: var(--accent-soft);
}

.kwic-meta {
  width: 145px;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 8px;
}

.kwic-left {
  flex: 1;
  text-align: right;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 8px;
}

.kwic-keyword {
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.kwic-right {
  flex: 1;
  text-align: left;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 8px;
}

/* ==========================================================================
   5. VUE WIKI & SPÉCIALISTES
   ========================================================================== */
.wiki-view {
  flex-direction: column;
  padding: 24px;
  overflow-y: auto;
  width: 100%;
}

.wiki-wrapper {
  max-width: 1050px;
  margin: 0 auto;
  width: 100%;
  padding-bottom: 80px;
}

.wiki-nav-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}

.wiki-filter-btn {
  padding: 8px 16px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.wiki-filter-btn.active, .wiki-filter-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.wiki-articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 18px;
}

.wiki-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.wiki-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
}

.wiki-card-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 10px;
}

.wiki-card h3 {
  font-size: 16.5px;
  color: var(--text-main);
  margin-bottom: 8px;
  line-height: 1.35;
}

.wiki-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ==========================================================================
   Modale Wiki
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

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

.modal-window {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 820px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-header h2 {
  font-size: 18px;
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-main);
}

.modal-body h1, .modal-body h2, .modal-body h3 {
  margin: 1.1em 0 0.5em 0;
  color: var(--accent);
  font-family: var(--font-title);
}

.modal-body h1 {
  margin-top: 0;
  font-size: 20px;
}

.modal-body p { margin-bottom: 1em; }
.modal-body ul, .modal-body ol { margin: 0.6em 0 1em 1.4em; }
.modal-body li { margin-bottom: 0.4em; }

.modal-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 10px 16px;
  background: var(--accent-soft);
  margin: 1.1em 0;
  font-style: italic;
  border-radius: 0 8px 8px 0;
}

.wiki-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2em 0;
  font-size: 13.5px;
}

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

.wiki-table th {
  background: var(--bg-secondary);
  color: var(--accent);
  font-weight: 600;
}

/* ==========================================================================
   Barre de navigation mobile
   ========================================================================== */
.mobile-bottom-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-bar-height);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  z-index: 100;
  align-items: center;
  justify-content: space-around;
  padding-bottom: env(safe-area-inset-bottom);
}

.mobile-tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 0;
}

.mobile-tab-btn.active { color: var(--accent); }
.mobile-tab-btn span.icon { font-size: 18px; }

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 1024px) {
  :root { --sidebar-width: 340px; }
}

@media (max-width: 1240px) and (min-width: 821px) {
  .header-tabs { gap: 2px; padding: 2px; }
  .tab-btn { padding: 6px 10px; font-size: 12px; gap: 4px; }
}

@media (max-width: 820px) {
  :root { --header-height: calc(78px + env(safe-area-inset-top, 0px)); }
  .app-header { padding: max(10px, env(safe-area-inset-top, 0px)) 16px 8px 16px; }
  .header-tabs { display: none; }
  .mobile-bottom-bar { display: flex; }
  .app-container { bottom: var(--bottom-bar-height); }

  .exegese-sidebar {
    position: fixed;
    top: 0;
    bottom: var(--bottom-bar-height);
    right: 0;
    width: 85%;
    max-width: 360px;
    box-shadow: -10px 0 30px rgba(0,0,0,0.3);
    transform: translateX(100%);
  }
  .exegese-sidebar.open-mobile { transform: translateX(0); }

  .reader-main-column { padding: 24px 16px 80px 16px; }
  .section-headline { font-size: 20px; }
  .brasillach-text-body { font-size: 17px; line-height: 1.7; }
  .notice-box { padding: 18px 18px; }
  .poem-header, .poem-prose, .poem-attribution, .speaker-cue { padding-left: 28px; }
  .poem-verse { padding-left: 28px; }
  .verse-num { width: 20px; font-size: 10px; }
  .reader-bottom-nav { flex-direction: column; gap: 14px; }
  .bar-label { width: 130px; }
  .kwic-meta { width: 95px; }
}
