/* Code Biblique — feuille de styles
   Palette tirée des matières du sanctuaire (Exode 25:4) :
   lin fin (shesh), bleu tekhelet, pourpre argaman, écarlate (tola'at shani). */
:root {
  --lin: #ECEDE7;
  --lin-2: #E3E4DD;
  --surface: #F7F7F3;
  --encre: #1D1B2C;
  --encre-2: #4C4A5A;
  --encre-3: #75737F;
  --trait: #CBCCC3;
  --trait-2: #DADBD3;
  --tekhelet: #29498A;
  --tekhelet-2: #1E3870;
  --tekhelet-pale: #DCE3F0;
  --argaman: #6E2B5E;
  --argaman-pale: #EEDFEA;
  --shani: #B0282F;
  --shani-pale: #F5DEDC;
  --focus: #29498A;

  --f-he: "Noto Serif Hebrew", "SBL Hebrew", "Ezra SIL", "Times New Roman", serif;
  --f-he-display: "Frank Ruhl Libre", "Noto Serif Hebrew", serif;
  --f-serif: "Frank Ruhl Libre", Georgia, "Times New Roman", serif;
  --f-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-paleo: "Noto Sans Phoenician", sans-serif;

  --s-1: 0.8125rem; --s0: 1rem; --s1: 1.25rem; --s2: 1.5625rem; --s3: 1.953rem; --s4: 2.441rem; --s5: 3.052rem;
  --rail: 13.5rem;
  --radius: 6px;
  color-scheme: light;
}
:root[data-theme="nuit"], :root[data-theme="dark"] {
  --lin: #121827;
  --lin-2: #182035;
  --surface: #1B2338;
  --encre: #E9E7DE;
  --encre-2: #B9B8C2;
  --encre-3: #8D8C99;
  --trait: #2F3A55;
  --trait-2: #263049;
  --tekhelet: #93ADE6;
  --tekhelet-2: #B4C7F0;
  --tekhelet-pale: #23345C;
  --argaman: #D9A2CB;
  --argaman-pale: #4A2643;
  --shani: #EF7F86;
  --shani-pale: #4D2328;
  --focus: #B4C7F0;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--lin); color: var(--encre);
  font: 400 1rem/1.55 var(--f-ui); font-feature-settings: "tnum" 0;
}
a { color: var(--tekhelet); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--tekhelet-2); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
[lang="he"], .he { font-family: var(--f-he); direction: rtl; unicode-bidi: isolate; }
.paleo { font-family: var(--f-paleo); direction: rtl; unicode-bidi: isolate; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--encre-3); }
.small { font-size: var(--s-1); }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: .5rem 1rem; z-index: 50; }
.skip:focus { left: 1rem; }
[hidden] { display: none !important; }

/* ---------- coque ---------- */
.shell { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  border-right: 1px solid var(--trait); padding: 1.25rem 0.75rem 1rem; background: var(--lin);
}
.brand { display: block; text-decoration: none; color: var(--encre); padding: 0 0.6rem 1.25rem; }
.brand-he { display: block; font-family: var(--f-he-display); font-size: 2.1rem; line-height: 1; color: var(--tekhelet); text-align: left; direction: rtl; }
.brand-fr { display: block; font-family: var(--f-serif); font-size: 1.05rem; margin-top: 0.35rem; letter-spacing: 0.01em; }
.nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 0.7rem; padding: 0.5rem 0.6rem; border-radius: var(--radius);
  color: var(--encre-2); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--lin-2); color: var(--encre); }
.nav a.active { background: var(--surface); color: var(--encre); box-shadow: inset 3px 0 0 var(--tekhelet); }
.glyph {
  width: 1.9rem; height: 1.9rem; display: grid; place-items: center; flex: none;
  font-family: var(--f-he-display); font-size: 1.25rem; line-height: 1; color: var(--tekhelet);
  border: 1px solid var(--trait); border-radius: 4px; background: var(--surface);
}
.nav a.active .glyph { background: var(--tekhelet); color: var(--surface); border-color: var(--tekhelet); }
.nav-about { margin-top: 0.75rem; }
.rail-foot { margin-top: auto; padding: 0 0.6rem; }
.theme-toggle { background: none; border: 1px solid var(--trait); border-radius: var(--radius); padding: 0.35rem 0.7rem; cursor: pointer; color: var(--encre-2); font-size: var(--s-1); }
.theme-toggle:hover { color: var(--encre); border-color: var(--encre-3); }

.main { min-width: 0; outline: none; }
.page { max-width: 68rem; margin: 0 auto; padding: 2.25rem clamp(1rem, 4vw, 3rem) 5rem; }
.page-narrow { max-width: 46rem; }

.boot { min-height: 70vh; display: grid; place-content: center; text-align: center; gap: 0.5rem; }
.boot-he { font-family: var(--f-he); font-size: 3.4rem; margin: 0; color: var(--tekhelet); animation: breathe 2.4s ease-in-out infinite; }
.boot-msg { color: var(--encre-3); margin: 0; }
@keyframes breathe { 50% { opacity: 0.45; } }

/* ---------- typographie ---------- */
h1, h2, h3 { font-family: var(--f-serif); font-weight: 500; line-height: 1.2; margin: 0 0 0.6em; letter-spacing: -0.005em; }
h1 { font-size: var(--s4); }
h2 { font-size: var(--s2); margin-top: 2.2rem; }
h3 { font-size: var(--s1); margin-top: 1.6rem; }
p { margin: 0 0 1em; max-width: 68ch; }
.lead { font-family: var(--f-serif); font-size: var(--s1); line-height: 1.5; color: var(--encre-2); max-width: 60ch; }
.prose { font-family: var(--f-serif); font-size: 1.075rem; line-height: 1.65; }
.prose p { max-width: 66ch; }
.kicker { font-size: var(--s-1); color: var(--encre-3); margin: 0 0 0.3rem; }
hr.rule { border: 0; border-top: 1px solid var(--trait); margin: 2rem 0; }

/* ---------- contrôles ---------- */
.field { display: flex; flex-direction: column; gap: 0.3rem; font-size: var(--s-1); color: var(--encre-2); }
.field > span { font-weight: 500; }
input[type="text"], input[type="search"], input[type="number"], select {
  background: var(--surface); border: 1px solid var(--trait); border-radius: var(--radius);
  padding: 0.5rem 0.65rem; font-size: 1rem; color: var(--encre); min-width: 0;
}
input:focus, select:focus { border-color: var(--tekhelet); outline: none; box-shadow: 0 0 0 3px var(--tekhelet-pale); }
input.he-input { font-family: var(--f-he); font-size: 1.35rem; direction: rtl; padding: 0.35rem 0.65rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  background: var(--tekhelet); color: var(--surface); border: 1px solid var(--tekhelet); border-radius: var(--radius);
  padding: 0.5rem 1rem; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--tekhelet-2); color: var(--surface); }
.btn-ghost { background: transparent; color: var(--tekhelet); border-color: var(--trait); }
.btn-ghost:hover { background: var(--surface); color: var(--tekhelet-2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.icon-btn { background: none; border: 0; cursor: pointer; font-size: 1.1rem; color: var(--encre-2); padding: 0.3rem 0.5rem; border-radius: var(--radius); }
.icon-btn:hover { background: var(--lin-2); color: var(--encre); }
.row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
.chk { display: inline-flex; align-items: center; gap: 0.4rem; font-size: var(--s-1); color: var(--encre-2); cursor: pointer; user-select: none; }
.chk input { accent-color: var(--tekhelet); width: 1rem; height: 1rem; }
.seg { display: inline-flex; border: 1px solid var(--trait); border-radius: var(--radius); overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 0.4rem 0.75rem; cursor: pointer; font-size: var(--s-1); color: var(--encre-2); }
.seg button + button { border-left: 1px solid var(--trait); }
.seg button[aria-pressed="true"] { background: var(--tekhelet); color: var(--surface); }

.kbd { display: flex; flex-direction: column; gap: 4px; margin-top: 0.5rem; direction: rtl; }
.kbd-row { display: flex; gap: 4px; flex-wrap: wrap; }
.key {
  min-width: 2.2rem; height: 2.3rem; border: 1px solid var(--trait); border-radius: 4px; background: var(--surface);
  font-family: var(--f-he-display); font-size: 1.25rem; cursor: pointer; color: var(--encre); padding: 0 0.4rem;
}
.key:hover { border-color: var(--tekhelet); color: var(--tekhelet); }
.key-wide { font-family: var(--f-ui); font-size: var(--s-1); min-width: 5rem; direction: ltr; }

/* ---------- accueil ---------- */
.home-search { margin: 1.5rem 0 0.5rem; display: flex; gap: 0.5rem; max-width: 44rem; }
.home-search input { flex: 1; font-size: 1.1rem; padding: 0.7rem 0.9rem; }
.hint { font-size: var(--s-1); color: var(--encre-3); margin-top: 0.4rem; }
.suggest { list-style: none; padding: 0; margin: 0.75rem 0 0; max-width: 44rem; border-top: 1px solid var(--trait); }
.suggest li a { display: grid; grid-template-columns: 7rem 1fr auto; gap: 1rem; align-items: baseline; padding: 0.55rem 0.25rem; border-bottom: 1px solid var(--trait-2); text-decoration: none; color: var(--encre); }
.suggest li a:hover { background: var(--surface); }
.suggest .he { font-size: 1.35rem; text-align: right; }

.word-of-day { margin-top: 3rem; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 2.5rem; align-items: start; }
.wod-word { font-family: var(--f-he); font-size: clamp(4rem, 11vw, 7.5rem); line-height: 1.1; color: var(--encre); margin: 0; text-align: right; }
.wod-meta { text-align: right; }
.entry-points { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0 2rem; margin-top: 3rem; border-top: 1px solid var(--trait); }
.entry-points a { display: grid; grid-template-columns: 2.6rem 1fr; gap: 0.2rem 0.9rem; padding: 1.1rem 0; border-bottom: 1px solid var(--trait-2); text-decoration: none; color: var(--encre); }
.entry-points a:hover strong { color: var(--tekhelet); }
.entry-points .glyph { grid-row: span 2; width: 2.4rem; height: 2.4rem; font-size: 1.5rem; }
.entry-points strong { font-family: var(--f-serif); font-weight: 500; font-size: 1.15rem; }
.entry-points span.d { color: var(--encre-2); font-size: var(--s-1); }

/* ---------- chaîne de lettres (sirtout : les lettres pendent d'une ligne tracée) ---------- */
.chain { display: flex; flex-direction: row; justify-content: flex-start; gap: 0; position: relative; padding-top: 0.9rem; overflow-x: auto; }
.chain::before { content: ""; position: absolute; top: 0.9rem; left: 0; right: 0; border-top: 1px solid var(--tekhelet); opacity: 0.55; }
.tile {
  position: relative; flex: 0 0 auto; width: 8.6rem; padding: 0.4rem 0.75rem 0.9rem; text-align: center;
  border-left: 1px dashed var(--trait); color: var(--encre); text-decoration: none; direction: ltr;
}
.chain .tile:last-child { border-left: 0; }
.chain .tile:first-child { padding-right: 0.5rem; }
.tile-letter { display: block; font-family: var(--f-he-display); font-size: 3.4rem; line-height: 1.05; color: var(--encre); }
.tile-paleo { display: block; font-family: var(--f-paleo); font-size: 1.35rem; color: var(--argaman); line-height: 1.2; }
.tile-name { display: block; font-weight: 600; font-size: 0.9rem; margin-top: 0.2rem; }
.tile-val { display: block; font-variant-numeric: tabular-nums; color: var(--tekhelet); font-weight: 600; font-size: 0.9rem; }
.tile-picto { display: block; font-size: 0.78rem; color: var(--encre-2); margin-top: 0.35rem; line-height: 1.3; }
.tile-sens { display: block; font-family: var(--f-serif); font-size: 0.95rem; color: var(--encre); margin-top: 0.25rem; }
a.tile:hover .tile-letter { color: var(--tekhelet); }
.chain-sum { display: flex; flex-wrap: wrap; gap: 0.35rem 0.5rem; align-items: center; margin-top: 0.9rem; font-family: var(--f-serif); font-size: 1.05rem; }
.chain-sum .k { background: var(--tekhelet-pale); color: var(--tekhelet-2); padding: 0.05rem 0.5rem; border-radius: 3px; }
:root[data-theme="nuit"] .chain-sum .k, :root[data-theme="dark"] .chain-sum .k { color: var(--encre); }
.chain-sum .plus { color: var(--encre-3); }

/* ---------- étude d'un mot ---------- */
.word-head { display: grid; grid-template-columns: 1fr auto; gap: 1rem 2rem; align-items: end; border-bottom: 1px solid var(--trait); padding-bottom: 1.4rem; }
.word-big { font-family: var(--f-he); font-size: clamp(3.4rem, 9vw, 6rem); line-height: 1.1; margin: 0; color: var(--encre); text-align: right; grid-column: 2; grid-row: 1 / span 2; }
.word-gloss { font-family: var(--f-serif); font-size: var(--s3); line-height: 1.2; margin: 0; }
.word-sub { color: var(--encre-2); margin: 0; }
.facts { display: flex; flex-wrap: wrap; gap: 0.4rem 1.6rem; margin: 1rem 0 0; padding: 0; list-style: none; font-size: var(--s-1); color: var(--encre-2); }
.facts b { color: var(--encre); font-weight: 600; }
.section-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0 3rem; }
.def-block { font-family: var(--f-serif); font-size: 1.08rem; line-height: 1.6; }
.def-block em { font-style: normal; color: var(--tekhelet); font-weight: 500; }
.en { color: var(--encre-2); }
.reading { border-left: 3px solid var(--argaman); padding: 0.2rem 0 0.2rem 1rem; margin: 1rem 0; }
.reading h4 { margin: 0 0 0.25rem; font-size: var(--s-1); font-family: var(--f-ui); font-weight: 600; color: var(--argaman); }
.reading p { margin: 0; font-family: var(--f-serif); font-size: 1.05rem; }
.note { font-size: var(--s-1); color: var(--encre-3); max-width: 68ch; }
.gem-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.gem-table td, .gem-table th { padding: 0.45rem 0.4rem; border-bottom: 1px solid var(--trait-2); text-align: left; vertical-align: baseline; }
.gem-table th { font-weight: 500; color: var(--encre-2); }
.gem-table td.v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--tekhelet); white-space: nowrap; }
.gem-table abbr { text-decoration: none; cursor: help; border-bottom: 1px dotted var(--encre-3); }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.5rem 0 0; padding: 0; list-style: none; }
.chips a, .chips span.chip { display: inline-flex; gap: 0.45rem; align-items: baseline; padding: 0.25rem 0.6rem; border: 1px solid var(--trait); border-radius: 999px; text-decoration: none; color: var(--encre); background: var(--surface); font-size: 0.9rem; }
.chips a:hover { border-color: var(--tekhelet); }
.chips .he { font-size: 1.15rem; }
.writings { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.25rem 1.5rem; margin: 0.5rem 0 0; }
.writings dt { font-size: var(--s-1); color: var(--encre-3); }
.writings dd { margin: 0 0 0.8rem; font-size: 1.6rem; text-align: left; }
.writings dd.paleo { font-size: 1.7rem; color: var(--argaman); }
.writings dd.lat { font-family: var(--f-serif); font-size: 1.15rem; }

.bars { list-style: none; margin: 0.5rem 0 0; padding: 0; columns: 2 16rem; column-gap: 2rem; }
.bars li { break-inside: avoid; }
.bars button { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 7.5rem 1fr 2.6rem; gap: 0.6rem; align-items: center; width: 100%; padding: 0.22rem 0.25rem; cursor: pointer; border-radius: 3px; font-size: 0.9rem; }
.bars button:hover, .bars button[aria-expanded="true"] { background: var(--surface); }
.bars button:focus-visible { outline: 2px solid var(--focus); }
.bar { height: 0.55rem; background: var(--tekhelet); border-radius: 0 2px 2px 0; min-width: 2px; }
.bars .c { text-align: right; font-variant-numeric: tabular-nums; color: var(--encre-2); }
.occ-list { list-style: none; padding: 0; margin: 0.75rem 0 0; }
.occ-list li { padding: 0.6rem 0; border-bottom: 1px solid var(--trait-2); display: grid; grid-template-columns: 5.5rem 1fr; gap: 1rem; align-items: baseline; }
.occ-list .he { font-size: 1.3rem; line-height: 1.9; text-align: right; }
.hl { color: var(--shani); font-weight: 600; }
:root[data-theme="nuit"] .hl { color: var(--shani); }

/* ---------- lecteur ---------- */
.reader-bar { position: sticky; top: 0; z-index: 5; background: var(--lin); border-bottom: 1px solid var(--trait); }
.reader-bar-inner { max-width: 68rem; margin: 0 auto; padding: 0.7rem clamp(1rem, 4vw, 3rem); display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: center; }
.reader-bar select { padding: 0.35rem 0.5rem; font-size: 0.95rem; }
.reader-bar .spacer { flex: 1; }
.chapter-title { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.chapter-title h1 { margin: 0; }
.chapter-title .he { font-family: var(--f-he-display); font-size: var(--s3); color: var(--tekhelet); }
.scroll {
  direction: rtl; font-family: var(--f-he); font-size: calc(1.55rem * var(--zoom, 1)); line-height: 2.25;
  text-align: justify; padding: 0.5rem 0;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(2.25em - 1px), var(--trait-2) calc(2.25em - 1px), var(--trait-2) 2.25em);
  background-position: 0 0.35em;
}
.scroll.lines-off { background-image: none; }
.verse { scroll-margin-top: 6rem; }
.verse.target { background: var(--tekhelet-pale); border-radius: 4px; box-shadow: 0 0 0 4px var(--tekhelet-pale); }
.vnum { font-family: var(--f-ui); font-size: 0.5em; color: var(--tekhelet); vertical-align: 0.55em; margin: 0 0.15em 0 0.35em; cursor: pointer; font-weight: 600; direction: ltr; unicode-bidi: isolate; text-decoration: none; }
.w { cursor: pointer; border-radius: 3px; padding: 0 0.02em; transition: background-color 0.12s; }
.w:hover { background: var(--tekhelet-pale); }
.w.sel { background: var(--tekhelet); color: var(--surface); }
.w.found { color: var(--shani); }
.big-letter { font-size: 1.45em; } .small-letter { font-size: 0.65em; } .susp-letter { vertical-align: 0.4em; font-size: 0.8em; }
.qere { font-size: 0.55em; color: var(--argaman); vertical-align: 0.6em; font-family: var(--f-he); margin: 0 0.15em; }
.pmark { font-family: var(--f-he-display); font-size: 0.6em; color: var(--encre-3); margin: 0 0.4em; }
.scroll.para .verse.p-break::after { content: ""; display: block; height: 0.6em; }
/* mode interlinéaire */
.scroll.inter { line-height: 1.5; text-align: right; background-image: none; }
.scroll.inter .verse { display: block; margin-bottom: 1.1rem; }
.scroll.inter .w { display: inline-flex; flex-direction: column; align-items: center; margin: 0 0.25rem 0.45rem; vertical-align: top; padding: 0.15rem 0.25rem; }
.scroll.inter .gl { font-family: var(--f-ui); font-size: 0.42em; color: var(--encre-2); direction: ltr; max-width: 9em; text-align: center; line-height: 1.25; margin-top: 0.15em; }
.scroll.inter .w.sel .gl { color: var(--surface); }
.scroll.inter .sn { font-family: var(--f-ui); font-size: 0.36em; color: var(--tekhelet); direction: ltr; }
.scroll.inter .w.sel .sn { color: var(--surface); }
.chapter-nav { display: flex; justify-content: space-between; margin-top: 2rem; gap: 1rem; }
.verse-info { font-size: var(--s-1); color: var(--encre-2); background: var(--surface); border: 1px solid var(--trait); border-radius: var(--radius); padding: 0.6rem 0.8rem; margin: 0 0 1rem; direction: ltr; font-family: var(--f-ui); }

/* panneau latéral */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(27rem, 100%); background: var(--surface); z-index: 30;
  border-left: 1px solid var(--trait); transform: translateX(105%); transition: transform 0.22s ease; display: flex; flex-direction: column;
  box-shadow: -12px 0 30px -18px rgba(20, 20, 40, 0.35);
}
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 1rem; border-bottom: 1px solid var(--trait); }
.drawer-title { font-family: var(--f-serif); font-size: 1.1rem; }
.drawer-body { overflow-y: auto; padding: 1rem 1.25rem 2rem; }
.scrim { position: fixed; inset: 0; background: rgba(15, 18, 30, 0.25); z-index: 25; }
.dw-word { font-family: var(--f-he); font-size: 2.6rem; text-align: right; margin: 0; line-height: 1.3; }
.dw-tr { text-align: right; font-family: var(--f-serif); color: var(--encre-2); margin: 0 0 1rem; font-size: 1.1rem; }
.dw-parts { list-style: none; padding: 0; margin: 0 0 1rem; border-top: 1px solid var(--trait-2); }
.dw-parts li { padding: 0.5rem 0; border-bottom: 1px solid var(--trait-2); display: grid; grid-template-columns: 3.4rem 1fr; gap: 0.75rem; align-items: baseline; font-size: 0.92rem; }
.dw-parts .he { font-size: 1.3rem; text-align: right; }
.mini-chain { display: flex; flex-direction: row; gap: 0.25rem; flex-wrap: wrap; margin: 0.5rem 0 1rem; }
.mini-chain a { direction: ltr; display: flex; flex-direction: column; align-items: center; min-width: 3rem; padding: 0.3rem 0.35rem; border: 1px solid var(--trait); border-radius: 4px; text-decoration: none; color: var(--encre); background: var(--lin); }
.mini-chain a:hover { border-color: var(--tekhelet); }
.mini-chain .l { font-family: var(--f-he-display); font-size: 1.5rem; line-height: 1.1; }
.mini-chain .v { font-size: 0.72rem; color: var(--tekhelet); font-weight: 600; }
.mini-chain .s { font-size: 0.68rem; color: var(--encre-2); }

/* ---------- lexique ---------- */
.filters { display: grid; grid-template-columns: minmax(14rem, 2fr) repeat(3, minmax(9rem, 1fr)); gap: 0.75rem; align-items: end; }
.alpha { display: flex; flex-wrap: wrap; gap: 3px; margin: 1rem 0 0; direction: rtl; }
.alpha button { width: 2.1rem; height: 2.1rem; border: 1px solid var(--trait); background: var(--surface); border-radius: 4px; cursor: pointer; font-family: var(--f-he-display); font-size: 1.15rem; color: var(--encre); }
.alpha button[aria-pressed="true"] { background: var(--tekhelet); color: var(--surface); border-color: var(--tekhelet); }
.lex-count { margin: 1.25rem 0 0.25rem; font-size: var(--s-1); color: var(--encre-3); }
.lex-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--trait); }
.lex-list li a { display: grid; grid-template-columns: 4.6rem minmax(7rem, 10rem) 1fr auto; gap: 0.25rem 1.25rem; align-items: baseline; padding: 0.6rem 0.25rem; border-bottom: 1px solid var(--trait-2); color: var(--encre); text-decoration: none; }
.lex-list li a:hover { background: var(--surface); }
.lex-list .sn { font-size: var(--s-1); color: var(--tekhelet); font-variant-numeric: tabular-nums; font-weight: 500; }
.lex-list .he { font-size: 1.45rem; text-align: right; }
.lex-list .g { font-family: var(--f-serif); font-size: 1.04rem; }
.lex-list .g small { font-family: var(--f-ui); color: var(--encre-3); font-size: 0.8rem; margin-left: 0.4rem; }
.lex-list .n { font-size: var(--s-1); color: var(--encre-3); font-variant-numeric: tabular-nums; text-align: right; }
.more { margin: 1.25rem 0; }

/* ---------- alphabet ---------- */
.alphabet { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 0; direction: rtl; border-top: 1px solid var(--trait); border-right: 1px solid var(--trait); }
.alphabet a { direction: ltr; display: grid; grid-template-rows: auto auto auto auto; justify-items: center; padding: 1rem 0.5rem 0.9rem; text-decoration: none; color: var(--encre); border-left: 1px solid var(--trait); border-bottom: 1px solid var(--trait); background: var(--surface); }
.alphabet a:hover { background: var(--lin); }
.alphabet .L { font-family: var(--f-he-display); font-size: 3.6rem; line-height: 1.05; }
.alphabet .P { font-family: var(--f-paleo); color: var(--argaman); font-size: 1.3rem; }
.alphabet .N { font-weight: 600; font-size: 0.92rem; }
.alphabet .V { color: var(--tekhelet); font-weight: 600; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.letter-hero { display: grid; grid-template-columns: auto 1fr; gap: 2rem 3rem; align-items: center; border-bottom: 1px solid var(--trait); padding-bottom: 1.5rem; }
.letter-hero .L { font-family: var(--f-he-display); font-size: clamp(7rem, 18vw, 11rem); line-height: 0.95; color: var(--encre); text-align: center; }
.letter-hero .P { font-family: var(--f-paleo); font-size: 3rem; color: var(--argaman); text-align: center; display: block; }
.letter-nav { display: flex; justify-content: space-between; margin: 1.5rem 0; }

/* ---------- codes ELS ---------- */
.panel { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.els-form { display: grid; grid-template-columns: minmax(15rem, 1.4fr) minmax(0, 1fr); gap: 1.25rem 2rem; }
.els-params { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; align-content: start; }
.els-params .full { grid-column: 1 / -1; }
.progress { height: 4px; background: var(--trait-2); border-radius: 2px; overflow: hidden; margin: 1rem 0 0.25rem; }
.progress > i { display: block; height: 100%; width: 0; background: var(--tekhelet); transition: width 0.1s linear; }
.stat-line { display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; margin: 1.25rem 0 0.75rem; font-size: 0.95rem; }
.stat-line b { font-variant-numeric: tabular-nums; }
.results { width: 100%; border-collapse: collapse; font-size: 0.92rem; margin-top: 0.5rem; }
.results th { text-align: left; font-weight: 500; color: var(--encre-2); border-bottom: 1px solid var(--trait); padding: 0.4rem; position: sticky; top: 0; background: var(--lin); }
.results td { border-bottom: 1px solid var(--trait-2); padding: 0.45rem 0.4rem; font-variant-numeric: tabular-nums; }
.results tr.sel td { background: var(--tekhelet-pale); }
.results-wrap { max-height: 26rem; overflow: auto; }
.matrix-wrap { direction: rtl; overflow: auto; margin-top: 0.75rem; border: 1px solid var(--trait); border-radius: var(--radius); background: var(--surface); max-height: 70vh; }
.matrix { border-collapse: collapse; direction: rtl; margin: 0 auto; width: max-content; table-layout: fixed; }
.matrix td { width: 1.85rem; min-width: 1.85rem; height: 1.85rem; text-align: center; font-family: var(--f-he-display); font-size: 1.15rem; color: var(--encre-2); padding: 0; position: relative; }
.matrix td.alt { background: var(--lin); }
.matrix td.t1 { color: var(--surface); }
.matrix td.t1::before { content: ""; position: absolute; inset: 2px; border-radius: 50%; background: var(--tekhelet); z-index: 0; }
.matrix td.t2 { color: var(--surface); }
.matrix td.t2::before { content: ""; position: absolute; inset: 2px; border-radius: 3px; background: var(--argaman); z-index: 0; }
.matrix td.t1.t2::before { background: linear-gradient(135deg, var(--tekhelet) 50%, var(--argaman) 50%); }
.matrix td span { position: relative; z-index: 1; }
.matrix td.rown { font-family: var(--f-ui); font-size: 0.65rem; color: var(--encre-3); width: 3.6rem; min-width: 3.6rem; white-space: nowrap; padding: 0 0.3rem; }
.legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; font-size: var(--s-1); margin-top: 0.6rem; align-items: center; }
.dot { display: inline-block; width: 0.85rem; height: 0.85rem; border-radius: 50%; background: var(--tekhelet); vertical-align: -0.1em; margin-right: 0.35rem; }
.dot.sq { border-radius: 2px; background: var(--argaman); }
.examples { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
.examples button { border: 1px solid var(--trait); background: var(--surface); border-radius: 999px; padding: 0.25rem 0.7rem; cursor: pointer; font-size: 0.85rem; color: var(--encre-2); }
.examples button:hover { border-color: var(--tekhelet); color: var(--tekhelet); }
.warn { border-left: 3px solid var(--shani); background: var(--shani-pale); padding: 0.6rem 0.9rem; border-radius: 0 var(--radius) var(--radius) 0; font-size: 0.92rem; margin: 1rem 0; }
.info { border-left: 3px solid var(--tekhelet); background: var(--tekhelet-pale); padding: 0.6rem 0.9rem; border-radius: 0 var(--radius) var(--radius) 0; font-size: 0.92rem; margin: 1rem 0; max-width: 72ch; }

/* ---------- outils ---------- */
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--trait); margin: 1.25rem 0 1.5rem; flex-wrap: wrap; }
.tabs a { padding: 0.55rem 0.9rem; text-decoration: none; color: var(--encre-2); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs a.active { color: var(--encre); border-bottom-color: var(--tekhelet); }
.freq { display: grid; grid-template-columns: repeat(22, minmax(0, 1fr)); gap: 3px; align-items: end; height: 12rem; direction: rtl; margin-top: 1rem; }
.freq div { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.freq i { display: block; width: 100%; background: var(--tekhelet); border-radius: 2px 2px 0 0; min-height: 2px; }
.freq b { font-family: var(--f-he-display); font-weight: 400; font-size: 1.05rem; margin-top: 0.2rem; }
.freq small { font-size: 0.62rem; color: var(--encre-3); font-variant-numeric: tabular-nums; }
.seq { font-family: var(--f-he-display); direction: rtl; font-size: 1.2rem; line-height: 1.9; word-break: break-all; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--radius); padding: 0.75rem 1rem; max-height: 14rem; overflow: auto; letter-spacing: 0.08em; }
.seq mark { background: var(--tekhelet); color: var(--surface); border-radius: 2px; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td { text-align: left; padding: 0.4rem; border-bottom: 1px solid var(--trait-2); }
.table th { font-weight: 500; color: var(--encre-2); border-bottom-color: var(--trait); }
.table td.r, .table th.r { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .section-grid, .word-of-day, .els-form { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .field:first-child { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 20; flex-direction: row;
    padding: 0.3rem 0.25rem calc(0.3rem + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--trait);
  }
  .brand, .rail-foot, .nav-about { display: none; }
  .nav { flex-direction: row; justify-content: space-around; width: 100%; }
  .nav a { flex-direction: column; gap: 0.15rem; padding: 0.3rem 0.4rem; font-size: 0.68rem; }
  .nav a.active { box-shadow: none; background: transparent; }
  .glyph { width: 1.8rem; height: 1.8rem; font-size: 1.1rem; }
  .main { padding-bottom: 4.5rem; }
  .page { padding-top: 1.5rem; }
  h1 { font-size: var(--s3); }
  .word-head { grid-template-columns: 1fr; }
  .word-big { grid-column: 1; grid-row: auto; }
  .lex-list li a { grid-template-columns: 1fr auto; }
  .lex-list .sn { grid-column: 1; grid-row: 2; }
  .lex-list .he { grid-column: 2; grid-row: 1; }
  .lex-list .g { grid-column: 1; grid-row: 1; }
  .lex-list .n { grid-column: 2; grid-row: 2; }
  .els-params { grid-template-columns: 1fr 1fr; }
  .suggest li a { grid-template-columns: 1fr auto; }
  .suggest li a .muted { display: none; }
  .letter-hero { grid-template-columns: 1fr; }
  .tile { width: 5.4rem; padding: 0.3rem 0.35rem 0.8rem; }
  .tile-letter { font-size: 2.8rem; }
  .tile-picto { font-size: 0.72rem; }
  .tile-sens { font-size: 0.85rem; }
  .bars button { grid-template-columns: 6rem 1fr 2.4rem; }
  .occ-list li { grid-template-columns: 1fr; gap: 0.2rem; }
  .scroll { font-size: calc(1.35rem * var(--zoom, 1)); }
  .drawer { top: auto; height: 78vh; width: 100%; border-left: 0; border-top: 1px solid var(--trait); border-radius: 12px 12px 0 0; transform: translateY(105%); }
  .drawer.open { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .rail, .reader-bar, .drawer, .scrim { display: none !important; }
  .shell { display: block; }
  .scroll { background-image: none; }
}
