/* Wikiclash — écran titre, menu principal, ouverture de booster, connexion (README §5.1). */

/* ---------- écran titre ---------- */
.scr-menu .mn-title {
  position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
  opacity: 0; transform: scale(1.04); pointer-events: none; outline: none;
  transition: opacity 600ms ease, transform 900ms var(--ease-soft);
}
.scr-menu.title-on .mn-title { opacity: 1; transform: none; pointer-events: auto; cursor: pointer; }
.scr-menu.title-on > .wc-top, .scr-menu.title-on > .mn-main, .scr-menu.title-on > .wc-foot { opacity: 0; pointer-events: none; }
.scr-menu > .wc-top, .scr-menu > .mn-main, .scr-menu > .wc-foot { transition: opacity 500ms ease; }
.tt-box { display: flex; flex-direction: column; align-items: center; gap: 14px; background: rgba(var(--ovr), .86); padding: 28px 56px 22px; }
.tt-logo { display: flex; align-items: center; gap: clamp(18px, 2.2vw, 34px); }
.tt-logo .wc-word { font-size: clamp(60px, 7.4vw, 116px); }
.tt-rule { width: 100%; height: 1px; background: var(--ln); }
.tt-tag { font-family: var(--serif); font-style: italic; font-size: clamp(18px, 1.6vw, 24px); color: var(--sub); }
.tt-press { margin-top: 40px; font-size: 14px; letter-spacing: .18em; text-transform: uppercase; color: var(--link); background: rgba(var(--ovr), .86); padding: 8px 18px; transition: opacity 1100ms ease-in-out; }
.tt-press.dim { opacity: .25; }

/* ---------- menu principal ---------- */
.scr-menu .wc-top { border-bottom-color: transparent; background: transparent; }
.mn-main {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; min-height: 0; overflow: hidden;
  padding: 0 clamp(48px, 9vw, 160px);
}
.mn-left { display: flex; flex-direction: column; gap: clamp(12px, 3.2vh, 48px); background: rgba(var(--ovr), .82); padding: clamp(10px, 2.4vh, 24px) 32px clamp(10px, 2.4vh, 24px) 0; max-width: 560px; }
.mn-brand { display: flex; align-items: center; gap: 14px; }
.mn-brand .wc-word { font-size: clamp(28px, 5.4vh, 38px); }
.mn-brand .wc-logo { width: clamp(40px, 7.4vh, 54px) !important; }
.mn-rule { width: 220px; height: 1px; background: var(--ln); margin-top: calc(-1 * clamp(12px, 3.2vh, 48px) + 8px); }
.mn-list { display: flex; flex-direction: column; gap: 6px; }
.mn-crumb { display: flex; gap: 8px; font-size: 13px; color: var(--mut); height: 18px; opacity: 0; transition: opacity 220ms ease; }
.mn-crumb .sep { color: var(--ln); }
.mn-crumb .cur { color: var(--ink); }
.mn-list.shown .mn-crumb { opacity: 1; }
.mn-items { display: flex; flex-direction: column; }
.mi {
  display: flex; align-items: baseline; gap: 14px; padding: clamp(2px, .6vh, 5px) 0; border: 0; background: none; text-align: left; cursor: pointer;
  opacity: 0; transform: translateX(-18px); transition: opacity 280ms ease, transform 380ms var(--ease-soft); transition-delay: 0ms;
}
.mn-list.shown .mi { opacity: 1; transform: none; transition-delay: var(--d); }
.mi .mk { width: 20px; font-family: var(--serif); font-size: clamp(22px, min(2.2vw, 4.6vh), 30px); line-height: 1; color: var(--link); opacity: 0; transform: translateX(-10px); transition: opacity 160ms ease, transform 220ms ease; }
.mi .lb { font-family: var(--serif); font-size: clamp(22px, min(3vw, 4.6vh), 42px); line-height: 1.15; color: var(--ink); transition: color 140ms ease; text-decoration-thickness: 1px; text-underline-offset: 6px; }
.mi.dim .lb { color: var(--mut); }
.mi .vl { font-size: 14px; color: var(--ln); letter-spacing: .04em; }
.mi .vl.off { color: var(--err); }
.mi.on .mk { opacity: 1; transform: none; }
.mi.on .lb { color: var(--link); text-decoration: underline; }
.mi.on .vl:not(.off) { color: var(--link); }
.mi:focus-visible { outline: none; }
.mn-desc { min-height: 3em; /* deux lignes réservées : le menu ne bouge pas quand la description passe à la ligne */ max-width: 400px; font-size: 15px; line-height: 1.5; color: var(--sub); text-wrap: pretty; }

/* ---------- boosters gratuits ---------- */
.mn-right { display: flex; justify-content: center; align-items: center; min-height: 0; max-height: 100%; perspective: 1200px; }
.mn-free { display: flex; flex-direction: column; gap: clamp(10px, 2.2vh, 20px); align-items: center; background: rgba(var(--ovr), .86); padding: 16px 28px; }
.fr-head { display: flex; align-items: center; gap: 14px; }
.fr-pips { display: flex; gap: 4px; }
.fr-pips i { width: 10px; height: 15px; background: var(--bg); border: 1px solid var(--ln2); transition: background 300ms ease; }
.fr-pips i.on { background: var(--ink); border-color: var(--ink); }
.fr-txt { display: flex; flex-direction: column; gap: 1px; }
.fr-txt b { font-family: var(--serif); font-weight: 400; font-size: 17px; color: var(--ink); }
.fr-txt span { font-size: 12px; color: var(--mut); }
.fr-stage { position: relative; display: flex; align-items: center; justify-content: center; perspective: 1200px; }
.fr-hint { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.fr-hint .h { font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--link); }
.fr-hint .h.off { color: var(--mut); }
.fr-hint .s { font-size: 12px; color: var(--mut); min-height: 15px; }
.fr-shop { font-size: 13px; }

/* booster du menu (composant WC.booster) */
.pack { width: clamp(100px, 24vh, 200px); padding: 0; border: 0; background: none; cursor: pointer; transition: opacity 320ms ease; will-change: transform; }
.pack.empty { opacity: .4; cursor: not-allowed; }
.pack:focus-visible { outline: 2px solid var(--link); outline-offset: 6px; }

/* ---------- ouverture de booster ---------- */
.bo-ovl { z-index: 60; padding: 0; overflow: hidden; display: block; }
.bo-top { position: absolute; top: clamp(18px, 4vh, 36px); right: clamp(24px, 4vw, 64px); display: flex; flex-direction: column; align-items: flex-end; gap: 2px; z-index: 3; }
.bo-tok { display: flex; align-items: baseline; gap: 8px; transform-origin: right center; }
.bo-tok b { font-family: var(--serif); font-weight: 400; font-size: clamp(22px, 4vh, 30px); line-height: 1; color: var(--ink); transition: color 400ms ease; }
.bo-tok.up b { color: var(--ok); }
.bo-tok span { font-size: 13px; color: var(--mut); }
.bo-float { font-family: var(--serif); font-size: 20px; color: var(--ok); opacity: 0; }
.bo-head { position: absolute; top: clamp(18px, 4vh, 36px); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.bo-title { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--mut); }
.bo-thumbs { display: flex; gap: 6px; opacity: 0; transition: opacity 300ms ease; }
.bo-thumbs.on { opacity: 1; }
.bo-thumbs .th { width: 16px; height: 22px; display: flex; align-items: center; justify-content: center; font-size: 11px; line-height: 1; color: var(--err); background: var(--bg2); border: 1px dashed var(--ln2); border-top: 3px solid var(--bg3); transition: all 300ms ease; }
.bo-thumbs .th.cur { border-style: solid; border-color: var(--link); border-top-color: var(--link); }
.bo-thumbs .th.past { background: var(--bg); border-style: solid; border-top-color: var(--rc, var(--ln)); }
.bo-thumbs .th.dsc { border-style: dashed; border-top-color: var(--ln2); }
.bo-stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; perspective: 1400px; padding-bottom: 11vh; }
.bo-fly { position: absolute; will-change: transform; }
.bo-pk { width: clamp(150px, 40vh, 280px); }
.bo-pk .wp-in { cursor: grab; touch-action: none; box-shadow: 0 1px 0 var(--bg3), 0 36px 60px -30px rgba(var(--shr), .5); }
.bo-pk .wp-in.grab { cursor: grabbing; }
.bo-ring { position: absolute; width: clamp(180px, 42vh, 330px); aspect-ratio: 5 / 7; border: 2px solid var(--rc, var(--ln)); opacity: 0; pointer-events: none; }
.bo-ring.thin { border-width: 1px; }
.bo-move { position: absolute; cursor: pointer; touch-action: none; will-change: transform; }
.bo-move[hidden], .bo-done[hidden], .bo-choice[hidden] { display: none !important; }
.bo-tilt { position: relative; width: clamp(180px, 42vh, 330px); aspect-ratio: 5 / 7; transform-style: preserve-3d; will-change: transform; }
.bo-flip { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform 720ms cubic-bezier(.3,.7,.2,1); }
.bo-flip.flipped { transform: rotateY(180deg); }
.bo-back, .bo-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.bo-back .wcard, .bo-face .wcard { width: 100%; }
.bo-face { transform: rotateY(180deg); }
/* la face cachée ne doit pas intercepter les clics (lien « Lire sur Wikipédia » une fois la carte retournée) */
.bo-flip.flipped .bo-back, .bo-flip:not(.flipped) .bo-face { pointer-events: none; }

.bo-choice { position: absolute; bottom: clamp(14px, 3vh, 32px); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 3; }
.bo-owned { font-size: 13px; color: var(--mut); }
.bo-owned.new { color: var(--ok); }
.bo-choice .row { display: flex; gap: 12px; }
.bo-choice .s, .bo-hint .s { font-size: 12px; color: var(--mut); }
.bo-disc { background: var(--bg); color: var(--ink); border-color: var(--ln); }
.bo-disc:hover { border-color: var(--err); color: var(--err); }
.bo-disc .g { font-weight: 400; color: var(--ok); }
.bo-hint { position: absolute; bottom: clamp(18px, 4vh, 40px); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; opacity: 0; transition: opacity 300ms ease; pointer-events: none; }
.bo-hint.on { opacity: 1; }
.bo-hint .h { font-family: var(--serif); font-style: italic; font-size: 19px; color: var(--link); }
.bo-done { display: flex; flex-direction: column; align-items: center; gap: clamp(18px, 4vh, 36px); }
.dn-cards { display: flex; gap: clamp(10px, 1.4vw, 20px); align-items: flex-end; flex-wrap: wrap; justify-content: center; max-width: 92vw; }
.dn-slot { width: clamp(96px, 12vw, 160px); display: flex; flex-direction: column; gap: 6px; opacity: 0; transform: translateY(30px); transition: opacity 360ms ease var(--d), transform 520ms cubic-bezier(.2,.8,.2,1) var(--d); }
.bo-done.in .dn-slot { opacity: 1; transform: none; }
.bo-done.in .dn-slot.dsc { opacity: .45; }
.dn-slot.dsc .wcard { filter: grayscale(1); }
.dn-lab { display: flex; align-items: center; justify-content: center; gap: 5px; font-size: 11px; color: var(--rc); font-weight: 600; white-space: nowrap; }
.dn-slot.dsc .dn-lab { color: var(--mut); }
.dn-lab i { width: 6px; height: 6px; flex: none; background: currentColor; }
.dn-sum { font-size: 14px; color: var(--sub); opacity: 0; transition: opacity 400ms ease 300ms; }
.dn-btns { display: flex; gap: 10px; align-items: center; opacity: 0; transition: opacity 400ms ease 500ms; }
.bo-done.in .dn-sum, .bo-done.in .dn-btns { opacity: 1; }

/* ---------- connexion ---------- */
.au-main { display: flex; align-items: center; justify-content: center; }
.au-box { width: min(420px, 100%); display: flex; flex-direction: column; gap: 14px; background: rgba(var(--ovr), .9); padding: 24px 28px; border: 1px solid var(--bg3); }
.au-brand { display: flex; align-items: center; gap: 12px; }
.au-brand .wc-word { font-size: 40px; }
.au-tag { font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--sub); margin-top: -6px; }
.au-form { display: flex; flex-direction: column; gap: 12px; }
.au-form label { display: flex; flex-direction: column; gap: 4px; }
.au-go { align-self: flex-start; }
.au-note { margin: 0; font-size: 12px; color: var(--mut); }

/* ---------- pages en attente ---------- */
.soon-main { display: flex; align-items: center; justify-content: center; }
.soon-box { width: min(560px, 100%); display: flex; flex-direction: column; gap: 14px; }
.soon-box p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--sub); }
.bo-pk .wp-in { overflow: visible; }

/* choix glissé : tampon sur la carte, bord d'écran teinté du côté choisi, bouton correspondant allumé */
.bo-side { position: absolute; top: 0; bottom: 0; width: min(30vw, 380px); display: flex; align-items: center; pointer-events: none; opacity: var(--o); }
.bo-side.l { left: 0; --o: var(--pl, 0); --c: var(--err); justify-content: flex-start; padding-left: clamp(20px, 4vw, 64px); border-left: 4px solid var(--c); background: linear-gradient(90deg, color-mix(in srgb, var(--c) 20%, transparent), transparent); }
.bo-side.r { right: 0; --o: var(--pr, 0); --c: var(--ok); justify-content: flex-end; padding-right: clamp(20px, 4vw, 64px); border-right: 4px solid var(--c); background: linear-gradient(270deg, color-mix(in srgb, var(--c) 20%, transparent), transparent); text-align: right; }
.bo-side div { display: flex; flex-direction: column; gap: 4px; padding-bottom: 11vh; }
.bo-side.l div { transform: translateX(calc((1 - var(--o)) * -28px)); }
.bo-side.r div { transform: translateX(calc((1 - var(--o)) * 28px)); }
.bo-side b { font-family: var(--serif); font-weight: 400; font-size: clamp(26px, 5vh, 46px); line-height: 1; color: var(--c); white-space: nowrap; }
.bo-side span { font-size: 13px; color: var(--sub); }
.bo-ovl.smooth .bo-side, .bo-ovl.smooth .bo-side div, .bo-ovl.smooth .bo-stamp { transition: opacity 260ms ease, transform 260ms var(--ease-soft); }

.bo-stamp {
  --sc: var(--ok); --sr: -8deg;
  position: absolute; left: 50%; top: 42%; z-index: 6; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 18px 7px;
  border: 4px double var(--sc); color: var(--sc); background: color-mix(in srgb, var(--bg) 90%, transparent);
  box-shadow: 0 10px 24px -14px rgba(var(--shr), .5);
  font-family: var(--serif); white-space: nowrap;
  opacity: var(--sp, 0); transform: translate(-50%, -50%) translateZ(80px) rotate(var(--sr)) scale(calc(.8 + .2 * var(--sp, 0)));
}
.bo-stamp.disc { --sc: var(--err); --sr: 8deg; }
.bo-stamp b { font-size: clamp(22px, 4.4vh, 34px); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; line-height: 1; }
.bo-stamp span { font-family: var(--sans); font-size: 12px; font-weight: 600; }
.bo-stamp.lock { background: var(--sc); color: var(--on); border-color: color-mix(in srgb, var(--on) 70%, var(--sc)); animation: bo-stamp 240ms var(--ease-soft); }
@keyframes bo-stamp { 0% { scale: 1.25; } 100% { scale: 1; } }

.bo-ovl.lean-l .bo-disc { border-color: var(--err); color: var(--err); background: var(--errbg); }
.bo-ovl.lean-r [data-act="keep"] { background: var(--ok); border-color: var(--ok); color: var(--on); }
.bo-choice .btn { transition: background 160ms ease, color 160ms ease, border-color 160ms ease; }
@media (prefers-reduced-motion: reduce) { .bo-stamp.lock { animation: none; } .bo-side div { transform: none !important; } }

/* liens de la carte retournée, à droite de la carte */
.bo-links {
  position: absolute; z-index: 4; right: clamp(20px, 5vw, 96px); top: 50%; transform: translate(12px, calc(-50% - 5.5vh));
  width: clamp(190px, 22vw, 320px); max-height: min(56vh, 520px); display: flex; flex-direction: column;
  background: var(--bg); border: 1px solid var(--ln); box-shadow: var(--shadow-card); padding: 10px 12px;
  opacity: 0; pointer-events: none; transition: opacity 300ms ease, transform 400ms var(--ease-soft);
}
.bo-links.on { opacity: 1; transform: translate(0, calc(-50% - 5.5vh)); pointer-events: auto; }
.bo-links .wc-lkbox { min-height: 0; flex: 1; }
.bo-ovl.lean-l .bo-links.on, .bo-ovl.lean-r .bo-links.on { opacity: .15; }
/* ouverture de booster : rien n'est sélectionnable (glisser la carte ou le booster ne surligne pas le texte) */
.bo-ovl, .bo-ovl * { user-select: none; -webkit-user-select: none; }
.bo-ovl .bo-links, .bo-ovl .bo-links * { user-select: text; -webkit-user-select: text; }
/* écran titre : mention des dons à Wikipédia (comme sur la page de connexion) */
.tt-don { position: absolute; left: 50%; bottom: clamp(18px, 5vh, 48px); transform: translateX(-50%); display: flex; align-items: flex-start; gap: 10px; width: min(560px, 90vw); border-top: 1px solid var(--bg3); padding-top: clamp(8px, 1.6vh, 14px); background: rgba(var(--ovr), .86); cursor: default; }
.tt-don svg { margin-top: 2px; }
.tt-don span { font-size: 13px; line-height: 1.5; color: var(--sub); text-wrap: pretty; text-align: left; }
.tt-don a { white-space: nowrap; }
@media (max-height: 600px) { .tt-don { font-size: 12px; bottom: 12px; } .tt-don span { font-size: 12px; } }
/* inscription fermée : bêta sur invitation */
.au-beta { display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--sel2); background: var(--sel); padding: 14px 16px; text-align: left; }
.au-beta .t { font-family: var(--serif); font-size: 22px; line-height: 1.1; color: var(--ink); }
.au-beta p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--sub); text-wrap: pretty; }
.au-beta .btn { align-self: flex-start; margin-top: 4px; }
/* 8 entrées au menu principal : plus serré sur les petites hauteurs, pour que la description reste visible */
@media (max-height: 640px) {
  .mi { padding: 1px 0; }
  .mi .lb, .mi .mk { font-size: clamp(18px, min(3vw, 4vh), 42px); }
  .mn-left { gap: clamp(8px, 2.2vh, 48px); }
  .mn-desc { font-size: 14px; line-height: 1.4; min-height: 2.8em; }
}

/* ---------- étagère des boosters : une pile par sorte (gratuit, puis achetés) ---------- */
.mn-free.has-rack .pack { width: clamp(88px, 19vh, 176px); }
.fr-rack { display: flex; flex-wrap: nowrap; justify-content: safe center; gap: 4px; max-width: min(460px, 42vw); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; padding: 14px 26px 6px; margin: -10px -26px -4px; }
.fr-rack:empty { display: none; }
.rk { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 7px 3px; border: 0; background: none; cursor: pointer; color: var(--sub); font: inherit; font-size: 11px; line-height: 1.1; }
.rk .pile { position: relative; width: clamp(26px, 5.2vh, 46px); aspect-ratio: 5 / 8; transition: transform 300ms var(--ease-soft); }
.rk .ly { position: absolute; inset: 0; transform: translate(calc(var(--k) * -3px), calc(var(--k) * -3px)); transition: transform 300ms var(--ease-soft); }
.rk .ly .wbooster { width: 100%; }
.rk .ly .wbooster .wp-in { box-shadow: 0 6px 10px -6px rgba(var(--shr), .5); }
.rk:hover .ly, .rk:focus-visible .ly { transform: translate(calc(var(--k) * -7px), calc(var(--k) * -4px)) rotate(calc(var(--k) * -5deg)); }
.rk:hover .pile { transform: translateY(-3px); }
.rk.on .pile { transform: translateY(-6px); }
.rk .lb { max-width: 64px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk.on .lb { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.rk::after { content: ""; position: absolute; left: 50%; bottom: -3px; width: 0; height: 2px; background: var(--link); transform: translateX(-50%); transition: width 260ms var(--ease-soft); }
.rk.on::after { width: 70%; }
.rk > b { position: absolute; top: 2px; right: 0; z-index: 2; min-width: 18px; padding: 1px 4px; background: var(--ink); color: var(--on); font-size: 10px; font-weight: 700; text-align: center; }
.rk.on > b { background: var(--link); }
.rk.none { opacity: .45; }
.rk:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) {
  .rk.new > b { animation: rk-bump 600ms 900ms var(--ease-out) both; }
  @keyframes rk-bump { 0% { transform: scale(1); } 40% { transform: scale(1.5); } 100% { transform: scale(1); } }
}
@media (prefers-reduced-motion: reduce) { .rk .ly, .rk .pile, .rk::after { transition: none; } }
.fr-pips[hidden] { display: none; }
.rk { flex: none; }
@media (max-height: 640px) {
  .mn-free.has-rack { gap: 6px; padding: 10px 18px; }
  .mn-free.has-rack .pack { width: clamp(80px, 17vh, 176px); }
  .mn-free.has-rack .fr-hint .s { display: none; }
  .rk { padding: 8px 3px 2px; font-size: 10px; }
  .rk .lb { max-width: 44px; }
}

/* ouverture : mettre la carte en favori */
.bo-star { display: none; position: absolute; top: -12px; right: -12px; z-index: 6; width: 30px; height: 30px; align-items: center; justify-content: center;
  background: var(--warn); color: var(--on); font-size: 17px; line-height: 1; box-shadow: 0 4px 10px -4px rgba(var(--shr), .6); pointer-events: none; }
.bo-move.faved .bo-star { display: flex; }
.bo-favb { background: var(--bg); color: var(--ink); border-color: var(--ln); }
.bo-favb:hover, .bo-favb.on { border-color: var(--warn); color: var(--warn); }
.bo-favb.on { background: color-mix(in srgb, var(--warn) 12%, var(--bg)); }
