/* L'aventure improvisée : un parchemin qui se déroule vers le bas, encre brune et lettrines rouges */
:root {
  --nuit: #24170f;
  --bois: #4a2e1a;
  --bois-clair: #6d4527;
  --papier: #f1e2bf;
  --papier-fonce: #dcc28e;
  --encre: #2b1a10;
  --encre-douce: #5a3f2a;
  --rouge: #8e2b1b;
  --or: #b8862d;
  --vert: #3f5b34;
  --largeur: 680px;
}
* { box-sizing: border-box; }
html { background: var(--nuit); scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100dvh; color: var(--encre);
  font-family: Georgia, 'Times New Roman', serif; font-size: 1.12rem; line-height: 1.62;
  background: radial-gradient(ellipse at top, #3a2516 0%, var(--nuit) 70%) fixed;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }

/* ---------- Rouleau du haut : sceau, Vigueur, écus, son ---------- */
.rouleau {
  position: sticky; top: 0; z-index: 5;
  max-width: calc(var(--largeur) + 40px); margin: 0 auto;
  display: flex; align-items: center; gap: 12px; padding: 8px 14px;
  background: linear-gradient(180deg, var(--bois-clair) 0%, var(--bois) 55%, #33200f 100%);
  border-radius: 0 0 14px 14px; color: var(--papier);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .45);
}
.rouleau[hidden] { display: none; }
.sceau {
  flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #c0442c, #7a1d10 70%); color: #f6d9b0;
  font-size: 1.2rem; box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .18), 0 2px 4px rgba(0, 0, 0, .5);
}
.etat { flex: 1; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .95rem; align-items: center; }
.coeurs { letter-spacing: 1px; color: #e9806a; }
.coeurs .vide { color: rgba(241, 226, 191, .3); }
.son {
  flex: none; width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  background: transparent; border: 1px solid rgba(241, 226, 191, .45); color: var(--papier);
}
.son.coupe { opacity: .45; text-decoration: line-through; }

/* ---------- Le parchemin ---------- */
.parchemin {
  position: relative; max-width: var(--largeur); margin: 0 auto 0; min-height: 100dvh;
  padding: 34px 30px 120px;
  background-color: var(--papier);
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(255, 248, 225, .55), transparent 60%),
    radial-gradient(ellipse at 0% 50%, rgba(140, 95, 40, .28), transparent 22%),
    radial-gradient(ellipse at 100% 50%, rgba(140, 95, 40, .28), transparent 22%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .22 0 0 0 0 .08 0 0 0 .16 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  box-shadow: inset 0 0 60px rgba(110, 70, 25, .45), 0 0 40px rgba(0, 0, 0, .55);
}
.ambiance-tendue .parchemin { background-color: #ead8b4; }
.ambiance-mysterieuse .parchemin { background-color: #e6dcc0; }
.ambiance-melancolique .parchemin { background-color: #ecd9b9; }

/* ---------- Accueil ---------- */
.accueil { text-align: center; padding-top: 6vh; }
.accueil[hidden] { display: none; }
.sur-titre { margin: 0; font-variant: small-caps; letter-spacing: .14em; color: var(--encre-douce); }
.accueil h1 { margin: .2em 0 .1em; font-size: clamp(2.1rem, 8vw, 3.2rem); line-height: 1.1; color: var(--rouge); font-weight: normal; }
.etiquette {
  display: inline-block; margin: 0 0 1.2em; padding: 1px 12px; border-radius: 99px;
  border: 1px solid var(--rouge); color: var(--rouge); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase;
}
.chapeau { max-width: 34em; margin: 0 auto 1.6em; font-style: italic; }
.boutons { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 1.8em; }
.plein, .second {
  min-width: 260px; padding: 12px 22px; border-radius: 10px; cursor: pointer; font-size: 1.05rem;
}
.plein { background: var(--rouge); color: #fbecd2; border: 0; box-shadow: 0 3px 0 #5d1a0f; }
.plein:active { transform: translateY(2px); box-shadow: 0 1px 0 #5d1a0f; }
.second { background: transparent; color: var(--encre); border: 1px solid var(--encre-douce); }
.principe { max-width: 34em; margin: 0 auto 2em; text-align: left; }
.principe summary { cursor: pointer; text-align: center; color: var(--rouge); }
.pied { font-size: .85rem; color: var(--encre-douce); }
.pied a { color: var(--encre-douce); }
.pied-jeu { margin: 3em 0 1em; text-align: center; }
.pied p { margin: .2em 0; }
.pied .pied-version { font-size: 16px; letter-spacing: .08em; opacity: .8; }
.pied .pied-copie { font-size: 13px; }
.pied-jeu[hidden] { display: none; }
.pied .lien { background: none; border: 0; padding: 0; font: inherit; color: var(--encre-douce); text-decoration: underline; cursor: pointer; }
.discord {
  max-width: 30em; margin: 0 auto 2em; padding: 1em 1.2em; text-align: center;
  border: 2px double var(--or); border-radius: 12px; background: rgba(184, 134, 45, .1);
}
.discord p { margin: 0 0 .8em; color: var(--encre-douce); font-size: .95rem; }
.discord .discord-titre { margin-bottom: .4em; font-variant: small-caps; letter-spacing: .1em; color: var(--rouge); font-size: 1.05rem; }
.discord .second { display: inline-block; min-width: 0; text-decoration: none; }

/* ---------- Le récit ---------- */
.chapitre {
  margin: 1.6em 0 .5em; text-align: center; color: var(--rouge);
  font-variant: small-caps; letter-spacing: .08em; font-size: 1.3rem;
}
.chapitre::before, .chapitre::after { content: '❦'; display: inline-block; margin: 0 .6em; color: var(--or); font-size: .9em; }
.chapitre::after { transform: scaleX(-1); }
.scene-titre { margin: .2em 0 .6em; text-align: center; font-style: italic; font-weight: normal; font-size: 1.05rem; color: var(--encre-douce); }
.recit p { margin: 0 0 .8em; text-align: justify; hyphens: auto; }
.recit .lettrine::first-letter {
  float: left; font-size: 3.4em; line-height: .82; margin: .06em .1em 0 0; padding: .04em .08em;
  color: var(--rouge); border: 2px solid var(--or); border-radius: 4px; background: rgba(184, 134, 45, .12);
}
.recit .touche { font-style: italic; color: var(--encre-douce); }
.fait {
  margin: .4em 0 1em; padding-left: 1.1em; position: relative;
  font-style: italic; color: var(--vert);
}
.fait::before { content: '❧'; position: absolute; left: -.1em; }
.notes { margin: -.3em 0 1em; font-size: .88rem; color: var(--encre-douce); font-variant: small-caps; letter-spacing: .03em; }
.mot { opacity: 0; transition: opacity .18s; }
.mot.vu { opacity: 1; }

/* ---------- Illustrations à l'encre et au lavis ---------- */
.illu { margin: .6em auto 1em; max-width: 440px; }
.illu svg {
  display: block; width: 100%; height: auto;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 58%, transparent 80%);
  mask-image: radial-gradient(ellipse at center, #000 58%, transparent 80%);
}
.invite-partage { margin-top: 1.2em; max-width: 30em; text-align: center; }
.invite-partage p { margin: 0 0 .5em; color: var(--encre-douce); font-size: .95rem; font-style: italic; }
.invite-partage .invite-titre { color: var(--rouge); font-size: 1.15rem; font-style: normal; }
.reco {
  margin: 2em auto 0; max-width: 30em; padding: 1em 1.2em; text-align: center;
  border: 2px double var(--or); border-radius: 12px; background: rgba(184, 134, 45, .1);
  box-shadow: inset 0 0 0 4px rgba(251, 236, 210, .5);
}
.reco p { margin: 0; font-size: .95rem; font-style: italic; color: var(--encre-douce); }
.reco .reco-titre { margin-bottom: .4em; font-style: normal; font-variant: small-caps; letter-spacing: .1em; color: var(--rouge); font-size: 1.05rem; }
.reco a { color: var(--rouge); }
.reco p:not(.reco-titre) + p { margin-top: .7em; }
.reco .reco-ligne { font-size: .88rem; }

/* ---------- Dé ---------- */
.lancer { display: flex; align-items: center; justify-content: center; gap: 14px; margin: .4em 0 1em; font-size: .95rem; }
.de {
  width: 46px; height: 46px; padding: 6px; border-radius: 9px; flex: none;
  background: #fbf3df; border: 2px solid var(--encre); box-shadow: 2px 3px 0 rgba(43, 26, 16, .35);
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
}
.de i { width: 8px; height: 8px; margin: auto; border-radius: 50%; background: transparent; }
.de i.on { background: var(--encre); }
.de.roule { animation: rouler .12s linear infinite; }
@keyframes rouler { 50% { transform: rotate(14deg) translateY(-3px); } }
.verdict.ok { color: var(--vert); font-weight: bold; }
.verdict.ko { color: var(--rouge); font-weight: bold; }

/* ---------- Choix ---------- */
.choix { margin-top: 1.2em; }
.choix button.option {
  display: flex; width: 100%; align-items: baseline; gap: 10px; text-align: left;
  margin: 0 0 8px; padding: 10px 6px 10px 1.4em; position: relative; cursor: pointer;
  background: transparent; border: 0; border-bottom: 1px dashed rgba(43, 26, 16, .35);
  font-size: 1.08rem; color: var(--encre);
}
.choix button.option::before { content: '✒'; position: absolute; left: 0; color: var(--rouge); }
.choix button.option:hover:not(:disabled), .choix button.option:focus-visible { background: rgba(142, 43, 27, .07); }
.choix button.option:disabled { opacity: .45; cursor: not-allowed; }
.option .t { flex: 1; text-decoration: underline; text-decoration-color: rgba(142, 43, 27, .45); text-underline-offset: 4px; }
.option .info { flex: none; font-size: .82rem; font-style: italic; color: var(--encre-douce); white-space: nowrap; }
.choix-titre { text-align: center; font-style: italic; color: var(--encre-douce); margin: 0 0 .8em; }

/* cartes de héros */
.heros { display: grid; gap: 12px; }
.heros button {
  text-align: left; cursor: pointer; padding: 14px 16px; border-radius: 12px;
  background: rgba(255, 250, 235, .55); border: 1px solid rgba(43, 26, 16, .3);
}
.heros button:hover, .heros button:focus-visible { border-color: var(--rouge); background: rgba(255, 250, 235, .85); }
.heros strong { display: block; font-size: 1.2rem; color: var(--rouge); font-weight: normal; }
.heros .metier { font-variant: small-caps; color: var(--encre-douce); }
.heros .portrait { display: block; margin: .3em 0; }
.heros .desir { display: block; font-size: .92rem; font-style: italic; }
.qualites { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: .4em; font-size: .85rem; color: var(--encre-douce); }
.qualites b { color: var(--encre); }

/* création de personnage : une fiche encadrée, qui prend forme pendant qu'on la remplit */
.heros > button { display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: start; }
.heros .medaillon { width: 64px; height: 64px; margin-top: 2px; }
.heros .medaillon svg { width: 36px; height: 36px; }
.carte-texte { display: block; min-width: 0; }
.heros .creer { border: 1px dashed var(--rouge); background: radial-gradient(ellipse at 0% 0%, rgba(255, 250, 235, .85), rgba(255, 250, 235, .35) 70%); }
.heros .creer .medaillon { border-color: var(--rouge); box-shadow: 0 0 0 4px rgba(142, 43, 27, .12), inset 0 0 14px rgba(74, 46, 26, .25); }
.separation { display: flex; align-items: center; gap: 10px; margin: 6px 0 0; font-size: .92rem; font-style: italic; color: var(--encre-douce); }
.separation::before, .separation::after { content: ''; flex: 1; border-bottom: 1px solid rgba(43, 26, 16, .25); }
.separation span::before, .separation span::after { content: '❦'; color: var(--or); font-style: normal; margin: 0 .5em; }
.separation span::after { display: inline-block; transform: scaleX(-1); }
.emblemes { display: flex; flex-wrap: wrap; gap: 10px; margin-top: .5em; opacity: .75; }
.emblemes svg { width: 22px; height: 22px; }
.creation { display: grid; gap: 18px; }
.fiche {
  position: relative; padding: 18px 16px 20px;
  border: 1px solid rgba(43, 26, 16, .45); border-radius: 6px;
  outline: 1px solid rgba(184, 134, 45, .55); outline-offset: -6px;
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 250, 235, .7), rgba(255, 250, 235, .25) 70%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .4) inset, 0 6px 18px rgba(74, 46, 26, .18);
}
.fiche::before, .fiche::after {
  content: '❦'; position: absolute; top: -.75em; left: 50%; transform: translateX(-50%);
  padding: 0 .4em; color: var(--or); background: var(--papier); font-size: 1.1rem; line-height: 1.5;
}
.fiche::after { top: auto; bottom: -.75em; transform: translateX(-50%) rotate(180deg); }
.fiche-tete { display: grid; grid-template-columns: 76px 1fr; gap: 14px; align-items: center; padding-bottom: 14px; border-bottom: 1px solid rgba(43, 26, 16, .2); }
.medaillon {
  width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--or); box-shadow: 0 0 0 4px rgba(184, 134, 45, .18), inset 0 0 14px rgba(74, 46, 26, .25);
  background: radial-gradient(circle at 40% 35%, #fbf1d8, #e3cc9b);
}
.medaillon svg { width: 44px; height: 44px; }
.embleme path { fill: none; stroke: var(--encre); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.fiche-id { display: grid; gap: 2px; min-width: 0; }
.fiche-nom { font-size: 1.45rem; font-weight: normal; color: var(--rouge); line-height: 1.2; overflow-wrap: anywhere; }
.fiche-metier { font-variant: small-caps; letter-spacing: .04em; color: var(--encre-douce); }
.fiche-portrait { font-size: .92rem; font-style: italic; line-height: 1.45; }
.fiche-corps { display: grid; gap: 18px; }
.champ { display: grid; gap: 8px; }
.legende-champ { display: flex; align-items: baseline; gap: 8px; font-variant: small-caps; letter-spacing: .05em; color: var(--encre-douce); }
.legende-champ .num { font-size: .8rem; color: var(--rouge); font-variant: normal; min-width: 1.6em; }
.legende-champ::after { content: ''; flex: 1; border-bottom: 1px dotted rgba(43, 26, 16, .35); transform: translateY(-4px); }
.aide-champ { font-size: .88rem; font-style: italic; color: var(--encre-douce); margin-top: -4px; }
.champ input {
  font: inherit; font-size: 1.2rem; padding: 6px 2px; border: 0; border-bottom: 2px solid var(--encre-douce); border-radius: 0;
  background: transparent; color: var(--encre);
}
.champ input:focus { outline: none; border-bottom-color: var(--rouge); }
.champ input::placeholder { color: rgba(90, 63, 42, .5); font-style: italic; }
.pastilles { display: flex; flex-wrap: wrap; gap: 6px; }
.pastille {
  min-width: 64px; padding: 6px 14px; border-radius: 14px; cursor: pointer;
  border: 1px solid rgba(43, 26, 16, .35); background: transparent; font-size: .95rem;
}
.pastille[aria-pressed="true"] { background: var(--rouge); border-color: var(--rouge); color: #fbecd2; }
.tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.tuile {
  display: grid; justify-items: center; gap: 4px; padding: 10px 4px 8px; cursor: pointer;
  border: 1px solid rgba(43, 26, 16, .3); border-radius: 8px; background: rgba(255, 250, 235, .35);
  font-size: .88rem; line-height: 1.2; text-align: center; transition: transform .12s, border-color .12s;
}
.tuile svg { width: 30px; height: 30px; }
.tuile:hover, .tuile:focus-visible { border-color: var(--rouge); }
.tuile[aria-pressed="true"] { border: 2px solid var(--rouge); padding: 9px 3px 7px; background: rgba(142, 43, 27, .09); color: var(--rouge); transform: translateY(-1px); }
.fiche .tuile[aria-pressed="true"] svg path { stroke: var(--rouge); stroke-width: 1.7; }
.voeux { display: grid; gap: 8px; }
.voeu {
  position: relative; padding: 9px 12px 9px 34px; cursor: pointer; text-align: left; font-size: .95rem; line-height: 1.45;
  border: 1px solid rgba(43, 26, 16, .3); border-radius: 8px; background: rgba(255, 250, 235, .35);
}
.voeu::before { content: '○'; position: absolute; left: 12px; top: 9px; color: var(--encre-douce); }
.voeu[aria-pressed="true"] { border: 2px solid var(--rouge); padding: 8px 11px 8px 33px; background: rgba(142, 43, 27, .08); }
.voeu[aria-pressed="true"]::before { content: '✦'; left: 11px; top: 8px; color: var(--rouge); }
.qualite { display: grid; grid-template-columns: 1fr 34px auto 34px; align-items: center; gap: 8px; }
.q-nom { display: grid; line-height: 1.25; }
.q-nom b { font-weight: normal; }
.q-nom small { font-size: .78rem; font-style: italic; color: var(--encre-douce); }
.pips { display: flex; gap: 6px; }
.pip { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--encre-douce); }
.pip.rempli { background: radial-gradient(circle at 35% 30%, #5a3f2a, var(--encre)); border-color: var(--encre); }
.pm { width: 34px; height: 34px; border-radius: 50%; cursor: pointer; border: 1px solid var(--encre-douce); background: rgba(255, 250, 235, .5); font-size: 1.05rem; line-height: 1; }
.pm:disabled, .plein:disabled { opacity: .35; cursor: not-allowed; }
.reste { margin: 2px 0 0; font-size: .92rem; font-style: italic; color: var(--encre-douce); }
.goutte { display: inline-block; width: 8px; height: 8px; margin-left: 4px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--rouge); vertical-align: middle; }
@media (prefers-reduced-motion: reduce) { .tuile { transition: none; } }

/* ---------- Fin ---------- */
.titre-gagne {
  margin: 1.4em auto; max-width: 30em; padding: 16px 18px; text-align: center; border-radius: 10px;
  border: 2px solid var(--or); background: rgba(184, 134, 45, .12);
}
.titre-gagne small { display: block; font-variant: small-caps; letter-spacing: .1em; color: var(--encre-douce); }
.titre-gagne span { display: block; font-size: 1.35rem; color: var(--rouge); margin-top: .2em; }
.fin-boutons { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 1.2em; }
.pyment-share { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 14px; }
.pyment-share button, .pyment-share a {
  padding: 6px 14px; border-radius: 99px; border: 1px solid var(--encre-douce); background: transparent;
  color: var(--encre); font-size: .9rem; text-decoration: none; cursor: pointer;
}

/* ---------- Panneau (plateforme, légendes) ---------- */
.voile { position: fixed; inset: 0; z-index: 10; background: rgba(20, 12, 6, .7); display: grid; place-items: center; padding: 16px; }
.voile[hidden] { display: none; }
.panneau {
  position: relative; width: 100%; max-width: 520px; max-height: 86dvh; overflow: auto;
  padding: 24px 22px; border-radius: 14px; background: var(--papier); box-shadow: 0 10px 40px rgba(0, 0, 0, .6);
}
.panneau h2 { margin: 0 0 .6em; color: var(--rouge); font-weight: normal; text-align: center; }
.panneau h3 { margin: 1em 0 .2em; font-variant: small-caps; color: var(--encre-douce); font-weight: normal; letter-spacing: .06em; font-size: 1rem; }
.panneau p { margin: 0 0 .4em; }
.fermer { position: absolute; top: 8px; right: 10px; width: 36px; height: 36px; border: 0; background: transparent; font-size: 1.6rem; cursor: pointer; color: var(--encre-douce); }
.legende { padding: 10px 0; border-bottom: 1px dashed rgba(43, 26, 16, .3); }
.legende b { color: var(--rouge); font-weight: normal; font-size: 1.05rem; }
.legende small { display: block; color: var(--encre-douce); }

.pyment-banner { position: fixed; inset: 0 0 auto 0; z-index: 20; background: var(--or); color: var(--nuit); text-align: center; padding: 6px 12px; font-size: .85rem; }
.pyment-banner a { color: var(--nuit); font-weight: 600; }
.noscript { color: var(--papier); text-align: center; padding: 2em; }

@media (max-width: 520px) {
  body { font-size: 1.04rem; }
  .parchemin { padding: 26px 18px 110px; }
  .recit p { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .mot { transition: none; }
  .de.roule { animation: none; }
}

/* ---------- Kit du conteur ---------- */
.discord .kit-lien { margin: .9em 0 0; font-size: .92rem; }
.discord .kit-lien a { color: var(--rouge); }
.kit { padding-bottom: 60px; }
.kit-retour { margin: 0; font-size: .9rem; }
.kit-retour a, .kit-sommaire a { color: var(--encre-douce); }
.kit-tete { text-align: center; margin-bottom: 1.2em; }
.kit-tete h1 { margin: .2em 0 .3em; font-size: clamp(2rem, 7vw, 2.8rem); line-height: 1.1; color: var(--rouge); font-weight: normal; }
.kit-sommaire { text-align: center; font-size: .9rem; color: var(--encre-douce); margin-bottom: 1.5em; line-height: 1.9; }
.kit section { margin: 0 0 2em; }
.kit h2 { font-weight: normal; color: var(--rouge); font-size: 1.35rem; border-bottom: 1px solid rgba(90, 63, 42, .3); padding-bottom: .2em; }
.kit ul, .kit ol { padding-left: 1.2em; }
.kit li { margin-bottom: .45em; }
.kit-liste dt { font-variant: small-caps; letter-spacing: .05em; color: var(--encre); font-weight: bold; margin-top: .7em; }
.kit-liste dd { margin: .1em 0 0 0; color: var(--encre-douce); }
.kit-note { font-size: .95rem; font-style: italic; color: var(--encre-douce); }
.kit-exemple { padding: 1em 1.2em; border: 2px double var(--or); border-radius: 12px; background: rgba(184, 134, 45, .1); font-size: 1rem; }
.kit-bouton { text-align: center; }
.kit-bouton .second { display: inline-block; text-decoration: none; }
.kit .pied { text-align: center; }

/* ---------- Parchemin de légende ---------- */
.parchemin-image { display: block; width: 100%; max-width: 420px; height: auto; margin: 0 auto 1em; border-radius: 6px; box-shadow: 0 3px 14px rgba(43, 26, 16, .35); }
.parchemin-boutons { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.parchemin-boutons a.second { display: inline-block; text-align: center; text-decoration: none; }
