/* Wenmi — feuille de style commune. Aucune dépendance hors Google Fonts. */
:root {
  --paper: #f7f3ea;
  --paper-2: #efe8d9;
  --ink: #1f1c17;
  --ink-2: #4b453b;
  --muted: #7a7266;
  --rule: #d8cfbd;
  --accent: #9b2c1f;      /* rouge de sceau */
  --accent-2: #2f5d62;    /* vert-de-gris */
  --doubt: #b7791f;
  --fixed: #3d7a3a;      /* caractère corrigé sur le scan */
  --code-bg: #ebe3d2;
  --shadow: 0 1px 2px rgba(40, 30, 10, .08), 0 6px 24px rgba(40, 30, 10, .06);
  /* Polices système uniquement : aucun téléchargement, lisible partout (y compris en Chine continentale). */
  --latin: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, "Noto Serif", "DejaVu Serif", serif;
  --tc: "Songti TC", "Noto Serif CJK TC", "Source Han Serif TC", "PMingLiU", "MingLiU", serif;
  --sc: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", "NSimSun", serif;
  --jp: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif CJK JP", "Source Han Serif JP", "MS PMincho", serif;
  --serif: var(--latin);
  --cjk: var(--tc);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --measure: 42rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #17150f; --paper-2: #1f1c15; --ink: #ece5d6; --ink-2: #cfc6b3; --muted: #9a917f;
    --rule: #3a352a; --accent: #e07a5f; --accent-2: #7fb7bc; --doubt: #e0b057; --fixed: #8fcf86; --code-bg: #26221a;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 24px rgba(0,0,0,.3);
  }
}
:root[data-theme="dark"] {
  --paper: #17150f; --paper-2: #1f1c15; --ink: #ece5d6; --ink-2: #cfc6b3; --muted: #9a917f;
  --rule: #3a352a; --accent: #e07a5f; --accent-2: #7fb7bc; --doubt: #e0b057; --fixed: #8fcf86; --code-bg: #26221a;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 24px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 1.075rem/1.7 var(--serif); font-feature-settings: "onum", "kern";
}
a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; height: auto; }
.cjk, :lang(zh), :lang(ja) { font-family: var(--cjk); }

/* ---------- en-tête ---------- */
.site-header {
  border-bottom: 1px solid var(--rule); background: var(--paper);
  position: sticky; top: 0; z-index: 14;
}
.site-header .inner {
  max-width: 68rem; margin: 0 auto; padding: .7rem 1rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.brand { font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: .02em; display: flex; align-items: center; gap: .5rem; }
.brand .seal {
  display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 4px;
  background: var(--accent); color: var(--paper); font-family: var(--cjk); font-size: .95rem; line-height: 1;
}
.site-header .menu { margin-left: auto; display: flex; gap: 1.1rem; flex-wrap: wrap; font-size: .95rem; }
.site-header .menu a { color: var(--ink-2); text-decoration: none; }
.site-header .menu a[aria-current="page"], .site-header .menu a:hover { color: var(--accent); }
.theme-toggle {
  border: 1px solid var(--rule); background: transparent; color: var(--ink-2);
  border-radius: 999px; padding: .15rem .6rem; font: inherit; font-size: .85rem; cursor: pointer;
}

/* ---------- mise en page article ---------- */
main { padding: 0 1rem 4rem; }
.article { max-width: var(--measure); margin: 0 auto; }
.article header.lede { padding: 3.2rem 0 1.4rem; border-bottom: 1px solid var(--rule); margin-bottom: 2rem; }
.kicker { font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-2); margin: 0 0 .6rem; }
h1 { font-size: clamp(2rem, 5vw, 2.9rem); line-height: 1.12; margin: 0 0 .9rem; letter-spacing: -.01em; }
h2 { font-size: 1.55rem; line-height: 1.25; margin: 2.8rem 0 .8rem; }
h3 { font-size: 1.15rem; margin: 2rem 0 .5rem; }
.standfirst { font-size: 1.22rem; color: var(--ink-2); margin: 0 0 1rem; }
.byline { font-size: .9rem; color: var(--muted); }
p, ul, ol { margin: 0 0 1.1rem; }
li { margin-bottom: .35rem; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }
blockquote {
  margin: 1.5rem 0; padding: .2rem 0 .2rem 1.2rem; border-left: 3px solid var(--accent);
  color: var(--ink-2); font-style: italic;
}
code, kbd, .mono { font-family: var(--mono); font-size: .88em; }
code { background: var(--code-bg); padding: .08em .35em; border-radius: 3px; }
pre {
  background: var(--code-bg); padding: 1rem 1.1rem; border-radius: 6px; overflow-x: auto;
  font: .85rem/1.55 var(--mono); margin: 0 0 1.3rem;
}
pre code { background: none; padding: 0; }
sup.fn a { text-decoration: none; font-size: .78em; padding: 0 .1em; }

/* encadrés */
.note, .status {
  border: 1px solid var(--rule); background: var(--paper-2); border-radius: 8px;
  padding: 1rem 1.15rem; margin: 1.6rem 0; font-size: .97rem;
}
.note > :last-child, .status > :last-child { margin-bottom: 0; }
.note h4, .status h4 { margin: 0 0 .4rem; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-2); }
.status { border-left: 4px solid var(--accent-2); }
.status.warn { border-left-color: var(--doubt); }

figure { margin: 2rem 0; }
figure.wide { margin-left: calc(50% - min(34rem, 50vw - 1rem)); margin-right: calc(50% - min(34rem, 50vw - 1rem)); }
figure img { display: block; border: 1px solid var(--rule); border-radius: 4px; background: #fff; box-shadow: var(--shadow); }
figcaption { font-size: .88rem; color: var(--muted); margin-top: .6rem; line-height: 1.5; }
.illustration-banner { margin: 0; }
.editorial-illustration { max-width: 42rem; margin: 2rem auto; }
.illustration-banner img, .editorial-illustration img { width: 100%; }
.illustration-banner img { aspect-ratio: 16 / 9; object-fit: cover; }
.editorial-illustration img { object-fit: contain; }

/* tableaux */
.table-wrap { overflow-x: auto; margin: 1.3rem 0 1.6rem; }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { border-bottom: 1px solid var(--rule); padding: .45rem .6rem; text-align: left; vertical-align: top; }
th { font-weight: 600; color: var(--ink-2); background: var(--paper-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* glossaire de personnes */
dl.people { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1rem; margin: 1.2rem 0 1.6rem; }
dl.people dt { font-weight: 600; }
dl.people dt .cjk { color: var(--accent); font-weight: 400; margin-left: .3rem; }
dl.people dd { margin: 0; color: var(--ink-2); }
@media (max-width: 560px) { dl.people { grid-template-columns: 1fr; } dl.people dd { margin-bottom: .6rem; } }

/* chronologie */
ol.timeline { list-style: none; padding: 0; margin: 1.4rem 0 2rem; border-left: 2px solid var(--rule); }
ol.timeline li { position: relative; padding: 0 0 1rem 1.3rem; margin: 0; }
ol.timeline li::before {
  content: ""; position: absolute; left: -7px; top: .55rem; width: 12px; height: 12px;
  border-radius: 50%; background: var(--paper); border: 2px solid var(--accent-2);
}
ol.timeline li.key::before { background: var(--accent); border-color: var(--accent); }
ol.timeline time { display: block; font-size: .82rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* grille G0 */
.grid-g0 { font-family: var(--mono); font-size: .82rem; }
.grid-g0 th, .grid-g0 td { text-align: center; padding: .3rem .4rem; }
.grid-g0 tbody th { background: var(--paper-2); }
.grid-g0 tr.odd td { background: color-mix(in srgb, var(--accent-2) 8%, transparent); }
.grid-g0 td.hit { background: var(--accent) !important; color: var(--paper); font-weight: 700; }

/* décodeur interactif */
.decoder { border: 1px solid var(--rule); border-radius: 10px; padding: 1rem; background: var(--paper-2); margin: 1.6rem 0; }
.decoder .controls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .8rem; }
.decoder select, .decoder button {
  font: inherit; font-size: .92rem; padding: .3rem .6rem; border-radius: 6px;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink);
}
.decoder button { cursor: pointer; }
.decoder .cipher { font-family: var(--mono); font-size: .95rem; word-break: break-all; line-height: 1.9; margin: .3rem 0 .8rem; }
.decoder .cipher span { padding: 0 1px; border-radius: 2px; }
.decoder .cipher span.on { background: var(--accent); color: var(--paper); }
.tokens { display: flex; flex-wrap: wrap; gap: .35rem; }
.token {
  display: grid; grid-template-rows: auto auto auto; text-align: center; min-width: 3.6rem;
  border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); padding: .25rem .3rem;
  cursor: pointer; transition: border-color .15s;
}
.token:hover, .token.on { border-color: var(--accent); }
.token .u { font: .78rem var(--mono); color: var(--muted); }
.token .c { font: .8rem var(--mono); color: var(--accent-2); }
.token .h { font: 1.35rem/1.3 var(--cjk); }
.token.doubt .h { color: var(--doubt); }
.token.doubt { border-style: dashed; }
.decoder .meta { font-size: .9rem; color: var(--ink-2); margin-top: .9rem; }
.legend { font-size: .82rem; color: var(--muted); margin-top: .5rem; }

/* pipeline */
.pipeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: .5rem; margin: 1.5rem 0; counter-reset: step; }
.pipeline div {
  border: 1px solid var(--rule); border-radius: 8px; padding: .7rem .7rem .6rem; background: var(--paper-2);
  font-size: .88rem; line-height: 1.4; position: relative;
}
.pipeline div::before { counter-increment: step; content: counter(step); display: block; font-size: .75rem; color: var(--accent); font-weight: 700; margin-bottom: .2rem; }
.pipeline b { display: block; font: 1.05rem var(--mono); color: var(--ink); margin: .2rem 0; word-break: break-all; }

/* sources */
ol.sources { padding-left: 1.4rem; font-size: .95rem; }
ol.sources li { margin-bottom: .7rem; }
ol.sources li:target { background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 4px; }
.credit {
  border: 1px solid var(--rule); border-left: 4px solid var(--accent); border-radius: 8px;
  padding: 1rem 1.2rem; background: var(--paper-2); margin: 1.5rem 0;
}

/* accueil */
.hero { max-width: 68rem; margin: 0 auto; padding: 3.5rem 0 2rem; display: grid; grid-template-columns: 1.1fr 1fr; gap: 2.5rem; align-items: center; }
.hero h1 { font-size: clamp(2.2rem, 5.5vw, 3.4rem); }
.hero .big-cjk { font: 400 clamp(3rem, 9vw, 5.5rem)/1 var(--cjk); color: var(--accent); margin: 0 0 .6rem; }
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; padding-top: 2rem; } }
.cards { max-width: 68rem; margin: 1rem auto 3rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1.2rem; }
.card {
  display: block; text-decoration: none; color: var(--ink); background: var(--paper-2);
  border: 1px solid var(--rule); border-radius: 12px; padding: 1.5rem 1.4rem; box-shadow: var(--shadow);
  transition: transform .15s, border-color .15s;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card .kicker { margin-bottom: .4rem; }
.card h2 { margin: 0 0 .6rem; font-size: 1.4rem; }
.card p { color: var(--ink-2); margin: 0 0 .8rem; font-size: .98rem; }
.card .more { color: var(--accent); font-size: .92rem; }
.facts { max-width: 68rem; margin: 0 auto 3rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem; }
.fact { border-top: 2px solid var(--accent-2); padding-top: .6rem; }
.fact b { display: block; font-size: 1.8rem; line-height: 1.1; font-variant-numeric: lining-nums; }
.fact span { font-size: .9rem; color: var(--ink-2); }

.site-footer { border-top: 1px solid var(--rule); padding: 1.6rem 1rem 2.5rem; font-size: .85rem; color: var(--muted); }
.site-footer .inner { max-width: 68rem; margin: 0 auto; }

.toc { font-size: .93rem; border: 1px solid var(--rule); border-radius: 8px; padding: .8rem 1.1rem; margin: 0 0 2rem; background: var(--paper-2); }
.toc ol { margin: .3rem 0 0; padding-left: 1.2rem; }
.toc li { margin: .15rem 0; }

@media print {
  .site-header, .theme-toggle, .decoder .controls { display: none; }
  body { background: #fff; color: #000; }
}

/* ---------- langues ---------- */
html:lang(zh-Hans) body { font-family: Charter, Georgia, var(--sc); line-height: 1.85; }
html:lang(zh-Hant) body { font-family: Charter, Georgia, var(--tc); line-height: 1.85; }
html:lang(ja) body { font-family: Charter, Georgia, var(--jp); line-height: 1.85; }
:lang(zh-Hans) { font-family: var(--sc); }
:lang(ja) { font-family: var(--jp); }
html:lang(zh-Hans) .standfirst, html:lang(zh-Hant) .standfirst, html:lang(ja) .standfirst { font-size: 1.12rem; }
html:lang(zh-Hans) blockquote, html:lang(zh-Hant) blockquote, html:lang(ja) blockquote { font-style: normal; }
.lang-switch { position: relative; }
.lang-switch details { position: relative; }
.lang-switch summary {
  list-style: none; display: inline-flex; align-items: center; gap: .3rem; cursor: pointer; color: var(--ink-2);
  font-size: .78rem; line-height: 1; padding: .3rem .45rem; border-radius: 6px; border: 1px solid var(--rule);
}
.lang-switch summary::-webkit-details-marker { display: none; }
.lang-switch summary::after { content: ""; width: .32em; height: .32em; margin-left: .1rem; border: solid currentColor;
  border-width: 0 1.5px 1.5px 0; transform: translateY(-.12em) rotate(45deg); opacity: .7; }
.lang-switch summary:hover, .lang-switch details[open] summary { border-color: var(--accent); color: var(--accent); }
.lang-switch ul { position: absolute; right: 0; top: calc(100% + .35rem); z-index: 20; list-style: none; margin: 0; padding: .3rem;
  min-width: 10rem; background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; box-shadow: var(--shadow); }
.lang-switch li a {
  display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink-2);
  font-size: .9rem; line-height: 1.2; padding: .4rem .55rem; border-radius: 5px;
}
.flag { width: 1.35em; height: 1em; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px var(--rule); vertical-align: -.15em; flex: none; }
.lang-switch li a:hover { background: var(--paper-2); color: var(--ink); }
.lang-switch li a[aria-current="true"] { color: var(--accent); background: var(--paper-2); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- information non confirmée ---------- */
mark.unc {
  background: none; color: inherit; text-decoration: underline dotted var(--doubt) 1.5px; text-underline-offset: .22em;
}
mark.unc::after {
  content: "non confirmé"; font: 600 .62rem/1 var(--mono); letter-spacing: .03em; text-transform: uppercase;
  color: var(--doubt); border: 1px solid var(--doubt); border-radius: 3px; padding: .08rem .25rem;
  margin-left: .3rem; vertical-align: .18em; white-space: nowrap; text-decoration: none; display: inline-block;
}
:lang(en) mark.unc::after { content: "unconfirmed"; }
:lang(zh-Hans) mark.unc::after { content: "未经证实"; font-family: inherit; }
:lang(zh-Hant) mark.unc::after { content: "未經證實"; font-family: inherit; }
:lang(ja) mark.unc::after { content: "未確認"; font-family: inherit; }
.legend-unc { font-size: .9rem; color: var(--ink-2); }

/* ---------- page de choix de langue ---------- */
.chooser { max-width: 40rem; margin: 0 auto; padding: 5rem 1rem; text-align: center; }
.chooser .big-cjk { font: 400 5rem/1 var(--cjk); color: var(--accent); margin: 0 0 1rem; }
.chooser ul { list-style: none; padding: 0; display: grid; gap: .6rem; margin: 2rem auto; max-width: 20rem; }
.chooser a { display: block; padding: .7rem 1rem; border: 1px solid var(--rule); border-radius: 10px; text-decoration: none; color: var(--ink); background: var(--paper-2); }
.chooser a:hover { border-color: var(--accent); }

/* ancres sous l'en-tête fixe */
[id] { scroll-margin-top: 5rem; }
@media (max-width: 600px) {
  .site-header .menu { order: 3; width: 100%; margin-left: 0; gap: .9rem; font-size: .9rem; }
  .site-header .lang-switch { margin-left: auto; }
  .site-header { position: static; }
}

/* grille de la clé affichée dans le décodeur */
.decoder .dec-grid { margin-top: .9rem; max-width: 24rem; }
.decoder .dec-grid .grid-g0 { font-size: .74rem; }
.decoder .dec-grid .grid-g0 th, .decoder .dec-grid .grid-g0 td { padding: .14rem .3rem; }
.grids-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; align-items: start; }
.grids-pair h4 { margin: 0 0 .3rem; font-size: .85rem; color: var(--accent-2); }

/* le code et les grilles gardent la chasse fixe, même sur les pages en chinois ou en japonais */
pre, code, kbd, .mono, .grid-g0, .token .u, .token .c, .decoder .cipher, .pipeline b { font-family: var(--mono) !important; }

/* page « Télégrammes » */
.corpus-stats { font-size: .95rem; color: var(--ink-2); }
.corpus-toc { font-size: .9rem; border: 1px solid var(--rule); border-radius: 8px; padding: .7rem 1rem; background: var(--paper-2); margin: 1rem 0 2rem; display: grid; gap: .35rem; }
.corpus-toc a { margin-right: .35rem; font-family: var(--mono); font-size: .85rem; }
.tg { border-top: 1px solid var(--rule); padding-top: 1rem; margin-top: 2rem; }
.tg h2 { margin: 0 0 .3rem; font-family: var(--mono); font-size: 1.3rem; }
.tg h2 small, .tg h3 small { font-family: var(--serif); font-weight: 400; color: var(--muted); font-size: .9rem; margin-left: .4rem; }
.tg-meta { font-size: .85rem; color: var(--muted); margin: 0 0 .7rem; }
.tg-label { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-2); margin: .6rem 0 .2rem; }
.tg .cipher { font-size: .9rem; line-height: 1.8; word-break: break-word; margin: 0 0 .7rem; }
.token.confirmed { border-style: dotted; border-color: var(--accent-2); }
.token.confirmed .h { color: var(--accent-2); }
.token.illegible .h { color: var(--muted); }
.token.illegible { border-style: dashed; opacity: .7; }
/* télégrammes à condensateur : caractère corrigé ou rétabli sur le scan */
.token.fixed { box-shadow: inset 0 -3px 0 var(--fixed); }
.fixed-sample { text-decoration: underline 3px var(--fixed); text-underline-offset: .25em; }
.tg-group { border-top: 3px double var(--rule); padding-top: 1.2rem; }
.tg .tokens .token { cursor: default; }
.tg-doubts { margin: .8rem 0 0; font-size: .9rem; }
.tg-doubts summary { cursor: pointer; color: var(--accent); }
.tg-doubts ul { margin: .5rem 0 0; padding-left: 1.1rem; }
.tg-doubts li { margin-bottom: .4rem; }
.tg-doubts li.expected { list-style: '✓ '; }
.tg-doubts .alt { white-space: nowrap; }
.tg-doubts .alt small, .tg-doubts .path { color: var(--muted); font-size: .8rem; }
.legend-box { display: flex; flex-wrap: wrap; gap: .6rem 1.2rem; font-size: .85rem; margin: .8rem 0; }
.legend-box span.token { display: inline-grid; min-width: 2.6rem; padding: .1rem .3rem; }

/* médias */
figure.media video { display: block; width: 100%; height: auto; border-radius: 6px; background: #000; box-shadow: var(--shadow); }
.portraits { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: .8rem; margin: 1rem 0 .4rem; }
.portraits figure { margin: 0; }
.portraits img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; object-position: top; border-radius: 4px; filter: sepia(.15); }
.portraits figcaption { font-size: .8rem; margin-top: .3rem; }

/* version lisible proposée */
.readable { font-size: 1.25rem; line-height: 2; margin: .2rem 0 .3rem; }
/* Le décodage brut des inédits peut contenir une longue suite de codes illisibles. */
#inedits .readable, #inedits .tg-alignment { overflow-wrap: anywhere; }
.readable .prop, .tg-props .prop { border-radius: 3px; padding: 0 .08em; cursor: help; }
.prop-P { background: color-mix(in srgb, var(--accent-2) 18%, transparent); box-shadow: inset 0 -2px 0 var(--accent-2); }
.prop-Q { background: color-mix(in srgb, var(--doubt) 14%, transparent); box-shadow: inset 0 -2px 0 var(--doubt); text-decoration: underline dotted var(--doubt); }
.readable .unres { color: var(--doubt); border-bottom: 1px dashed var(--doubt); cursor: help; }
.tg-score { font-size: .82rem; color: var(--muted); margin: 0 0 .5rem; }
.tg-props { font-size: .88rem; margin: .3rem 0 .6rem; }
.tg-props summary { cursor: pointer; color: var(--accent-2); }
.tg-props ul { padding-left: 1.1rem; margin: .4rem 0 0; }
.tg-props li { margin-bottom: .35rem; }
.tg-props .lvl { font-weight: 600; }
.img-state { font-size: .78rem; padding: .05rem .35rem; border-radius: 3px; border: 1px solid var(--rule); white-space: nowrap; }
.img-confirmée { border-color: var(--accent-2); color: var(--accent-2); }
.img-maintenue { border-color: var(--doubt); color: var(--doubt); }
.img-attente, .img-témoin { color: var(--muted); }
.img-divergente { border-style: dashed; color: var(--muted); }

/* fiche de télégramme : formulaire JACAR + mini-carte */
.tg-fiche { display: grid; grid-template-columns: minmax(0, 13rem) minmax(0, 1fr); gap: 1rem; align-items: start; margin: .8rem 0 1rem; }
.tg-scan img { display: block; width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 4px; background: #fff; box-shadow: var(--shadow); }
.tg-map { display: block; width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 4px; }
.tg-keys { margin: .6rem 0 .3rem; font-size: 1.05rem; }
.tg-keys .tg-label { display: block; margin-bottom: .1rem; }
.tg-credit { font-size: .8rem; color: var(--muted); margin: 0; }
@media (max-width: 560px) { .tg-fiche { grid-template-columns: 1fr; } .tg-scan img { max-width: 16rem; } }

/* page « 1916 relu » : colonnes chinoises du tableau des corrections */
table.rel td:nth-child(2), table.rel td:nth-child(3) { min-width: 7.5rem; }
table.rel td:first-child { min-width: 9rem; font-size: .88rem; color: var(--ink-2); }
table.rel td:last-child { min-width: 14rem; }

/* télégrammes de juin 1917 : lecture mot par mot et pistes */
.tblwrap { overflow-x: auto; margin: .4rem 0 1rem; }
table.y1917 { font-size: .9rem; border-collapse: collapse; width: 100%; }
table.y1917 th, table.y1917 td { text-align: left; vertical-align: top; padding: .3rem .5rem; border-bottom: 1px solid var(--rule); }
table.y1917 td:first-child { white-space: nowrap; color: var(--muted); }
table.y1917 td:nth-child(2) { white-space: nowrap; }
table.y1917.pistes td:first-child { color: var(--ink); font-weight: 600; white-space: normal; min-width: 8rem; }
table.y1917.pistes td:nth-child(2) { white-space: normal; }
table.y1917.pistes td:last-child { min-width: 7rem; }
table.y1917.inv td:nth-child(2) { white-space: normal; color: var(--muted); }
table.y1917.inv td:nth-child(3), table.y1917.inv td:nth-child(4) { white-space: nowrap; }
table.y1917.inv b { color: var(--accent, inherit); }
#t1917 h3 small { font-weight: normal; color: var(--muted); }

/* astérisque du titre d'accueil : Wenmi de 1916, pas de 1917 */
h1 a.star { color: var(--accent); text-decoration: none; font-size: .7em; vertical-align: super; margin-left: .1em; }
.hero-note { font-size: .9rem; color: var(--muted); border-left: 3px solid var(--accent); padding: .2rem 0 .2rem .7rem; margin: .8rem 0; }
.hero-note .star { color: var(--accent); font-weight: bold; }

/* ---------- sommaire flottant ---------- */
.ftoc { font-size: .86rem; line-height: 1.35; }
.ftoc-btn { position: fixed; right: 1rem; bottom: 1rem; z-index: 12; font: inherit; font-size: .9rem; color: var(--ink);
  background: var(--paper); border: 1px solid var(--rule); border-radius: 999px; padding: .5rem 1rem; box-shadow: var(--shadow); cursor: pointer; }
.ftoc-btn:hover, .ftoc.open .ftoc-btn { border-color: var(--accent); color: var(--accent); }
.ftoc-panel { display: none; position: fixed; right: 1rem; bottom: 4.2rem; z-index: 12; width: min(22rem, calc(100vw - 2rem)); max-height: 65vh;
  overflow-y: auto; background: var(--paper); border: 1px solid var(--rule); border-radius: 10px; box-shadow: var(--shadow); padding: .7rem .5rem; }
.ftoc.open .ftoc-panel { display: block; }
.ftoc-title { margin: 0 .5rem .4rem; font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-2); }
.ftoc ul { list-style: none; margin: 0; padding: 0; }
.ftoc a { display: block; padding: .28rem .5rem; color: var(--ink-2); text-decoration: none; border-left: 2px solid transparent; }
.ftoc a small { color: var(--muted); }
.ftoc a:hover { color: var(--accent); }
.ftoc a.on { color: var(--accent); border-left-color: var(--accent); background: var(--paper-2); }
@media (min-width: 72rem) {
  .ftoc-btn { display: none; }
  .ftoc-panel { display: block; top: calc(var(--head-h, 3.5rem) + 1.6rem); bottom: auto; right: auto; left: calc(50% + var(--measure) / 2 + 2rem);
    width: min(16rem, calc(50% - var(--measure) / 2 - 3rem)); max-height: calc(100vh - var(--head-h, 3.5rem) - 3rem); background: transparent;
    border: 0; border-left: 1px solid var(--rule); border-radius: 0; box-shadow: none; padding: 0 0 0 .4rem; transition: opacity .2s; }
  body.ftoc-hide .ftoc-panel, body.ftoc-foot .ftoc-panel { opacity: 0; pointer-events: none; }
}
/* le bouton flottant ne masque pas la dernière ligne du pied de page */
body.has-ftoc .site-footer { padding-bottom: 4.5rem; }
@media print { .ftoc { display: none; } }

/* page Rosamonde : traduction sous le texte anglais déchiffré */
.tr-line { display: block; color: var(--muted); font-size: .9em; margin-top: .25rem; font-style: normal; }
/* accueil : bloc « à la une » */
.hero.feature { border-bottom: 1px solid var(--rule); padding-bottom: 2.5rem; margin-bottom: 1rem; }
.feature-title { font-size: clamp(2rem, 5vw, 3.1rem); margin: .2rem 0 .9rem; line-height: 1.1; }
/* décodeur : le menu des télégrammes ne doit pas élargir la page sur mobile */
.decoder label { max-width: 100%; }
.decoder select { max-width: 100%; }
/* expéditeur / destinataire de chaque télégramme (persons.py) */
.tg-who { font-size: .9rem; margin: -.3rem 0 .8rem; line-height: 1.55; }
.tg-who .who-k { display: inline-block; min-width: 7.5em; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-2); }
.tg-who small { color: var(--muted); font-size: .85em; }
td .who { display: inline-block; margin-top: .2rem; font-size: .85em; color: var(--accent-2); }
/* note explicative sous une ligne de table (ex. qui est Yung) */
.tr-note { display: block; margin-top: .35rem; padding-left: .6em; border-left: 2px solid var(--rule); font-size: .82em; color: var(--muted); font-style: normal; }

/* Source-linked reading aids: native text reflows instead of shrinking a bitmap. */
.reading-visual { margin: 2.8rem 0; }
#reperes-1915-1917 { max-width: 68rem; margin: 2.8rem auto; }
.reading-visual > h2, .reading-visual > h3 { margin-top: 0; }
.visual-caption { color: var(--muted); font-size: .92rem; line-height: 1.6; }
.reading-timeline { list-style: none; padding: 0; margin: 1.7rem 0; }
.reading-timeline li { display: grid; grid-template-columns: 10.5rem minmax(0, 1fr); gap: 1.3rem;
  border-left: 2px solid var(--rule); padding: .7rem 0 1.2rem 1.2rem; position: relative; }
.reading-timeline li::before { content: ''; position: absolute; width: .6rem; height: .6rem;
  background: var(--accent-2); border-radius: 50%; left: -.36rem; top: 1.1rem; }
.reading-timeline time { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: .92rem; }
.evidence-label { display: block; font-size: .76rem; letter-spacing: .05em; color: var(--muted); margin-bottom: .3rem; }
.cipher-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem;
  list-style: none; padding: 0; margin: 1.8rem 0; }
.cipher-comparison > li { padding: 1rem; border-top: 2px solid var(--accent-2); background: var(--paper-2); min-width: 0; }
.cipher-comparison h3 { font-size: 1.12rem; margin: 0 0 .9rem; }
.cipher-route { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-size: .94rem; }
.cipher-example { font-size: 1.1rem; margin: .9rem 0; overflow-wrap: anywhere; }
.evidence-path { list-style: none; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.2rem; }
.evidence-path > li { display: grid; grid-template-columns: 10rem minmax(0, 1fr); column-gap: 1rem;
  min-width: 0; padding: 1rem; border-top: 2px solid var(--accent-2); background: var(--paper-2); }
.evidence-path h4 { margin: 0 0 .8rem; font-size: 1rem; letter-spacing: 0; text-transform: none; }
.evidence-path > li > h4 { grid-column: 1; grid-row: 1 / span 2; }
.evidence-path > li > a, .evidence-path > li > pre, .evidence-path > li > p { grid-column: 2; }
.evidence-path img { width: 100%; height: auto; border: 1px solid var(--rule); }
.evidence-path .evidence-word { white-space: pre-wrap; overflow-wrap: anywhere; overflow: visible; font-size: 1rem;
  padding: .6rem 0; background: transparent; border: 0; line-height: 1.9; }
.article-cover { display: block; width: 100%; height: 9rem; object-fit: cover; border-radius: 3px; margin-bottom: 1.1rem; }
@media (max-width: 600px) {
  .reading-timeline li { grid-template-columns: minmax(0, 1fr); gap: .4rem; }
  .cipher-comparison, .evidence-path { grid-template-columns: minmax(0, 1fr); }
  .evidence-path > li { grid-template-columns: minmax(0, 1fr); }
  .evidence-path > li > h4 { grid-row: auto; }
  .evidence-path > li > a, .evidence-path > li > pre, .evidence-path > li > p { grid-column: 1; }
}
