/* ============================================================
   COMPONENTS — briques réutilisées par tous les écrans
   ============================================================ */

/* ---------- Cartes ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-l);
  padding: 17px;
  margin-bottom: var(--gap);
}
.card-discret { background: rgba(15,26,16,.5); border-style: dashed; }

.card-title {
  font-family: 'Cinzel', serif;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 5px;
}
.card-sub {
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.5;
  margin-bottom: 12px;
}
.card-sub:last-child { margin-bottom: 0; }

.scroll-title {
  font-family: 'Cinzel', serif;
  font-size: .76rem;
  font-weight: 700;
  color: var(--faint);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin: 20px 2px 10px;
}
.ecran > .scroll-title:first-child { margin-top: 4px; }

.note-fine {
  color: var(--faint);
  font-size: .72rem;
  line-height: 1.5;
  margin-top: 8px;
}

/* ---------- Boutons ---------- */
.btn {
  display: block;
  width: 100%;
  padding: 13px 16px;
  border-radius: var(--r-m);
  font-weight: 700;
  font-size: .88rem;
  text-align: center;
  border: 1px solid transparent;
  transition: filter .15s, transform .1s, opacity .15s;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-gold   { background: linear-gradient(145deg, #d9b95c, #a3862f); color: #1a1405; }
.btn-green  { background: var(--green); color: #06120a; }
.btn-danger { background: rgba(196,92,82,.16); border-color: var(--danger); color: #e8a29a; }
.btn-ghost  { background: var(--panel2); border-color: var(--border); color: var(--text); }
.btn-gold:hover:not(:disabled), .btn-green:hover:not(:disabled) { filter: brightness(1.08); }

.btn-mini { width: auto; padding: 8px 14px; font-size: .78rem; }
.btn-inline { width: auto; flex-shrink: 0; padding: 12px 18px; }

.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 8px;
  color: var(--faint);
  font-size: .9rem;
  flex-shrink: 0;
}
.icon-btn:hover { color: var(--danger); background: rgba(196,92,82,.1); }

.btn-retour {
  align-self: flex-start;
  color: var(--muted);
  font-size: .82rem;
  padding: 6px 2px 12px;
}
.btn-retour:hover { color: var(--gold); }

/* ---------- Sous-onglets ---------- */
.sous-onglets {
  display: flex;
  gap: 6px;
  margin: 4px 0 var(--gap);
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.sous-onglets::-webkit-scrollbar { display: none; }

.sous-onglet {
  flex: 1 0 auto;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
}
.sous-onglet.actif {
  background: rgba(201,168,76,.14);
  border-color: var(--goldDim);
  color: var(--gold);
}

/* ---------- Barres de progression ---------- */
.bar {
  width: 100%;
  height: 9px;
  background: rgba(0,0,0,.42);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.05);
}
.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--green);
  transition: width .45s cubic-bezier(.3,.9,.3,1);
}
.bar-fill.elo  { background: linear-gradient(90deg, #b5688f, var(--elo)); }
.bar-fill.miko { background: linear-gradient(90deg, #3f8a45, var(--miko)); }
.bar-fill.ju   { background: linear-gradient(90deg, #8a7128, var(--ju)); }
.bar-fill.familier { background: linear-gradient(90deg, #7a5236, var(--food)); }

/* ---------- Ressources ---------- */
.res {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  flex: 1;
  padding: 8px 4px;
  border-radius: var(--r-s);
  background: rgba(0,0,0,.24);
}
.res-icon  { font-size: 1.05rem; line-height: 1; }
.res-val   { font-size: .95rem; font-weight: 800; }
.res-label { font-size: .58rem; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }

.res-kama  .res-val { color: var(--kama); }
.res-reput .res-val { color: var(--reput); }
.res-food  .res-val { color: var(--food); }
.res-don   .res-val { color: var(--don); }
.res-xp    .res-val { color: var(--greenGlow); }

.grille-res {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: var(--gap);
}
.case-res {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 13px 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-m);
}
.case-res-icon { font-size: 1.25rem; line-height: 1; }
.case-res-val  { font-size: 1.15rem; font-weight: 800; }
.case-res-lbl  { font-size: .56rem; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; text-align: center; }
.case-res.res-kama  .case-res-val { color: var(--kama); }
.case-res.res-reput .case-res-val { color: var(--reput); }
.case-res.res-food  .case-res-val { color: var(--food); }
.case-res.res-don   .case-res-val { color: var(--don); }

.pulse { animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(127,199,192,.35); }
  50%      { box-shadow: 0 0 0 7px rgba(127,199,192,0); }
}

/* ---------- Pastilles ---------- */
.pastille {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--muted);
  white-space: nowrap;
}
.pastille.ok      { background: rgba(95,168,98,.16);  border-color: var(--green);  color: var(--greenGlow); }
.pastille.nego    { background: rgba(217,154,78,.16); border-color: var(--warn);   color: #e8bf85; }
.pastille.refus   { background: rgba(196,92,82,.16);  border-color: var(--danger); color: #e8a29a; }
.pastille.attente { background: rgba(138,158,134,.12); }

/* ---------- Notices ---------- */
.notice {
  padding: 12px 15px;
  border-radius: var(--r-m);
  font-size: .82rem;
  line-height: 1.55;
  margin-bottom: var(--gap);
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--muted);
}
.notice.ok        { background: rgba(95,168,98,.1);  border-color: rgba(95,168,98,.4);  color: #b8dcb8; }
.notice.danger    { background: rgba(196,92,82,.1);  border-color: rgba(196,92,82,.4);  color: #e8b0a8; }
.notice.attention { background: rgba(217,154,78,.1); border-color: rgba(217,154,78,.4); color: #e8cba0; }

/* ---------- État vide ---------- */
.empty {
  text-align: center;
  padding: 26px 14px;
  color: var(--faint);
  font-size: .85rem;
  line-height: 1.7;
}
.empty-icon { font-size: 2.2rem; display: block; margin-bottom: 10px; opacity: .8; }

/* ---------- Formulaires ---------- */
.form { display: flex; flex-direction: column; gap: 13px; }

.champ { display: flex; flex-direction: column; gap: 6px; }
.champ label {
  font-size: .74rem;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.facultatif { text-transform: none; color: var(--faint); font-weight: 400; letter-spacing: 0; }

.champ input, .champ select, .champ textarea {
  width: 100%;
  padding: 12px 13px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-s);
  font-size: .92rem;
  transition: border-color .15s;
}
.champ input:focus, .champ select:focus, .champ textarea:focus {
  outline: none;
  border-color: var(--goldDim);
}
.champ textarea { resize: vertical; min-height: 60px; line-height: 1.5; }
.champ select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 51%, calc(100% - 13px) 51%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; }

.champ-double { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }

.champ-suffixe { position: relative; display: flex; align-items: center; }
.champ-suffixe input { padding-right: 44px; }
.champ-suffixe span { position: absolute; right: 13px; color: var(--faint); font-size: .8rem; pointer-events: none; }

.ligne-champ { display: flex; gap: 9px; align-items: stretch; }
.ligne-champ input {
  flex: 1;
  min-width: 0;
  padding: 12px 13px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-s);
  font-size: .92rem;
}
.ligne-champ input:focus { outline: none; border-color: var(--goldDim); }

/* ---------- Interrupteur ---------- */
.bascule {
  width: 44px; height: 25px;
  border-radius: 999px;
  background: var(--panel3);
  border: 1px solid var(--border);
  padding: 2px;
  flex-shrink: 0;
  transition: background .18s, border-color .18s;
}
.bascule-pion {
  display: block;
  width: 19px; height: 19px;
  border-radius: 50%;
  background: var(--faint);
  transition: transform .18s cubic-bezier(.3,1.4,.5,1), background .18s;
}
.bascule.on { background: rgba(201,168,76,.24); border-color: var(--goldDim); }
.bascule.on .bascule-pion { transform: translateX(19px); background: var(--gold); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(100px + var(--safe-bas));
  transform: translate(-50%, 22px);
  max-width: min(90vw, 420px);
  padding: 12px 18px;
  border-radius: var(--r-m);
  background: rgba(25,43,26,.97);
  border: 1px solid var(--border-fort);
  color: var(--text);
  font-size: .83rem;
  line-height: 1.45;
  text-align: center;
  box-shadow: 0 12px 34px -10px rgba(0,0,0,.8);
  opacity: 0;
  pointer-events: none;
  z-index: 90;
  transition: opacity .22s, transform .22s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-ok     { border-color: var(--green); }
.toast-danger { border-color: var(--danger); background: rgba(48,22,20,.97); }

/* ---------- Modale ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(3,7,4,.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity .22s;
}
.modal-overlay.visible { opacity: 1; }

.modal {
  width: 100%;
  max-width: 520px;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border-fort);
  border-bottom: none;
  border-radius: var(--r-l) var(--r-l) 0 0;
  transform: translateY(30px);
  transition: transform .26s cubic-bezier(.3,1,.4,1);
}
.modal-overlay.visible .modal { transform: translateY(0); }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-head h2 { font-size: 1.02rem; color: var(--gold); }
.modal-close {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--muted);
  flex-shrink: 0;
}
.modal-close:hover { background: var(--panel2); color: var(--text); }

.modal-body {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
}
.modal-texte {
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.6;
  white-space: pre-line;
  margin-bottom: 14px;
}
.modal-body .modal-texte:last-child { margin-bottom: 0; }

.modal-actions {
  display: flex;
  gap: 10px;
  padding: 14px 18px calc(18px + var(--safe-bas));
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-actions .btn { flex: 1; }

@media (min-width: 640px) {
  .modal-overlay { align-items: center; }
  .modal { border-radius: var(--r-l); border-bottom: 1px solid var(--border-fort); }
  .modal-actions { padding-bottom: 18px; }
}

/* ---------- Squelette ---------- */
.skeleton {
  height: 68px;
  border-radius: var(--r-m);
  margin-bottom: 10px;
  background: linear-gradient(90deg, var(--panel) 25%, var(--panel2) 50%, var(--panel) 75%);
  background-size: 200% 100%;
  animation: scintille 1.4s linear infinite;
}
@keyframes scintille { to { background-position: -200% 0; } }
