/* Registre Riftbound — un grand livre de comptes, pas un dashboard.
   Chiffres en chasse fixe partout, titres en serif, zéro arrondi. */

:root {
  --ink:        #131019;
  --panel:      #1b1723;
  --panel-2:    #221d2d;
  --rule:       #322b40;
  --text:       #ece4d8;
  --muted:      #8d8397;
  --or:         #c9a227;   /* argent : prix, manques */
  --rift:       #7b6cf6;   /* possession */
  --sang:       #b8453f;   /* erreur, bannie */
  --vert:       #4f9d69;   /* réussite */
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --serif: ui-serif, Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

/* Une règle d'auteur avec `display` bat le `display:none` que le navigateur
   applique à [hidden]. Sans ceci, .gate reste visible après connexion. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: .01em; }
h2 { font-size: 1.25rem; margin: 1.6rem 0 .6rem; }

code, kbd, .num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
kbd {
  border: 1px solid var(--rule); padding: 0 .3em;
  background: var(--panel-2); font-size: .85em;
}

a { color: var(--text); }

/* ------------------------------------------------------------ marque */

.wordmark {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: .18em;
  text-transform: uppercase;
  margin: 0;
}
.wordmark.small { font-size: .95rem; color: var(--muted); }

/* ------------------------------------------------------------ portail */

.gate { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.gate-card {
  width: min(380px, 100%);
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 2rem 1.75rem;
}
.gate-card .wordmark { font-size: 1.5rem; }
.gate-sub { color: var(--muted); font-size: .9rem; margin: .4rem 0 1.6rem; }
.gate-actions { display: flex; gap: .5rem; margin-top: 1.2rem; }

.field { margin-bottom: .9rem; }
.field label { display: block; font-size: .78rem; color: var(--muted); margin-bottom: .25rem; }

input, select, textarea {
  width: 100%;
  background: var(--ink);
  border: 1px solid var(--rule);
  color: var(--text);
  padding: .5rem .6rem;
  font-family: inherit;
  font-size: .92rem;
  border-radius: 0;
}
textarea { font-family: var(--mono); font-size: .85rem; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--rift); outline-offset: -1px; }
input.num { width: 6rem; }

.btn {
  background: var(--panel-2);
  border: 1px solid var(--rule);
  color: var(--text);
  padding: .5rem .9rem;
  font-family: inherit;
  font-size: .88rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--rift); border-color: var(--rift); color: #fff; }
.btn.primary:hover { filter: brightness(1.12); }
.btn.small { padding: .3rem .6rem; font-size: .8rem; }
.btn:focus-visible, .link:focus-visible { outline: 2px solid var(--or); outline-offset: 2px; }

.link { background: none; border: 0; color: var(--muted); cursor: pointer; text-decoration: underline; font-size: .82rem; }
.msg { min-height: 1.2em; font-size: .85rem; color: var(--sang); margin: .8rem 0 0; }

/* ------------------------------------------------------------ chrome */

.topbar {
  display: flex; align-items: center; gap: 1.5rem;
  padding: .7rem 1.2rem;
  border-bottom: 1px solid var(--rule);
  background: var(--panel);
  position: sticky; top: 0; z-index: 20;
}
.tabs { display: flex; gap: .2rem; flex: 1; flex-wrap: wrap; }
.tabs a {
  padding: .35rem .7rem; text-decoration: none; color: var(--muted);
  font-size: .88rem; border-bottom: 2px solid transparent;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-bottom-color: var(--or); }
.who { font-size: .82rem; color: var(--muted); display: flex; gap: .6rem; align-items: center; }

main { padding: 1.2rem; max-width: 1500px; margin: 0 auto; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin: .8rem 0; }
.row input:not(.num), .row select { width: auto; min-width: 12rem; }
.check { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; color: var(--muted); white-space: nowrap; }
.check input { width: auto; }
.hint { color: var(--muted); font-size: .82rem; margin: .4rem 0 1rem; }

/* ------------------------------------------------------------ compteurs */

.ledger-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-end; }
.counters { display: flex; gap: 2rem; flex-wrap: wrap; }
.counter { border-left: 2px solid var(--rule); padding-left: .7rem; }
.counter b { display: block; font-family: var(--mono); font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.counter span { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.counter.argent b { color: var(--or); }
.controls { display: flex; gap: .6rem; align-items: center; }

/* ------------------------------------------------------------ grille */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: .55rem;
}

.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--rule);
  cursor: pointer;
  user-select: none;
}
.card.sel { border-color: var(--or); box-shadow: 0 0 0 1px var(--or); }
.card.have { border-left: 3px solid var(--rift); }
.card img { width: 100%; display: block; aspect-ratio: 5 / 7; object-fit: cover; background: var(--panel-2); }
.card .noart {
  aspect-ratio: 5 / 7; display: grid; place-items: center; text-align: center;
  padding: .5rem; font-family: var(--serif); font-size: .82rem; color: var(--muted);
  background: var(--panel-2);
}
.card .meta { display: flex; justify-content: space-between; gap: .3rem; padding: .3rem .4rem; font-size: .72rem; }
.card .code { font-family: var(--mono); color: var(--muted); }
.card .prix { font-family: var(--mono); color: var(--or); }

.qty {
  position: absolute; top: 0; right: 0;
  font-family: var(--mono); font-size: .82rem; font-weight: 600;
  background: var(--rift); color: #fff; padding: .1rem .4rem;
}
.qty.zero { background: transparent; color: var(--muted); }
.qty.foil { background: var(--or); color: #1a1508; }

/* ------------------------------------------------------------ quiz */

.quiz { max-width: 640px; margin: 1.5rem auto; }
.quiz .prompt-img { display: block; margin: 0 auto 1.2rem; max-height: 46vh; border: 1px solid var(--rule); }
.quiz .prompt-text {
  font-family: var(--serif); font-size: 1.25rem; text-align: center;
  padding: 1.4rem; border: 1px solid var(--rule); background: var(--panel); margin-bottom: 1.2rem;
}
.quiz .question { text-align: center; color: var(--muted); font-size: .85rem; margin-bottom: .8rem;
                  text-transform: uppercase; letter-spacing: .1em; }
.opt {
  display: block; width: 100%; text-align: left;
  background: var(--panel); border: 1px solid var(--rule); color: var(--text);
  padding: .7rem .9rem; margin-bottom: .45rem; cursor: pointer; font: inherit; font-size: .9rem;
}
.opt:hover:not(:disabled) { border-color: var(--muted); }
.opt.juste { border-color: var(--vert); background: color-mix(in srgb, var(--vert) 18%, var(--panel)); }
.opt.faux  { border-color: var(--sang); background: color-mix(in srgb, var(--sang) 18%, var(--panel)); }
.score { margin-left: auto; font-family: var(--mono); color: var(--muted); font-size: .85rem; }

/* ------------------------------------------------------------ decks */

.deck {
  border: 1px solid var(--rule); background: var(--panel);
  margin-bottom: .8rem; padding: .9rem 1rem;
}
.deck-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.deck-title { font-family: var(--serif); font-size: 1.05rem; }
.deck-legend { color: var(--muted); font-size: .82rem; }
.deck-cout { font-family: var(--mono); font-size: 1.35rem; color: var(--or); }
.deck-cout small { font-size: .7rem; color: var(--muted); display: block; text-align: right; }

/* la jauge : ce que j'ai / ce qu'il manque, à l'échelle du deck */
.jauge { display: flex; height: 6px; margin: .7rem 0 .5rem; background: var(--panel-2); }
.jauge .ok { background: var(--rift); }
.jauge .ko { background: var(--or); }

.manques { width: 100%; border-collapse: collapse; font-size: .82rem; margin-top: .6rem; }
.manques th { text-align: left; color: var(--muted); font-weight: 400; font-size: .72rem;
              text-transform: uppercase; letter-spacing: .07em; border-bottom: 1px solid var(--rule); padding: .3rem 0; }
.manques td { padding: .28rem 0; border-bottom: 1px solid var(--panel-2); }
.manques td.n { font-family: var(--mono); text-align: right; width: 3.5rem; }
.manques td.p { font-family: var(--mono); text-align: right; width: 5rem; color: var(--or); }
.manques td.inconnu { color: var(--muted); }

.jobs { width: 100%; border-collapse: collapse; font-size: .84rem; }
.jobs td { padding: .35rem .5rem; border-bottom: 1px solid var(--rule); }
.jobs td:first-child { font-family: var(--mono); color: var(--muted); }

.avert { border-left: 3px solid var(--sang); padding: .5rem .8rem; background: var(--panel); font-size: .85rem; margin: .8rem 0; }
.ok-box { border-left: 3px solid var(--vert); padding: .5rem .8rem; background: var(--panel); font-size: .85rem; margin: .8rem 0; }

/* ------------------------------------------------------------ toast */

.toast {
  position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--rule); border-left: 3px solid var(--or);
  padding: .6rem 1rem; font-size: .86rem; z-index: 50;
}

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: .6rem; }
  .counters { gap: 1rem; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ------------------------------------------------------------ ma collection */

.setbars { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem; margin: 1.4rem 0; }
.setbar { border: 1px solid var(--rule); background: var(--panel); padding: .6rem .8rem; }
.setbar .t { display: flex; justify-content: space-between; align-items: baseline; font-size: .82rem; }
.setbar .t b { font-family: var(--mono); }
.setbar .t span { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.setbar .j { height: 4px; background: var(--panel-2); margin-top: .45rem; }
.setbar .j div { height: 100%; background: var(--rift); }

.vide { text-align: center; color: var(--muted); padding: 3rem 1rem; font-family: var(--serif); font-size: 1.05rem; }
.vide a { color: var(--or); }

/* ------------------------------------------------------------ fiche carte */

.fiche-fond {
  position: fixed; inset: 0; background: rgba(10, 8, 14, .82);
  z-index: 60; display: grid; place-items: center; padding: 1.5rem;
}
.fiche {
  display: grid; grid-template-columns: minmax(220px, 340px) 1fr; gap: 1.6rem;
  background: var(--panel); border: 1px solid var(--rule);
  padding: 1.4rem; max-width: 940px; width: 100%;
  max-height: 90vh; overflow: auto;
}
.fiche-art img { width: 100%; display: block; border: 1px solid var(--rule); }
.fiche-art .noart { aspect-ratio: 5/7; display: grid; place-items: center;
  background: var(--panel-2); color: var(--muted); font-family: var(--serif); padding: 1rem; text-align: center; }

.fiche h3 { margin: 0; font-size: 1.4rem; }
.fiche-code { font-family: var(--mono); color: var(--muted); font-size: .82rem; margin: .2rem 0 1rem; }

.stats { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.stat { border: 1px solid var(--rule); padding: .25rem .55rem; font-size: .78rem; }
.stat b { font-family: var(--mono); }
.stat span { color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: .68rem; }

.effets { border-left: 2px solid var(--rule); padding-left: .9rem; margin-bottom: 1.2rem; }
.effet { margin-bottom: .6rem; font-size: .92rem; line-height: 1.55; }
.effet:last-child { margin-bottom: 0; }
.kw { color: var(--or); font-weight: 600; }

.lexique { margin-bottom: 1.2rem; }
.lexique h4 { margin: 0 0 .4rem; font-family: var(--serif); font-weight: 500;
  font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.lexique dl { margin: 0; font-size: .84rem; }
.lexique dt { color: var(--or); font-weight: 600; margin-top: .5rem; }
.lexique dd { margin: .1rem 0 0; color: var(--text); opacity: .85; }

.fiche-prix { font-family: var(--mono); color: var(--or); font-size: 1.1rem; margin-bottom: 1.2rem; }
.fiche-prix small { display: block; color: var(--muted); font-size: .7rem;
  text-transform: uppercase; letter-spacing: .08em; font-family: var(--sans); }

.compteur { display: flex; align-items: center; gap: .5rem; margin-bottom: .7rem; }
.compteur .lbl { width: 4.2rem; font-size: .76rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .07em; }
.compteur button {
  width: 2.1rem; height: 2.1rem; background: var(--panel-2); border: 1px solid var(--rule);
  color: var(--text); font-size: 1.15rem; line-height: 1; cursor: pointer; font-family: var(--mono);
}
.compteur button:hover { border-color: var(--or); }
.compteur input { width: 3.6rem; text-align: center; font-family: var(--mono); font-size: 1rem; }

.fiche-fermer { background: none; border: 0; color: var(--muted); cursor: pointer;
  font-size: 1.5rem; line-height: 1; float: right; padding: 0 .2rem; }
.fiche-fermer:hover { color: var(--text); }
.fiche-nav { display: flex; gap: .5rem; margin-top: 1rem; }

/* boutons ± directement sur la vignette */
.card .pm {
  position: absolute; bottom: 1.55rem; right: 0; display: none; gap: 1px;
}
.card:hover .pm, .card.sel .pm { display: flex; }
.card .pm button {
  width: 1.5rem; height: 1.5rem; background: rgba(20,16,28,.9); border: 1px solid var(--rule);
  color: var(--text); font-family: var(--mono); font-size: .9rem; line-height: 1; cursor: pointer; padding: 0;
}
.card .pm button:hover { background: var(--rift); border-color: var(--rift); }

@media (max-width: 720px) {
  .fiche { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------ liste de decks */

.dlist { width: 100%; border-collapse: collapse; font-size: .86rem; }
.dlist th { text-align: left; color: var(--muted); font-weight: 400; font-size: .7rem;
  text-transform: uppercase; letter-spacing: .08em; padding: .35rem .5rem;
  border-bottom: 1px solid var(--rule); }
.dlist td { padding: .45rem .5rem; border-bottom: 1px solid var(--panel-2); vertical-align: top; }
.dlist tr:hover td { background: var(--panel); }
.dlist .nom { font-family: var(--serif); }
.dlist .meta2 { color: var(--muted); font-size: .78rem; }
.dlist .n { font-family: var(--mono); text-align: right; white-space: nowrap; }
.dlist .src { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); border: 1px solid var(--rule); padding: .05rem .35rem; }
.dlist .src.manual { color: var(--rift); border-color: var(--rift); }
.dlist .sup { background: none; border: 0; color: var(--muted); cursor: pointer;
  font-size: 1rem; padding: 0 .3rem; }
.dlist .sup:hover { color: var(--sang); }
.dlist .alerte { color: var(--or); }
