/* Portail — style commun (page d'accueil + pages légales) */
:root {
  --bg: #0f0d14;
  --bg2: #1a1622;
  --card: #1e1a28;
  --line: #3a3348;
  --text: #f5f2fa;
  --muted: #b9b2c8;
  --accent: #ffc93c;
  --accent2: #ff7aa8;
  --gold: #ffc93c;
  --ok: #69f0ae;
  --bad: #ff6e7a;
  --radius: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 50% -10%, #3a2a55 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}
a { color: var(--accent); }
button { font: inherit; cursor: pointer; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* barre du haut */
header.top {
  position: sticky; top: 0; z-index: 10;
  background: rgba(15, 13, 20, .85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
header.top .wrap { display: flex; align-items: center; gap: 12px; height: 60px; position: relative; }
.logo { font-weight: 900; font-size: 22px; letter-spacing: .5px; text-decoration: none; color: var(--text); }
.logo { display: inline-flex; align-items: center; gap: 8px; }
.logo img { width: 34px; height: 34px; }
.logo b { background: linear-gradient(90deg, var(--accent2), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .rat { width: 130px; height: 130px; display: block; margin: 0 auto 6px; animation: ratbob 3s ease-in-out infinite; filter: drop-shadow(0 8px 18px rgba(255, 201, 60, .25)); }
@keyframes ratbob { 50% { transform: translateY(-6px) rotate(-3deg); } }
.spacer { flex: 1; }
.wallet {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: #2a1544; border: 1px solid var(--line); font-weight: 800; color: var(--gold); white-space: nowrap;
}
.vip-badge { color: var(--gold); font-weight: 900; }
.btn {
  border: 0; border-radius: 12px; padding: 10px 16px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 6px 20px rgba(224, 64, 251, .25);
}
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; border: 1px solid var(--line); box-shadow: none; color: var(--text); }
.btn.small { padding: 6px 12px; font-size: 14px; }

/* sections */
.hero { text-align: center; padding: 48px 0 24px; }
.hero h1 { font-size: clamp(28px, 6vw, 48px); margin: 0 0 8px; line-height: 1.1; }
.hero p { color: var(--muted); margin: 0 auto; max-width: 560px; }
h2 { font-size: 24px; margin: 40px 0 14px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  display: flex; flex-direction: column; gap: 8px;
}
.app { position: relative; overflow: hidden; color: #fff; text-decoration: none; min-height: 180px; border: 0; }
.app .emoji { font-size: 44px; line-height: 1; }
.app h3 { margin: 4px 0 0; font-size: 22px; }
.app p { margin: 0; opacity: .9; font-size: 14px; flex: 1; }
.app .go { align-self: flex-start; background: rgba(0,0,0,.28); padding: 6px 12px; border-radius: 10px; font-weight: 800; }
.app:hover { transform: translateY(-3px); transition: transform .15s; }
.aura { background: linear-gradient(135deg, #e040fb, #5e35b1); }
.cdx { background: linear-gradient(135deg, #ffb300, #e65100); }
.iron { background: linear-gradient(135deg, #546e7a, #1b2730); }
.zoo { background: linear-gradient(135deg, #43a047, #1b5e20); }
.squad { background: linear-gradient(135deg, #1e88e5, #0b3d6e); }
.flyer { background: linear-gradient(135deg, #ff7043, #6a1b9a); }
.uc { background: linear-gradient(135deg, #7c4dff, #c62828); }
.dessin { background: linear-gradient(135deg, #ff7a45, #d4380d); }
.roll { background: linear-gradient(135deg, #3a1c71, #d76d77 60%, #ffaf7b); }
.paris { background: linear-gradient(135deg, #7e57c2, #ff7aa8); }
.profil { background: linear-gradient(135deg, #546e7a, #ffc93c); }
.boussole { background: linear-gradient(135deg, #ffb300, #6d4c41); }
.dragons { background: linear-gradient(135deg, #8e24aa, #e65100); }
.ile { background: linear-gradient(135deg, #13c2c2, #0b6c9e); }
.courses { background: linear-gradient(135deg, #43a047, #0f3d1a); }
.argent { background: linear-gradient(135deg, #3d8bfd, #0d2350); }
.eco { background: linear-gradient(135deg, #2ecc8f, #0b3b2c); }
.chrono { background: linear-gradient(135deg, #e53935, #3a0d0d); }
.droides { background: linear-gradient(135deg, #22c1ee, #101a3a); }
.krav { background: linear-gradient(135deg, #8d6e63, #2b1a14); }
.clubc { background: linear-gradient(135deg, #e53935, #1a2030); }
.stats-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 10px; }
.stat { padding: 14px; gap: 4px; }
.stat h3 { margin: 0 0 6px; font-size: 16px; }
.stat .n { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--muted); }
.stat .n b { color: var(--text); font-size: 16px; }
.stat .lead { margin-top: 6px; font-size: 13px; color: var(--gold); }
.pack .amount { font-size: 28px; font-weight: 900; color: var(--gold); }
.pack .price { font-size: 20px; font-weight: 800; }
.bonus { display: inline-block; font-size: 12px; font-weight: 800; color: #000; background: var(--ok); border-radius: 999px; padding: 2px 8px; }
.muted { color: var(--muted); }
.demo-note { border: 1px dashed var(--gold); color: var(--gold); border-radius: 12px; padding: 10px 14px; margin: 0 0 14px; font-size: 14px; }
.vip-card { background: linear-gradient(135deg, #3d2a00, #2a1544); border-color: #8d6e00; }
table.hist { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 6px; }
.hist-box { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; }
.hist-box summary { cursor: pointer; padding: 11px 0; font-weight: 800; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.hist-box summary::-webkit-details-marker { display: none; }
.hist-box summary::after { content: 'Afficher ▾'; color: var(--muted); font-weight: 700; font-size: 13px; }
.hist-box[open] summary::after { content: 'Masquer ▴'; }
.hist-box[open] { padding-bottom: 8px; }
table.hist .times { color: var(--gold); font-weight: 800; }
table.hist td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
table.hist td.num { text-align: right; font-weight: 800; white-space: nowrap; }
.plus { color: var(--ok); } .minus { color: var(--bad); }

/* fenêtres */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal-back.open { display: flex; }
.modal { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; width: 100%; max-width: 420px; max-height: 90vh; overflow: auto; }
.modal h3 { margin-top: 0; }
label.field { display: block; margin: 10px 0; font-size: 14px; color: var(--muted); }
label.field input { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #120a1c; color: var(--text); font: inherit; }
label.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); margin: 10px 0; }
label.check input { margin-top: 3px; flex: none; }
.error { color: var(--bad); font-size: 14px; min-height: 1.2em; }
.tabs { display: flex; gap: 8px; margin-bottom: 8px; }
.tabs button { flex: 1; background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 10px; padding: 8px; font-weight: 700; }
.tabs button.on { color: var(--text); border-color: var(--accent); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #2a1544; border: 1px solid var(--accent); padding: 10px 16px; border-radius: 12px; font-weight: 800; display: none; z-index: 60; }

footer { margin-top: 56px; border-top: 1px solid var(--line); padding: 20px 0 40px; color: var(--muted); font-size: 14px; }
footer nav { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 8px; }
footer a { color: var(--muted); }

/* pages légales */
.legal { max-width: 820px; margin: 0 auto; padding: 24px 16px 40px; }
.legal h1 { font-size: 30px; }
.legal h2 { font-size: 20px; margin-top: 28px; }
.legal .todo { background: #3d2a00; color: var(--gold); padding: 0 4px; border-radius: 4px; }
.legal .maj { color: var(--muted); font-size: 14px; }

@media (max-width: 520px) {
  header.top .wrap { gap: 8px; }
  .logo { font-size: 18px; }
  .hide-sm { display: none; }
}

.apk-line { margin: 10px 2px 0; font-size: 14px; }
.apk-line a { color: inherit; font-weight: 800; }

/* ---------- amis ---------- */
.fr-search { position: relative; }
.fr-search input { width: 100%; font: inherit; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); }
.fr-res { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 10; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.fr-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.fr-row:last-child { border-bottom: 0; }
.fr-row .t { flex: 1; min-width: 0; }
.fr-row .t small { display: block; color: var(--muted); font-size: 13px; }
.fr-av { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 13px; background: var(--accent2); flex: none; }
.fr-h { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin: 16px 2px 6px; font-weight: 800; }
.fr-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.fr-tabs button { border: 1px solid var(--line); background: var(--bg2); color: var(--text); border-radius: 99px; padding: 6px 12px; font-size: 14px; }
.fr-tabs button.on { background: var(--accent2); border-color: var(--accent2); }
.fr-rank { width: 100%; border-collapse: collapse; }
.fr-rank td { padding: 8px 6px; border-bottom: 1px solid var(--line); }
.fr-rank tr.me td { color: var(--gold); font-weight: 800; }

/* ---------- installer l'appli (petit bouton en haut) ---------- */
.inst-top { background: none; border: 1px solid var(--line); border-radius: 10px; color: var(--text); font-size: 17px; line-height: 1; padding: 6px 8px; cursor: pointer; opacity: .75; flex: none; }
.inst-top:hover { opacity: 1; }
.inst-pop { position: absolute; right: 12px; top: calc(100% + 6px); z-index: 50; width: min(300px, calc(100vw - 24px)); background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; box-shadow: 0 12px 30px rgba(0,0,0,.5); font-size: 15px; }
.inst-h { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.inst-h img { width: 36px; height: 36px; border-radius: 9px; flex: none; }
.inst-steps { margin: 0; padding-left: 20px; }
.inst-steps li { margin: 3px 0; }
.ios-share { display: inline-block; border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; }

/* ⭐ favoris (étoile en haut à droite de chaque appli) */
.card.app { position: relative; }
.card.app .fav { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(0,0,0,.35); color: #fff; font-size: 19px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; transition: transform .15s; }
.card.app .fav:hover { transform: scale(1.12); }
.card.app .fav.on { color: #ffd54f; background: rgba(0,0,0,.5); text-shadow: 0 0 8px rgba(255,213,79,.7); }
#favBox .grid { margin-bottom: 4px; }
.cartes { background: linear-gradient(135deg, #2e7d32, #0b3d1f); }
.raccourcis { background: linear-gradient(135deg, #455a64, #ffb300); }
.scan { background: linear-gradient(135deg, #43a047, #00695c); }
.monclub { background: linear-gradient(135deg, #e53935, #1b5e20); }
.ia { background: linear-gradient(135deg, #b8860b, #c2185b); }
.cloud { background: linear-gradient(135deg, #0277bd, #5e35b1); }
.messages { background: linear-gradient(135deg, #00a884, #b71c1c); }
.loupgarou { background: linear-gradient(135deg, #3a2a6e, #10091f); }
.kifkif { background: linear-gradient(135deg, #1f5aa6, #ff7aa8); }
.taille { background: linear-gradient(135deg, #b5541f, #f2c14e); }
.linkbtn { background: none; border: 0; padding: 4px; color: var(--gold, #f5c542); text-decoration: underline; font: inherit; font-size: 14px; cursor: pointer; }

/* ---- accueil plus rapide (accueil.js) : recherche, compact, récents, en-tête réduit ---- */
.home-bar { display: flex; gap: 8px; align-items: center; margin: 4px 0 6px; position: sticky; top: 62px; z-index: 5; padding: 6px 0; background: linear-gradient(var(--bg) 70%, transparent); }
.home-search { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 0 12px; min-width: 0; }
.home-search:focus-within { border-color: var(--accent); }
.home-search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 16px; padding: 12px 0; }
.home-view { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-size: 20px; cursor: pointer; }
.home-hide { display: none !important; }
.home-none { text-align: center; margin: 24px 0; }
.home-rec { display: flex; gap: 8px; align-items: center; overflow-x: auto; padding: 4px 0 6px; scrollbar-width: none; }
.home-rec::-webkit-scrollbar { display: none; }
.home-rec > span { flex: 0 0 auto; font-size: 13px; }
.home-rec a { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-weight: 700; font-size: 14px; }
body.home-logged .hero { display: grid; grid-template-columns: 64px 1fr; column-gap: 12px; align-items: center; text-align: left; padding: 18px 0 8px; }
body.home-logged .hero .rat { width: 64px; height: 64px; margin: 0; grid-row: 1 / span 2; }
body.home-logged .hero h1 { font-size: 24px; margin: 0; align-self: end; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.home-logged .hero p { margin: 0; font-size: 14px; align-self: start; }
body.home-searching .hero, body.home-searching #recentBox, body.home-searching #favBox { display: none; }
body.home-compact main .grid:not(#packs):not(.stats-grid) { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
body.home-compact .card.app { min-height: 104px; padding: 12px; gap: 4px; border-radius: 16px; justify-content: flex-end; }
body.home-compact .card.app .emoji { font-size: 30px; }
body.home-compact .card.app h3 { font-size: 16px; line-height: 1.2; margin: 2px 0 0; }
body.home-compact .card.app p, body.home-compact .card.app .go { display: none; }
body.home-compact .card.app .fav { width: 30px; height: 30px; font-size: 16px; top: 6px; right: 6px; }
body.home-compact h2 { margin: 26px 0 10px; font-size: 20px; }
