/* PonsGrass — DA v3 : sombre et minimale. Un fond presque noir, des surfaces plates,
   une seule couleur d'accent (le vert de l'herbe) et un or reserve au token.
   Composants partages entre la landing et le jeu. */
@import url("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,700;12..96,800&family=Inter:wght@400;500;600;700&display=swap");

:root {
  /* fonds : du plus profond au plus clair */
  --bg: #090c0a; --bg-2: #0d110f; --surface: #121714; --surface-2: #18201a; --surface-3: #1e2721;
  /* traits */
  --line: #232c26; --line-2: #2d382f; --line-3: #3a4a3d;
  /* texte */
  --ink: #e7ece8; --ink-2: #a7b2a9; --muted: #6d7a71;
  /* accents */
  --accent: #7fd957; --accent-2: #63bd3d; --accent-dim: rgba(127, 217, 87, .12); --accent-line: rgba(127, 217, 87, .3);
  --gold: #e3b552; --gold-2: #c0912f; --gold-dim: rgba(227, 181, 82, .12);
  --danger: #e0685c;
  /* raretes, desaturees pour tenir sur du sombre */
  --c-Common: #8b9a86; --c-Uncommon: #6cc25f; --c-Rare: #5b9bf0; --c-Epic: #a874ee; --c-Legendary: #e8b23f; --c-Mythic: #f2568e;
  --wheat: #e9c46a; --rust: #d2724a;
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --display: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
  --r: 10px; --r-lg: 16px; --r-xl: 22px;
  --shadow: 0 18px 40px rgba(0, 0, 0, .5);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, .35);
  --grad: linear-gradient(135deg, #b6ef6f 0%, #7fd957 42%, #46a85e 100%);
  --glow: 0 0 60px rgba(127, 217, 87, .18);
  /* liseré clair en haut des surfaces : c'est lui qui donne le relief sans ombre portée */
  --lip: inset 0 1px 0 rgba(255, 255, 255, .07);
}
* { box-sizing: border-box; }
html, body { margin: 0; color: var(--ink); font-family: var(--font); font-weight: 400; font-size: 15px; background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2 { font-family: var(--display); font-weight: 800; letter-spacing: -.035em; line-height: 1.04; }
h3, h4 { font-family: var(--display); font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }
::selection { background: var(--accent); color: #06210a; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-weight: 400; }

/* ---------- surfaces : deux niveaux, meme grammaire.
   Les noms .plank et .paper viennent de l'ancienne DA et restent utilises par le JS. */
.plank, .paper { position: relative; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.plank { background: var(--surface-2); border-color: var(--line-2); }
.paper.stitched::before { content: none; }

/* ---------- rappel d'herbe : un filet vert, discret, en haut des cartes */
.grass-edge::before { content: ""; position: absolute; left: 16px; right: 16px; top: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--accent-line), transparent); }

/* ---------- carte : la brique de base de la landing.
   Un fond translucide, un liseré clair en haut, et un halo vert qui s'allume au survol. */
.card { position: relative; border-radius: var(--r-lg); background: linear-gradient(180deg, rgba(28, 36, 30, .62), rgba(16, 21, 18, .62)); border: 1px solid var(--line); box-shadow: var(--lip); backdrop-filter: blur(10px); transition: border-color .25s, transform .25s, box-shadow .25s; }
.card::after { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; background: linear-gradient(140deg, rgba(127, 217, 87, .5), transparent 42%); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; opacity: 0; transition: opacity .25s; pointer-events: none; }
.card:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: var(--lip), 0 20px 44px rgba(0, 0, 0, .45); }
.card:hover::after { opacity: 1; }

/* ---------- petits elements de mise en page partages */
.label { display: inline-block; font-family: var(--display); font-size: 11px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); margin-bottom: 20px; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.arrow { display: inline-block; transition: transform .2s; }
.btn:hover .arrow, a:hover .arrow { transform: translateX(3px); }
/* grain : une trame fine sur toute la page, c'est ce qui evite l'aplat mort */
.grain { position: fixed; inset: 0; z-index: 3; pointer-events: none; opacity: .5; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.42'/%3E%3C/svg%3E"); }

/* ---------- boutons */
.btn { cursor: pointer; border: 1px solid var(--line-2); border-radius: 11px; height: 40px; padding: 0 18px; font-family: var(--font); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap; color: var(--ink); background: var(--surface-2); transition: background .15s, border-color .15s, transform .08s, opacity .15s; line-height: 1; }
.btn:hover:not(:disabled) { background: var(--surface-3); border-color: var(--line-3); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .38; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #08240b; font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: #8fe665; border-color: #8fe665; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #2b1f05; font-weight: 600; }
.btn.gold:hover:not(:disabled) { background: #efc465; border-color: #efc465; }
.btn.kraft, .btn.paperbtn { background: transparent; border-color: var(--line-2); color: var(--ink-2); }
.btn.kraft:hover:not(:disabled), .btn.paperbtn:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--ink-2); }
.btn.big { font-size: 15.5px; height: 50px; padding: 0 26px; border-radius: 13px; }
.btn.small { font-size: 13px; height: 32px; padding: 0 13px; border-radius: 9px; }

/* ---------- pastilles */
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 6px; background: var(--accent-dim); color: var(--accent); font-family: var(--display); font-weight: 600; font-size: 12px; border: 1px solid var(--accent-line); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); font-size: 12px; font-weight: 500; }
.pill b { color: var(--ink); font-weight: 600; }

/* ---------- raretes : un point de couleur, pas un aplat */
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; margin: 4px 4px 0 0; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c-Common); }
.chip.r-Common::before { background: var(--c-Common); } .chip.r-Uncommon::before { background: var(--c-Uncommon); } .chip.r-Rare::before { background: var(--c-Rare); } .chip.r-Epic::before { background: var(--c-Epic); } .chip.r-Legendary::before { background: var(--c-Legendary); }
.chip.r-Mythic::before { background: var(--c-Mythic); box-shadow: 0 0 8px var(--c-Mythic); }

/* ---------- barres de progression */
.bar { height: 5px; border-radius: 999px; overflow: hidden; position: relative; background: var(--line); }
.bar > i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--accent); transition: width .35s ease; }
.bar.gold > i { background: var(--gold); }
.bar.striped > i { background: var(--gold); }

/* ---------- overlays et panneaux */
.overlay { position: fixed; inset: 0; background: rgba(4, 7, 5, .72); z-index: 40; display: flex; align-items: center; justify-content: center; animation: fade .18s ease-out; padding: 16px; backdrop-filter: blur(6px); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.panel { width: min(560px, 96vw); padding: 0; animation: pop .2s cubic-bezier(.2, .9, .3, 1.1); max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.panel.wide { width: min(920px, 96vw); }
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: 0; } to { transform: none; opacity: 1; } }
.panel .ph { padding: 18px 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.panel .ph h2 { margin: 0; font-size: 18px; display: flex; align-items: center; gap: 12px; }
.panel .ph .x { width: 30px; height: 30px; border-radius: 8px; background: transparent; border: 1px solid var(--line-2); cursor: pointer; font-size: 18px; line-height: 1; color: var(--muted); transition: background .15s, color .15s; }
.panel .ph .x:hover { background: var(--surface-2); color: var(--ink); }
.panel .pb { padding: 22px 24px 24px; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--line-3) transparent; }
.panel .pb::-webkit-scrollbar { width: 8px; }
.panel .pb::-webkit-scrollbar-track { background: transparent; }
.panel .pb::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }
.panel .pb::-webkit-scrollbar-thumb:hover { background: var(--line-3); }
.panel p { line-height: 1.6; margin: 6px 0 14px; color: var(--ink-2); font-size: 14px; }
.panel p b { color: var(--ink); font-weight: 600; }
.actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.row { display: flex; align-items: center; gap: 14px; margin: 12px 0; font-size: 14px; }
.row label { width: 80px; color: var(--muted); font-size: 13px; }
.row b { font-family: var(--display); font-weight: 600; }
.qty { display: flex; align-items: center; gap: 14px; font-size: 18px; font-family: var(--display); font-weight: 600; }

/* ---------- cartes outil : l'image porte tout, le texte se fait oublier */
.tool-card { position: relative; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 8px 12px; text-align: left; overflow: hidden; transition: border-color .18s, transform .18s; }
.tool-card:hover { border-color: var(--line-3); transform: translateY(-2px); }
.tool-card img { width: 100%; aspect-ratio: 1; height: auto; object-fit: cover; border-radius: 7px; display: block; }
.tool-card .n { font-family: var(--display); font-weight: 600; font-size: 14px; margin: 10px 0 0 2px; }
.tool-card .s { font-size: 12px; color: var(--muted); margin-left: 2px; }
.tool-card .r { position: absolute; top: 14px; right: 14px; font-size: 10px; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; background: rgba(6, 10, 7, .72); backdrop-filter: blur(4px); color: var(--c-Common); }
.tool-card a { font-size: 12px; margin-left: 2px; }
.tool-card.r-Common .r { color: var(--c-Common); } .tool-card.r-Uncommon .r { color: var(--c-Uncommon); } .tool-card.r-Rare .r { color: var(--c-Rare); } .tool-card.r-Epic .r { color: var(--c-Epic); } .tool-card.r-Legendary .r { color: var(--c-Legendary); }
.tool-card.r-Mythic .r { color: var(--c-Mythic); }
.tool-card.r-Uncommon:hover { border-color: var(--c-Uncommon); } .tool-card.r-Rare:hover { border-color: var(--c-Rare); } .tool-card.r-Epic:hover { border-color: var(--c-Epic); } .tool-card.r-Legendary:hover { border-color: var(--c-Legendary); }
.tool-card.r-Mythic { border-color: rgba(242, 86, 142, .35); }
.tool-card.r-Mythic:hover { border-color: var(--c-Mythic); }
.tool-card .reroll { margin-top: 10px; width: 100%; font-size: 12px; padding: 7px 8px; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; }
.reveal-grid { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; justify-content: center; }
.reveal-grid .tool-card { width: 158px; animation: pop .35s cubic-bezier(.2, .9, .3, 1.2) both; }
.reveal-grid .tool-card:nth-child(2) { animation-delay: .08s; } .reveal-grid .tool-card:nth-child(3) { animation-delay: .16s; } .reveal-grid .tool-card:nth-child(4) { animation-delay: .24s; } .reveal-grid .tool-card:nth-child(5) { animation-delay: .32s; }
.rarity-head { display: flex; align-items: baseline; gap: 10px; margin: 26px 0 10px; font-family: var(--display); font-size: 14px; font-weight: 600; }
.rarity-head:first-child { margin-top: 6px; }
.rarity-head .pct { font-size: 12px; color: var(--muted); font-family: var(--font); font-weight: 400; }

/* ---------- labels flottants au-dessus de la scene 3D */
.float-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 3; }
.float-label { position: absolute; left: 0; top: 0; font-weight: 600; font-size: 14px; color: var(--ink); text-shadow: 0 1px 6px rgba(0, 0, 0, .9); will-change: transform; white-space: nowrap; font-family: var(--display); }
.float-label.big { font-size: 20px; color: var(--gold); }
.float-label.lucky { font-size: 21px; color: var(--accent); }

/* ---------- toasts */
#toasts { position: fixed; top: 72px; right: 18px; z-index: 50; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { padding: 12px 16px; font-size: 13px; font-weight: 500; animation: slide .2s ease-out; max-width: 340px; background: var(--surface-2); border: 1px solid var(--line-2); border-left: 2px solid var(--line-3); border-radius: var(--r); box-shadow: var(--shadow-sm); color: var(--ink-2); }
.toast.ok { border-left-color: var(--accent); } .toast.err { border-left-color: var(--danger); } .toast.lucky { border-left-color: var(--gold); }
@keyframes slide { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }
