/* Gnaga à Babi — feuille de style. Palette chaude, couleurs du drapeau, motifs inspirés du pagne et du kita. */
@font-face { font-family: 'Luckiest Guy'; src: url('../assets/fonts/LuckiestGuy-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Lilita One'; src: url('../assets/fonts/LilitaOne-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('../assets/fonts/Nunito.ttf') format('truetype'); font-weight: 200 1000; font-display: swap; }

:root {
  --bg: #1b0f07;
  --bg2: #26150a;
  --panel: #3a2111;
  --panel2: #4a2b16;
  --panel3: #5c361c;
  --line: #74482a;
  --text: #fff4e2;
  --muted: #d8bd98;
  --dim: #a88a68;
  --orange: #f58220;
  --orange-d: #b4560c;
  --green: #22a64f;
  --green-d: #12722f;
  --gold: #ffcf4a;
  --gold-d: #c4860c;
  --blue: #2f7fe0;
  --blue-d: #17508f;
  --red: #e0483a;
  --red-d: #8f2017;
  --cream: #fff1d6;
  --ginger: #f2a51e;
  --radius: 14px;
  --title: 'Luckiest Guy', 'Lilita One', system-ui, sans-serif;
  --btnfont: 'Lilita One', system-ui, sans-serif;
  --body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --kente: repeating-linear-gradient(90deg, #f58220 0 14px, #1b0f07 14px 17px, #ffcf4a 17px 27px, #1b0f07 27px 30px, #22a64f 30px 44px, #1b0f07 44px 47px, #fff1d6 47px 52px, #1b0f07 52px 55px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: var(--body);
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 25% 25%, rgba(245, 130, 32, 0.12) 0 10%, transparent 11%),
    radial-gradient(circle at 25% 25%, rgba(245, 130, 32, 0.06) 0 18%, transparent 19%),
    radial-gradient(circle at 75% 75%, rgba(34, 166, 79, 0.12) 0 10%, transparent 11%),
    radial-gradient(circle at 75% 75%, rgba(34, 166, 79, 0.06) 0 18%, transparent 19%),
    radial-gradient(circle at 75% 25%, rgba(255, 207, 74, 0.07) 0 5%, transparent 6%),
    radial-gradient(circle at 25% 75%, rgba(255, 241, 214, 0.05) 0 5%, transparent 6%);
  background-size: 72px 72px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; }
input { font: inherit; }

#app {
  position: relative;
  width: 100%;
  max-width: 520px;
  height: 100%;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(27, 15, 7, 0.55), rgba(27, 15, 7, 0.85));
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.6);
}

.ico { display: inline-flex; width: 1em; height: 1em; vertical-align: -0.15em; }
.ico svg { width: 100%; height: 100%; fill: currentColor; }
.cur { display: inline-block; width: 1.25em; height: 1.25em; vertical-align: -0.28em; }
.cur svg { width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
.title-font { font-family: var(--title); letter-spacing: 0.02em; }

/* ------------------------------------------------------------------ boutons */
.btn {
  --c0: #ffb066; --c1: var(--orange); --c2: var(--orange-d);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4em;
  min-height: 44px; padding: 0.55em 1.1em 0.6em;
  border: 0; border-radius: 12px;
  font-family: var(--btnfont); font-size: 1.05rem; letter-spacing: 0.02em; color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  background: linear-gradient(180deg, var(--c0), var(--c1) 55%, var(--c2));
  box-shadow: 0 4px 0 var(--c2), 0 6px 12px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: transform 0.06s, box-shadow 0.06s, filter 0.15s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--c2), 0 2px 6px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
.btn[disabled], .btn.disabled { filter: grayscale(0.85) brightness(0.75); cursor: default; }
.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn.green { --c0: #6fdc8c; --c1: var(--green); --c2: var(--green-d); }
.btn.blue { --c0: #8cc4ff; --c1: var(--blue); --c2: var(--blue-d); }
.btn.red { --c0: #ff9a8c; --c1: var(--red); --c2: var(--red-d); }
.btn.gold { --c0: #ffe9a0; --c1: #ffc21a; --c2: #b37400; color: #4a2a00; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4); }
.btn.ghost { --c0: #7a4d2c; --c1: var(--panel3); --c2: #2a170b; }
.btn.small { min-height: 34px; font-size: 0.92rem; padding: 0.35em 0.8em 0.4em; border-radius: 10px; }
.btn.big { min-height: 64px; font-size: 1.7rem; padding: 0.5em 1.6em; border-radius: 18px; font-family: var(--title); }
.btn.block { width: 100%; }
.btn .cur { width: 1.1em; height: 1.1em; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 12px; border: 0;
  background: rgba(0, 0, 0, 0.35); color: var(--cream); font-size: 1.35rem; cursor: pointer;
}
.icon-btn:active { transform: scale(0.94); }

/* ------------------------------------------------------------------ écran d'accueil (chargement) */
.splash {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  padding: 24px; text-align: center;
  background: radial-gradient(circle at 50% 40%, rgba(245, 130, 32, 0.35), transparent 60%), linear-gradient(180deg, #2a1206, #120802);
}
.logo { font-family: var(--title); line-height: 0.92; text-align: center; transform: rotate(-3deg); }
.logo .l1 {
  display: block; font-size: clamp(3.2rem, 17vw, 5.4rem); color: var(--orange);
  -webkit-text-stroke: 3px #2a1206; text-shadow: 0 5px 0 #2a1206, 0 8px 0 var(--green-d), 0 12px 18px rgba(0, 0, 0, 0.6);
}
.logo .l2 {
  display: block; font-size: clamp(2.1rem, 11vw, 3.5rem); color: var(--cream);
  -webkit-text-stroke: 2px #2a1206; text-shadow: 0 4px 0 #2a1206, 0 7px 0 var(--orange-d);
}
.logo .tag { display: block; margin-top: 14px; font-family: var(--btnfont); font-size: 1rem; color: var(--gold); transform: rotate(3deg); letter-spacing: 0.05em; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5); }
.kente-band { height: 8px; width: 100%; background: var(--kente); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4); }
.loadbar { width: min(320px, 80%); height: 18px; border-radius: 10px; background: rgba(0, 0, 0, 0.5); border: 2px solid #5a3418; overflow: hidden; }
.loadbar i { display: block; height: 100%; width: 0; background: var(--kente); background-size: 55px 100%; transition: width 0.2s; }
.splash .hint { font-family: var(--btnfont); color: var(--muted); font-size: 1.05rem; }
.splash .pulse { animation: pulse 1.2s ease-in-out infinite; }
.splash .foot { position: absolute; bottom: calc(14px + var(--safe-bottom)); font-size: 0.78rem; color: var(--dim); }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.06); opacity: 0.8; } }

/* ------------------------------------------------------------------ profils */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }
.profiles { padding: calc(18px + var(--safe-top)) 16px calc(16px + var(--safe-bottom)); overflow-y: auto; gap: 14px; }
.profiles h1 { margin: 6px 0 2px; text-align: center; font-family: var(--title); font-size: 2.1rem; color: var(--gold); text-shadow: 0 3px 0 #2a1206; }
.profiles .sub { text-align: center; color: var(--muted); margin: 0 0 6px; }
.profile-list { display: grid; gap: 10px; }
.profile-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 2px solid var(--line); cursor: pointer; text-align: left;
  box-shadow: 0 4px 0 #1c0f06;
}
.profile-row:active { transform: translateY(2px); box-shadow: 0 2px 0 #1c0f06; }
.profile-row .meta { flex: 1; min-width: 0; }
.profile-row .name { font-family: var(--btnfont); font-size: 1.25rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-row .info { color: var(--muted); font-size: 0.9rem; display: flex; gap: 10px; align-items: center; }
.profile-row .lock { color: var(--gold); font-size: 1.2rem; }

.avatar {
  --size: 52px; --c: var(--orange);
  flex: none; position: relative; width: var(--size); height: var(--size); border-radius: 30%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0) 55%), radial-gradient(circle at 50% 120%, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0) 60%), var(--c);
  border: 3px solid #2a1206; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.3);
  display: flex; align-items: center; justify-content: center; color: #fff6e2;
}
.avatar svg { width: 72%; height: 72%; fill: currentColor; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.35)); }
.avatar .lvl {
  position: absolute; right: -8px; bottom: -8px; min-width: 24px; height: 24px; padding: 0 4px; border-radius: 12px;
  background: linear-gradient(180deg, #6cb6ff, var(--blue)); border: 2px solid #0f2a52; font-family: var(--btnfont); font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center; color: #fff;
}

.form { display: grid; gap: 12px; }
.field label { display: block; font-family: var(--btnfont); margin-bottom: 6px; color: var(--gold); }
.field input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line); background: #1e1008; color: var(--text);
  font-size: 1.1rem; outline: none; user-select: text; -webkit-user-select: text;
}
.field input:focus { border-color: var(--orange); }
.field small { color: var(--dim); }
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; }
.avatar-grid button { padding: 0; border: 0; background: none; cursor: pointer; display: flex; justify-content: center; }
.avatar-grid button.sel .avatar { outline: 3px solid var(--gold); outline-offset: 2px; }
.color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.color-row button { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #2a1206; cursor: pointer; }
.color-row button.sel { outline: 3px solid var(--gold); outline-offset: 2px; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 64px); gap: 10px; justify-content: center; }
.pin-pad button { height: 56px; border-radius: 14px; border: 0; background: var(--panel3); font-family: var(--btnfont); font-size: 1.5rem; color: var(--cream); box-shadow: 0 3px 0 #1c0f06; cursor: pointer; }
.pin-pad button:active { transform: translateY(2px); box-shadow: 0 1px 0 #1c0f06; }
.pin-dots { display: flex; gap: 12px; justify-content: center; margin: 6px 0 14px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; background: rgba(255, 255, 255, 0.15); border: 2px solid var(--line); }
.pin-dots i.on { background: var(--gold); border-color: var(--gold-d); }
.shake { animation: shake 0.35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ------------------------------------------------------------------ coque principale */
.main { background: transparent; }
.topbar {
  flex: none; display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--safe-top)) 10px 8px;
  background: linear-gradient(180deg, #3d2210, #2a170b); position: relative;
}
.topbar::after { content: ''; position: absolute; left: 0; right: 0; bottom: -6px; height: 6px; background: var(--kente); opacity: 0.9; }
.topbar .who { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
.topbar .who .avatar { --size: 40px; }
.topbar .who .name { font-family: var(--btnfont); font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .who .xp { height: 7px; width: 80px; border-radius: 4px; background: rgba(0, 0, 0, 0.45); overflow: hidden; margin-top: 3px; }
.topbar .who .xp i { display: block; height: 100%; background: linear-gradient(90deg, #6cb6ff, var(--blue)); }
.pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px 3px 4px; border-radius: 20px;
  background: rgba(0, 0, 0, 0.45); border: 1.5px solid rgba(255, 255, 255, 0.08); font-family: var(--btnfont); font-size: 0.95rem; white-space: nowrap;
}
.pill .cur { width: 1.35em; height: 1.35em; }

.content { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px 12px 18px; -webkit-overflow-scrolling: touch; }
.content::-webkit-scrollbar { width: 0; }

.tabbar {
  flex: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; padding: 6px 6px calc(6px + var(--safe-bottom));
  background: linear-gradient(180deg, #2a170b, #1a0d05); position: relative;
}
.tabbar::before { content: ''; position: absolute; left: 0; right: 0; top: -6px; height: 6px; background: var(--kente); opacity: 0.9; }
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px 4px; border: 0; border-radius: 12px;
  background: transparent; color: var(--dim); font-family: var(--btnfont); font-size: 0.78rem; cursor: pointer; transition: transform 0.15s;
}
.tab .ico { font-size: 1.65rem; }
.tab.on { background: linear-gradient(180deg, var(--panel3), var(--panel)); color: var(--gold); transform: translateY(-6px); box-shadow: 0 4px 0 #120902; }
.tab .dot { position: absolute; margin: -4px 0 0 26px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); border: 2px solid #1a0d05; }
.tab { position: relative; }

.section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 18px 2px 10px; font-family: var(--btnfont); font-size: 1.15rem; color: var(--gold); }
.section-title small { font-family: var(--body); font-size: 0.85rem; color: var(--muted); }
.panel { background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 2px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: 0 4px 0 #1c0f06; }

/* ------------------------------------------------------------------ accueil */
.arena-card {
  position: relative; border-radius: 18px; overflow: hidden; padding: 16px; min-height: 172px; cursor: pointer; border: 3px solid #2a1206;
  box-shadow: 0 5px 0 #120902, 0 10px 24px rgba(0, 0, 0, 0.45); display: flex; flex-direction: column; justify-content: flex-end;
}
.arena-card .bg { position: absolute; inset: 0; }
.arena-card .bg .arena-scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.arena-card .bg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.65)); pointer-events: none; }
.arena-card .bg .deco { position: absolute; color: rgba(0, 0, 0, 0.22); }
.arena-card .bg .deco svg { width: 100%; height: 100%; fill: currentColor; }
.arena-card .num { position: absolute; top: 12px; left: 14px; font-family: var(--btnfont); font-size: 0.9rem; background: rgba(0, 0, 0, 0.35); padding: 2px 10px; border-radius: 10px; }
.arena-card .road { position: absolute; top: 12px; right: 12px; font-family: var(--btnfont); font-size: 0.85rem; background: rgba(0, 0, 0, 0.35); padding: 3px 10px; border-radius: 10px; display: flex; align-items: center; gap: 4px; }
.arena-card h2 { position: relative; margin: 0; font-family: var(--title); font-size: 2rem; line-height: 1; color: #fff; -webkit-text-stroke: 1.5px #2a1206; text-shadow: 0 3px 0 #2a1206; }
.arena-card .trophy-line { position: relative; display: flex; align-items: center; gap: 8px; margin-top: 8px; font-family: var(--btnfont); }
.progress { position: relative; height: 14px; border-radius: 8px; background: rgba(0, 0, 0, 0.45); overflow: hidden; flex: 1; border: 1.5px solid rgba(0, 0, 0, 0.4); }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, #ffe27a, var(--gold-d)); border-radius: 8px; }
.progress span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-family: var(--btnfont); text-shadow: 0 1px 2px #000; }
.battle-btn-wrap { display: flex; justify-content: center; margin: 18px 0 6px; }
.battle-btn { min-width: 70%; animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035); } }
.deck-strip { display: flex; justify-content: center; gap: 4px; margin-top: 4px; }
.deck-strip .mini { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff6e2; border: 2px solid #2a1206; }
.deck-strip .mini svg { width: 78%; height: 78%; fill: currentColor; }
.bonus-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.bonus { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius); border: 2px solid var(--line); background: linear-gradient(180deg, var(--panel2), var(--panel)); cursor: pointer; box-shadow: 0 4px 0 #1c0f06; text-align: left; }
.bonus:active { transform: translateY(2px); box-shadow: 0 2px 0 #1c0f06; }
.bonus .chest-ico { width: 46px; height: 46px; flex: none; }
.bonus b { display: block; font-family: var(--btnfont); font-size: 0.95rem; }
.bonus small { color: var(--muted); font-size: 0.8rem; }
.bonus.ready { border-color: var(--gold); animation: glow 1.6s ease-in-out infinite; }
@keyframes glow { 0%, 100% { box-shadow: 0 4px 0 #1c0f06, 0 0 0 rgba(255, 207, 74, 0); } 50% { box-shadow: 0 4px 0 #1c0f06, 0 0 18px rgba(255, 207, 74, 0.55); } }
.chest-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.slot {
  position: relative; aspect-ratio: 0.85; border-radius: 14px; border: 2px dashed rgba(255, 255, 255, 0.15); background: rgba(0, 0, 0, 0.25);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 4px; cursor: pointer; text-align: center;
}
.slot.full { border: 2px solid var(--line); background: linear-gradient(180deg, var(--panel3), var(--panel)); box-shadow: 0 4px 0 #1c0f06; }
.slot.ready { border-color: var(--gold); animation: glow 1.6s ease-in-out infinite; }
.slot .chest-ico { width: 72%; }
.slot .lbl { font-family: var(--btnfont); font-size: 0.72rem; line-height: 1.1; }
.slot .sub { font-size: 0.68rem; color: var(--muted); }
.slot.unlocking .lbl { color: var(--gold); }
.slot .empty { color: var(--dim); font-size: 0.72rem; }
.tip { margin-top: 16px; display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); background: rgba(0, 0, 0, 0.3); color: var(--muted); font-size: 0.9rem; }
.tip .ico { color: var(--gold); font-size: 1.4rem; flex: none; }

/* ------------------------------------------------------------------ cartes */
.gcard { --rc: #a9c6d8; --rf: #5f86a0; position: relative; aspect-ratio: 0.8; cursor: pointer; }
.gcard.r-rare { --rc: #ffb23e; --rf: #c46f12; }
.gcard.r-epic { --rc: #c27cff; --rf: #7b3cc2; }
.gcard.r-legendary { --rc: #4ff0c0; --rf: #14946f; }
.gcard .frame {
  position: absolute; inset: 0; border-radius: 12px; overflow: hidden;
  background: linear-gradient(180deg, var(--rc), var(--rf)); padding: 3px; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45);
}
.gcard.r-legendary .frame { background: linear-gradient(135deg, #ffe680, #4ff0c0, #6cb6ff, #e46fff, #ffe680); background-size: 300% 300%; animation: legend 4s linear infinite; }
@keyframes legend { to { background-position: 300% 0; } }
.gcard .art {
  position: relative; width: 100%; height: 100%; border-radius: 9px; overflow: hidden;
  background: radial-gradient(circle at 50% 30%, var(--a2), var(--a1) 75%);
  display: flex; align-items: center; justify-content: center; color: #fff6e2;
}
.gcard .art::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 45%; background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent); }
.gcard .art svg { width: 70%; height: 70%; margin-top: -14%; fill: currentColor; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.35)); }
.gcard .art img.portrait { position: absolute; left: 50%; bottom: 6%; width: 96%; height: 90%; transform: translateX(-50%); object-fit: contain; object-position: center bottom; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.35)); pointer-events: none; -webkit-user-drag: none; }
.gcard.has-level .art img.portrait, .gcard .art img.portrait:only-child { bottom: 8%; }
.gcard .name {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 3px 4px; text-align: center; font-family: var(--btnfont); font-size: 0.72rem; line-height: 1.05;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.75) 35%); text-shadow: 0 1px 2px #000;
}
.gcard .cost {
  position: absolute; top: -6px; left: -6px; width: 30px; height: 30px; z-index: 2;
  background: radial-gradient(circle at 35% 30%, #fff3b8, var(--ginger) 55%, #b45c08); border: 2px solid #3a1d04;
  border-radius: 50% 50% 50% 4px; transform: rotate(45deg); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
  display: flex; align-items: center; justify-content: center;
}
.gcard .cost span { transform: rotate(-45deg); font-family: var(--btnfont); font-size: 1.05rem; color: #fff; text-shadow: 0 1px 0 #6a3204, 0 0 3px #6a3204; }
.gcard .level {
  position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); z-index: 2; padding: 1px 8px; border-radius: 8px; white-space: nowrap;
  background: #2a1206; border: 2px solid var(--rc); font-family: var(--btnfont); font-size: 0.72rem;
}
.gcard .newtag { position: absolute; top: -6px; right: -6px; z-index: 3; padding: 1px 6px; border-radius: 8px; background: var(--red); font-family: var(--btnfont); font-size: 0.68rem; border: 2px solid #2a1206; transform: rotate(8deg); }
.gcard .uptag { position: absolute; top: -8px; right: -6px; z-index: 3; width: 24px; height: 24px; border-radius: 50%; background: var(--green); border: 2px solid #0a3a17; display: flex; align-items: center; justify-content: center; font-size: 0.95rem; animation: bob 1s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-3px); } }
.gcard.locked .art { filter: grayscale(1) brightness(0.45); }
.gcard.has-level .name { display: none; }
.gcard.locked .lockinfo { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-family: var(--btnfont); font-size: 0.66rem; text-align: center; padding: 4px; color: var(--cream); }
.gcard.locked .lockinfo .ico { font-size: 1.4rem; color: var(--gold); }
.gcard.sel .frame { outline: 3px solid #fff; outline-offset: 2px; }
.gcard.wiggle { animation: wiggle 0.5s ease-in-out infinite; }
@keyframes wiggle { 25% { transform: rotate(-3deg); } 75% { transform: rotate(3deg); } }
.card-bar { margin-top: 10px; height: 14px; }

.deck-tabs { display: flex; gap: 8px; align-items: center; }
.deck-tabs button { width: 40px; height: 36px; border-radius: 10px; border: 2px solid var(--line); background: var(--panel); font-family: var(--btnfont); font-size: 1.05rem; color: var(--muted); cursor: pointer; }
.deck-tabs button.on { background: var(--orange); color: #fff; border-color: var(--orange-d); }
.deck-grid, .coll-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 10px; }
.deck-panel { padding: 14px 10px 18px; }
.avg { display: inline-flex; align-items: center; gap: 4px; font-family: var(--btnfont); color: var(--cream); }
.swap-banner { position: sticky; top: -16px; z-index: 5; margin: -16px -12px 10px; padding: 10px 12px; background: var(--orange); font-family: var(--btnfont); display: flex; align-items: center; justify-content: space-between; gap: 8px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4); }
.card-pop { position: fixed; z-index: 30; display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 12px; background: #2a1206; border: 2px solid var(--line); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.6); }

.card-detail { display: grid; grid-template-columns: 116px 1fr; gap: 14px; align-items: start; }
.card-detail .gcard { width: 116px; }
.card-detail .desc { color: var(--muted); font-size: 0.92rem; margin: 2px 0 8px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.tag { padding: 2px 8px; border-radius: 8px; background: rgba(0, 0, 0, 0.35); font-family: var(--btnfont); font-size: 0.8rem; color: var(--cream); }
.tag.rar { background: var(--rc, #555); color: #1b0f07; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 12px; }
.stat { padding: 6px 8px; border-radius: 10px; background: rgba(0, 0, 0, 0.3); }
.stat small { display: block; color: var(--dim); font-size: 0.72rem; }
.stat b { font-family: var(--btnfont); font-size: 1rem; }
.stat b .up { color: #7dff8a; font-size: 0.8rem; margin-left: 4px; }

/* ------------------------------------------------------------------ boutique */
.offers { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.offer { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 10px; }
.offer .gcard { width: 74%; }
.offer .count { font-family: var(--btnfont); font-size: 1.1rem; margin-top: 6px; }
.offer.bought { opacity: 0.5; }
.shop-chests { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.shop-chest { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; text-align: center; }
.shop-chest .chest-ico { width: 70%; }
.shop-chest b { font-family: var(--btnfont); font-size: 0.82rem; line-height: 1.1; min-height: 2.2em; }
.wari-packs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wari-pack { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px; }
.wari-pack .big-cur { width: 54px; height: 54px; }
.wari-pack b { font-family: var(--btnfont); font-size: 1.2rem; }

/* ------------------------------------------------------------------ grin, profil */
.rank-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(0, 0, 0, 0.25); margin-bottom: 8px; }
.rank-row .pos { width: 28px; text-align: center; font-family: var(--title); font-size: 1.3rem; color: var(--gold); }
.rank-row .avatar { --size: 40px; }
.rank-row .nm { flex: 1; font-family: var(--btnfont); }
.rank-row.me { outline: 2px solid var(--gold); }
.soon { text-align: center; padding: 18px 14px; }
.soon .big-ico { font-size: 3.2rem; color: var(--gold); }
.soon h3 { font-family: var(--title); font-size: 1.5rem; margin: 6px 0; color: var(--cream); }
.soon p { color: var(--muted); margin: 6px 0; }
.me-head { display: flex; align-items: center; gap: 14px; }
.me-head .avatar { --size: 76px; }
.me-head h2 { margin: 0; font-family: var(--title); font-size: 1.7rem; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kv .stat { text-align: center; }
.hist-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(0, 0, 0, 0.25); margin-bottom: 6px; font-size: 0.9rem; }
.hist-row .res { width: 64px; font-family: var(--btnfont); }
.hist-row .res.win { color: #7dff8a; }
.hist-row .res.loss { color: #ff8a7a; }
.hist-row .res.draw { color: var(--muted); }
.hist-row .opp { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 2px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.setting:last-child { border-bottom: 0; }
.setting label { font-family: var(--btnfont); }
.setting input[type='range'] { width: 46%; accent-color: var(--orange); }
.switch { position: relative; width: 52px; height: 30px; border-radius: 15px; background: rgba(0, 0, 0, 0.45); border: 2px solid var(--line); cursor: pointer; flex: none; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: var(--dim); transition: left 0.15s, background 0.15s; }
.switch.on { background: var(--green-d); }
.switch.on::after { left: 24px; background: #fff; }
.btn-col { display: grid; gap: 10px; }
.credits { color: var(--muted); font-size: 0.88rem; line-height: 1.45; }
.credits h4 { color: var(--gold); font-family: var(--btnfont); margin: 12px 0 4px; font-size: 1rem; font-weight: normal; }
.credits a { color: var(--gold); }
.version { text-align: center; color: var(--dim); font-size: 0.8rem; margin-top: 18px; }

/* ------------------------------------------------------------------ compte bêta-test */
.beta-tag { display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 8px; background: #8e44ad; color: #fff; font-family: var(--btnfont); font-size: 0.7rem; vertical-align: 0.15em; }
.beta-panel { margin-top: 14px; border-color: #8e44ad; background: linear-gradient(180deg, #3d2350, #2a1838); }
.beta-head { font-family: var(--btnfont); font-size: 1.1rem; color: #e3b8ff; margin-bottom: 6px; }
.beta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.beta-grid .btn { width: 100%; font-size: 0.85rem; }
.beta-select { max-width: 55%; padding: 8px 10px; border-radius: 10px; border: 2px solid #8e44ad; background: #1e1028; color: var(--text); font-family: var(--btnfont); }
.beta-note { margin: 10px 0 0; font-size: 0.82rem; color: #d9c2e8; }
.pause-beta { display: grid; gap: 8px; width: min(300px, 100%); padding: 12px; border-radius: 14px; background: rgba(61, 35, 80, 0.92); border: 2px solid #8e44ad; }
.pause-beta .btn { width: 100%; }
.beta-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ------------------------------------------------------------------ comptes en ligne */
.cloud-tag { display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 8px; background: var(--blue); color: #fff; font-family: var(--btnfont); font-size: 0.7rem; vertical-align: 0.15em; }
.me-head h2 .cloud-tag { font-size: 0.75rem; vertical-align: 0.35em; }
.form-note { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.4; }
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-pick button { padding: 10px; border-radius: 12px; border: 2px solid var(--line); background: #1e1008; color: var(--muted); text-align: left; cursor: pointer; }
.mode-pick button b { display: block; margin-bottom: 2px; font-family: var(--btnfont); font-weight: normal; font-size: 1.05rem; color: var(--text); }
.mode-pick button small { display: block; font-size: 0.76rem; line-height: 1.3; }
.mode-pick button.sel { border-color: var(--orange); background: #3d200c; box-shadow: inset 0 0 0 1px var(--orange); }
.online-cta { margin: 14px 0; border-color: var(--blue); background: linear-gradient(180deg, #1f3550, #172539); }
.online-cta b { font-family: var(--btnfont); font-weight: normal; font-size: 1.1rem; color: #bfe3ff; }
.online-cta p { margin: 6px 0 10px; color: #d2e4f5; font-size: 0.9rem; }
.seg { display: flex; gap: 8px; margin-bottom: 4px; }
.seg button { flex: 1; min-height: 38px; border-radius: 10px; border: 2px solid var(--line); background: var(--panel); font-family: var(--btnfont); font-size: 1rem; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--orange); color: #fff; border-color: var(--orange-d); }
.rank-row .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .nm small { display: block; font-family: var(--body); font-size: 0.75rem; color: var(--dim); }
.rank-gap { text-align: center; color: var(--dim); margin: -4px 0 4px; letter-spacing: 4px; }
.muted-note { color: var(--muted); font-size: 0.9rem; text-align: center; }

/* ------------------------------------------------------------------ fenêtres */
#overlay { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.modal-back {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(10, 5, 2, 0.72); backdrop-filter: blur(3px); pointer-events: auto; animation: fade 0.15s;
}
.modal {
  position: relative; width: 100%; max-width: 440px; max-height: calc(100dvh - 32px); overflow-y: auto; border-radius: 18px;
  background: linear-gradient(180deg, var(--panel2), #2c180b); border: 3px solid #120902; box-shadow: 0 0 0 2px var(--line) inset, 0 20px 50px rgba(0, 0, 0, 0.6);
  padding: 0 0 16px; animation: pop 0.2s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.modal-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; background: linear-gradient(180deg, #5c361c, #432612); border-bottom: 3px solid #120902; }
.modal-head h3 { margin: 0; font-family: var(--title); font-size: 1.35rem; color: var(--gold); text-shadow: 0 2px 0 #1b0f07; letter-spacing: 0.02em; }
.modal-body { padding: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; padding: 0 14px; flex-wrap: wrap; }
.modal-actions .btn { flex: 1; min-width: 120px; }
.close-x { width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--red); color: #fff; font-family: var(--btnfont); font-size: 1.2rem; box-shadow: 0 3px 0 var(--red-d); cursor: pointer; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(0.85); opacity: 0; } }
#toasts { position: fixed; left: 50%; top: calc(70px + var(--safe-top)); transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 420px); }
.toast { padding: 10px 16px; border-radius: 14px; background: #2a1206; border: 2px solid var(--gold); font-family: var(--btnfont); text-align: center; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5); animation: toast 2.6s forwards; }
.toast.bad { border-color: var(--red); }
.toast.good { border-color: var(--green); }
@keyframes toast { 0% { transform: translateY(-14px); opacity: 0; } 10%, 85% { transform: none; opacity: 1; } 100% { opacity: 0; transform: translateY(-8px); } }

.road-list { display: grid; gap: 10px; }
.road-item { position: relative; display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 14px; border: 2px solid #120902; overflow: hidden; }
.road-item .ri-bg { position: absolute; inset: 0; opacity: 0.85; }
.road-item > *:not(.ri-bg) { position: relative; }
.road-item .ri-num { width: 38px; height: 38px; border-radius: 50%; background: rgba(0, 0, 0, 0.45); display: flex; align-items: center; justify-content: center; font-family: var(--title); font-size: 1.2rem; flex: none; }
.road-item .ri-txt { flex: 1; min-width: 0; }
.road-item .ri-txt b { font-family: var(--btnfont); font-size: 1.1rem; display: block; text-shadow: 0 1px 2px #000; }
.road-item .ri-txt small { display: block; color: #fff3e0; opacity: 0.9; text-shadow: 0 1px 2px #000; }
.road-item .ri-cards { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.road-item .ri-cards .mini { width: 28px; height: 28px; border-radius: 7px; display: flex; align-items: center; justify-content: center; color: #fff6e2; border: 2px solid #2a1206; }
.road-item .ri-cards .mini svg { width: 78%; height: 78%; fill: currentColor; }
.road-item.locked { filter: grayscale(0.8) brightness(0.6); }
.road-item.current { outline: 3px solid var(--gold); }

/* ------------------------------------------------------------------ ouverture de calebasse */
.chest-open { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 20px; background: radial-gradient(circle at 50% 45%, rgba(255, 207, 74, 0.32), rgba(10, 5, 2, 0) 60%), #140a04; animation: fade 0.2s; cursor: pointer; }
.chest-open .rays { position: absolute; width: 640px; height: 640px; left: 50%; top: 45%; margin: -320px 0 0 -320px; background: repeating-conic-gradient(rgba(255, 220, 120, 0.14) 0 10deg, transparent 10deg 20deg); border-radius: 50%; animation: spin 14s linear infinite; mask: radial-gradient(circle, #000 20%, transparent 65%); -webkit-mask: radial-gradient(circle, #000 20%, transparent 65%); pointer-events: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.chest-open .big-chest { width: min(220px, 55vw); position: relative; }
.chest-open .big-chest.shaking { animation: chestShake 0.5s ease-in-out infinite; }
@keyframes chestShake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-6deg) scale(1.03); } 75% { transform: rotate(6deg) scale(1.03); } }
.chest-open .big-chest.burst { animation: burst 0.35s ease-out forwards; }
@keyframes burst { to { transform: scale(1.5); opacity: 0; } }
.chest-open h2 { margin: 0; font-family: var(--title); font-size: 1.8rem; color: var(--gold); text-shadow: 0 3px 0 #1b0f07; text-align: center; position: relative; }
.chest-open .left { font-family: var(--btnfont); color: var(--muted); position: relative; }
.chest-open .reveal { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; animation: pop 0.3s cubic-bezier(0.2, 1.4, 0.4, 1); }
.chest-open .reveal .gcard { width: 140px; }
.chest-open .reveal .cnt { font-family: var(--title); font-size: 2.2rem; color: #fff; text-shadow: 0 3px 0 #1b0f07; }
.chest-open .reveal .rlabel { font-family: var(--btnfont); font-size: 1rem; }
.chest-open .summary { position: relative; width: min(420px, 100%); }
.chest-open .sum-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 8px; margin: 12px 0; }
.chest-open .sum-grid .item { text-align: center; font-family: var(--btnfont); font-size: 0.85rem; }
.chest-open .tap { position: relative; font-family: var(--btnfont); color: var(--cream); opacity: 0.8; animation: pulse 1.2s infinite; }
.chest-ico svg { width: 100%; height: auto; display: block; overflow: visible; }

/* ------------------------------------------------------------------ combat */
.battle { position: absolute; inset: 0; display: flex; flex-direction: column; background: #120902; touch-action: none; }
.bt-top { flex: none; display: flex; align-items: center; gap: 8px; padding: calc(6px + var(--safe-top)) 10px 6px; background: linear-gradient(180deg, rgba(60, 20, 15, 0.95), rgba(40, 14, 10, 0.92)); border-bottom: 3px solid #0a0402; }
.bt-top .avatar { --size: 36px; }
.bt-who { flex: 1; min-width: 0; }
.bt-who b { display: block; font-family: var(--btnfont); font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #ffd8cf; }
.bt-who small { color: #e9b8a8; font-size: 0.8rem; display: flex; align-items: center; gap: 4px; }
.bt-crowns { display: flex; align-items: center; gap: 2px; font-family: var(--title); font-size: 1.5rem; }
.bt-crowns .ico { font-size: 1.6rem; }
.bt-crowns.enemy { color: #ff8f80; }
.bt-crowns.mine { color: #8fc8ff; }
.bt-crowns .n { min-width: 18px; text-align: center; color: #fff; text-shadow: 0 2px 0 #000; }
.bt-crowns.pop { animation: crownPop 0.6s; }
@keyframes crownPop { 30% { transform: scale(1.6); } }
.bt-timer { min-width: 66px; padding: 3px 8px; border-radius: 10px; background: rgba(0, 0, 0, 0.5); text-align: center; line-height: 1; }
.bt-timer small { display: block; font-size: 0.62rem; color: #e9b8a8; font-family: var(--btnfont); }
.bt-timer b { font-family: var(--btnfont); font-size: 1.3rem; }
.bt-timer.hot b { color: #ff6a4a; animation: pulse 0.6s infinite; }
.bt-timer.ot { background: rgba(224, 72, 58, 0.6); }
.bt-stage { position: relative; flex: 1; min-height: 0; }
.bt-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.bt-banner { position: absolute; left: 0; right: 0; top: 38%; z-index: 6; text-align: center; pointer-events: none; }
.bt-banner div { display: inline-block; padding: 10px 22px; border-radius: 16px; background: rgba(20, 8, 2, 0.82); border: 3px solid var(--gold); font-family: var(--title); font-size: 1.5rem; color: var(--gold); text-shadow: 0 2px 0 #000; animation: banner 2.2s forwards; }
.bt-banner div.blue { border-color: #6cb6ff; color: #bfe0ff; }
.bt-banner div.red { border-color: #ff7a6a; color: #ffd0c8; }
@keyframes banner { 0% { transform: scale(0.4); opacity: 0; } 12% { transform: scale(1.1); opacity: 1; } 20%, 80% { transform: scale(1); opacity: 1; } 100% { transform: scale(0.9); opacity: 0; } }
.bt-side { position: absolute; z-index: 5; display: flex; flex-direction: column; gap: 8px; }
.bt-side.left { left: 8px; bottom: 10px; }
.bt-side.right { right: 8px; bottom: 10px; align-items: flex-end; }
.bt-side .icon-btn { width: 44px; height: 44px; background: rgba(20, 8, 2, 0.6); }
.bt-me { padding: 3px 8px; border-radius: 10px; background: rgba(15, 30, 60, 0.7); display: flex; align-items: center; gap: 6px; font-family: var(--btnfont); font-size: 0.85rem; color: #cfe6ff; max-width: 150px; }
.bt-me span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bt-emotes { position: absolute; left: 8px; bottom: 62px; z-index: 8; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px; border-radius: 14px; background: rgba(20, 8, 2, 0.92); border: 2px solid var(--line); width: min(300px, 80vw); }
.bt-emotes button { padding: 8px 6px; border-radius: 10px; border: 0; background: var(--panel3); font-family: var(--btnfont); font-size: 0.85rem; color: var(--cream); cursor: pointer; box-shadow: 0 3px 0 #1c0f06; }
.bt-emotes button:active { transform: translateY(2px); box-shadow: 0 1px 0 #1c0f06; }
.bubble { position: absolute; z-index: 7; transform: translate(-50%, -100%); padding: 8px 12px; border-radius: 14px; background: #fff7e8; color: #2a1206; font-family: var(--btnfont); font-size: 1rem; white-space: nowrap; box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45); pointer-events: none; animation: bubble 2.6s forwards; }
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -8px; margin-left: -8px; border: 8px solid transparent; border-bottom: 0; border-top-color: #fff7e8; }
.bubble.enemy { background: #ffe1dc; }
.bubble.enemy::after { border-top-color: #ffe1dc; }
@keyframes bubble { 0% { transform: translate(-50%, -80%) scale(0.5); opacity: 0; } 10% { transform: translate(-50%, -100%) scale(1.05); opacity: 1; } 15%, 85% { transform: translate(-50%, -100%) scale(1); opacity: 1; } 100% { transform: translate(-50%, -110%); opacity: 0; } }

.bt-bottom { flex: none; padding: 8px 8px calc(8px + var(--safe-bottom)); background: linear-gradient(180deg, #2a170b, #160b04); border-top: 3px solid #0a0402; position: relative; }
.bt-bottom::before { content: ''; position: absolute; left: 0; right: 0; top: -9px; height: 6px; background: var(--kente); }
.bt-hand { display: grid; grid-template-columns: 0.62fr repeat(4, 1fr); gap: 7px; align-items: end; }
.bt-next { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.bt-next small { font-family: var(--btnfont); font-size: 0.66rem; color: var(--dim); }
.bt-next > div { width: 100%; }
.bt-next .gcard { width: 100%; pointer-events: none; }
.bt-next .gcard .name { display: none; }
.bt-card { position: relative; transition: transform 0.12s; touch-action: none; }
.bt-card .gcard { width: 100%; }
.bt-card.sel { transform: translateY(-12px); }
.bt-card.sel .gcard .frame { box-shadow: 0 0 0 3px #fff, 0 0 18px rgba(255, 255, 255, 0.7); }
/* nom de la carte : seulement sur celle qu'on a choisie (et sur la carte qu'on fait glisser) */
.bt-card .gcard .name { opacity: 0; transform: translateY(6px); transition: opacity 0.15s, transform 0.15s; font-size: 0.74rem; padding-top: 6px; }
.bt-card .gcard.long-name .name, .drag-ghost .gcard.long-name .name { font-size: 0.6rem; line-height: 1; padding: 5px 2px 3px; }
.bt-card.sel .gcard .name, .drag-ghost .gcard .name { opacity: 1; transform: none; }
.bt-card.dim .gcard { filter: grayscale(0.85) brightness(0.62); }
.bt-card.dragging { opacity: 0.35; }
.bt-card.enter { animation: cardIn 0.25s ease-out; }
/* match en ligne : carte posée qui attend son tick */
.bt-card.pending .gcard { filter: grayscale(1) brightness(0.5); }
.bt-card.pending::after { content: '⏳'; position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); font-size: 1.5rem; pointer-events: none; }
.live-tag { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 6px; background: var(--green); color: #fff; font-family: var(--btnfont); font-size: 0.65rem; letter-spacing: 0.03em; }
.bt-count { position: absolute; left: 50%; top: 40%; z-index: 8; transform: translate(-50%, -50%); font-family: var(--title); font-size: 5rem; color: var(--gold); text-shadow: 0 5px 0 #1b0f07, 0 0 30px rgba(0, 0, 0, 0.6); pointer-events: none; }
/* recherche d'un adversaire en ligne */
.mm-overlay { position: fixed; inset: 0; z-index: 55; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(10, 5, 2, 0.8); backdrop-filter: blur(3px); pointer-events: auto; animation: fade 0.15s; }
.mm-box { width: min(340px, 100%); padding: 22px 18px; border-radius: var(--radius); text-align: center; background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 2px solid var(--line); box-shadow: 0 6px 0 #1c0f06; }
.mm-box h2 { margin: 12px 0 4px; font-family: var(--title); font-size: 1.5rem; color: var(--gold); }
.mm-box p { margin: 0 0 16px; color: var(--muted); }
.mm-spinner { width: 64px; height: 64px; margin: 0 auto; border-radius: 50%; border: 6px solid rgba(255, 207, 74, 0.2); border-top-color: var(--gold); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.crash { position: fixed; inset: 0; z-index: 54; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(10, 5, 2, 0.85); pointer-events: auto; animation: fade 0.15s; }
.crash .crash-detail { margin-top: -8px; font-size: 0.75rem; opacity: 0.7; word-break: break-word; }
.crash.top { z-index: 80; }
.bt-net { position: absolute; left: 50%; top: 8px; z-index: 8; transform: translateX(-50%); max-width: 86%; padding: 6px 12px; border-radius: 12px; background: rgba(20, 8, 2, 0.85); border: 2px solid var(--gold); color: var(--cream); font-size: 0.85rem; text-align: center; pointer-events: none; }
@keyframes cardIn { from { transform: translateY(30px) scale(0.7); opacity: 0; } }
.bt-elixir { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.bt-elixir .drop {
  position: relative; flex: none; width: 34px; height: 34px; border-radius: 50% 50% 50% 4px; transform: rotate(45deg);
  background: radial-gradient(circle at 35% 30%, #fff3b8, var(--ginger) 55%, #b45c08); border: 2px solid #3a1d04;
  display: flex; align-items: center; justify-content: center;
}
.bt-elixir .drop span { transform: rotate(-45deg); font-family: var(--btnfont); font-size: 1.2rem; color: #fff; text-shadow: 0 1px 0 #6a3204, 0 0 4px #6a3204; }
.bt-elixir .bar { position: relative; flex: 1; height: 22px; border-radius: 11px; background: rgba(0, 0, 0, 0.55); border: 2px solid #3a1d04; overflow: hidden; }
.bt-elixir .bar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(180deg, #ffe08a, var(--ginger) 60%, #c4700c); }
.bt-elixir .bar .segs { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(10, 1fr); }
.bt-elixir .bar .segs span { border-right: 2px solid rgba(40, 20, 4, 0.55); }
.bt-elixir .bar .segs span:last-child { border-right: 0; }
.bt-elixir.x2 .bar { box-shadow: 0 0 12px rgba(255, 190, 60, 0.8); }
.bt-elixir .x2tag { font-family: var(--title); color: var(--gold); font-size: 1.1rem; }
.bt-elixir.flash .bar { animation: shake 0.35s; }
.drag-ghost { position: fixed; z-index: 40; width: 76px; pointer-events: none; transform: translate(-50%, -70%) scale(1.05); opacity: 0.95; }
.hand-hint { position: absolute; z-index: 9; pointer-events: none; font-size: 2.6rem; filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.6)); animation: handHint 2s ease-in-out infinite; }
@keyframes handHint { 0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: 1; } 70% { transform: translate(var(--dx), var(--dy)); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)); opacity: 0; } }
.hint-text { position: absolute; z-index: 9; left: 50%; top: 56%; transform: translateX(-50%); padding: 8px 14px; border-radius: 12px; background: rgba(20, 8, 2, 0.85); border: 2px solid var(--gold); font-family: var(--btnfont); white-space: nowrap; pointer-events: none; }

.bt-result {
  position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 20px;
  background: rgba(10, 5, 2, 0.78); backdrop-filter: blur(2px); animation: fade 0.3s;
}
.bt-result .res-title { font-family: var(--title); font-size: clamp(2.6rem, 13vw, 4rem); line-height: 1; -webkit-text-stroke: 2px #1b0f07; text-shadow: 0 5px 0 #1b0f07; animation: pop 0.4s cubic-bezier(0.2, 1.6, 0.4, 1); text-align: center; }
.bt-result.win .res-title { color: var(--gold); }
.bt-result.loss .res-title { color: #ff8a7a; }
.bt-result.draw .res-title { color: var(--cream); }
.bt-result .res-sub { font-family: var(--btnfont); color: var(--muted); margin-top: -8px; text-align: center; }
.res-vs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; width: min(420px, 100%); }
.res-side { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; min-width: 0; }
.res-side b { font-family: var(--btnfont); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res-crowns { display: flex; gap: 2px; font-size: 1.8rem; }
.res-crowns .ico { color: rgba(255, 255, 255, 0.15); }
.res-crowns .ico.on { color: var(--gold); filter: drop-shadow(0 2px 0 #1b0f07); animation: pop 0.4s backwards; }
.res-vs .vs { font-family: var(--title); font-size: 1.4rem; color: var(--dim); }
.rewards { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.reward { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.45); border: 2px solid var(--line); font-family: var(--btnfont); font-size: 1.05rem; animation: pop 0.35s backwards; }
.reward .chest-ico { width: 34px; }
.pause-menu { display: grid; gap: 10px; width: min(300px, 100%); }

@media (min-width: 521px) {
  .content { padding: 18px 16px 20px; }
}
@media (max-height: 640px) {
  .bt-hand { grid-template-columns: 0.55fr repeat(4, 0.88fr); }
  .arena-card { min-height: 140px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ------------------------------------------------------------------ grins */
.seg.small button { min-height: 32px; font-size: 0.88rem; }
.field-select { width: 100%; padding: 11px 12px; border-radius: 12px; border: 2px solid var(--line); background: #1e1008; color: var(--text); font: inherit; font-size: 1rem; }
.field input[type="search"], .field input[type="number"] { -webkit-appearance: none; appearance: none; }
.grin-list { display: grid; gap: 8px; }
.grin-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 12px; border: 2px solid var(--line); background: linear-gradient(180deg, var(--panel2), var(--panel)); color: inherit; text-align: left; cursor: pointer; }
.grin-row .nm, .grin-head .nm, .member-row .nm { flex: 1; min-width: 0; }
.grin-row .nm b, .member-row .nm b { display: block; font-family: var(--btnfont); font-weight: normal; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grin-row .nm small, .member-row .nm small { display: block; color: var(--dim); font-size: 0.78rem; }
.grin-head { display: flex; align-items: center; gap: 12px; }
.grin-head .nm b { display: block; font-family: var(--title); font-size: 1.35rem; color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grin-head .nm small { display: block; color: var(--muted); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; }
.grin-head-btns { display: flex; flex-direction: column; gap: 6px; }
.grin-head-btns .icon-btn { position: relative; width: 40px; height: 40px; }
.grin-head-btns .dot { position: absolute; top: -3px; right: -3px; }
.grin-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.chat { height: 46vh; min-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: var(--radius); background: rgba(0, 0, 0, 0.32); border: 2px solid var(--line); user-select: text; -webkit-user-select: text; }
.chat-input { display: flex; gap: 8px; margin-top: 8px; }
.chat-input input { flex: 1; min-width: 0; padding: 11px 14px; border-radius: 12px; border: 2px solid var(--line); background: #1e1008; color: var(--text); font-size: 1rem; outline: none; user-select: text; -webkit-user-select: text; }
.chat-input input:focus { border-color: var(--orange); }
.chat-input .btn { min-width: 52px; }
.gm-sys { align-self: center; max-width: 90%; padding: 4px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.06); color: var(--dim); font-size: 0.8rem; text-align: center; }
.gm-msg { display: flex; align-items: flex-end; gap: 6px; max-width: 88%; }
.gm-msg.mine { align-self: flex-end; }
.gm-bubble { padding: 7px 10px; border-radius: 12px 12px 12px 4px; background: #4a2b16; overflow-wrap: anywhere; }
.gm-msg.mine .gm-bubble { border-radius: 12px 12px 4px 12px; background: #1f4a2c; }
.gm-bubble b { display: block; font-family: var(--btnfont); font-weight: normal; font-size: 0.85rem; color: var(--gold); }
.gm-bubble span { font-size: 0.95rem; }
.gm-time { display: block; margin-top: 2px; color: var(--dim); font-size: 0.68rem; text-align: right; }
.gm-head .gm-time { display: inline; margin: 0 0 0 auto; }
.gm-card { padding: 8px 10px; border-radius: 12px; background: linear-gradient(180deg, #3d2a52, #2a1d3a); border: 2px solid #6c4aa0; }
.gm-card.mine { border-color: #2f7fe0; background: linear-gradient(180deg, #1f3550, #172539); }
.gm-card.challenge { border-color: var(--gold-d); background: linear-gradient(180deg, #4a3210, #2e1f0a); }
.gm-card.join { border-color: var(--green-d); background: linear-gradient(180deg, #173a22, #102a18); }
.gm-card.closed { opacity: 0.65; }
.gm-card .btn { margin-top: 6px; }
.gm-head { display: flex; align-items: center; gap: 6px; font-family: var(--btnfont); font-size: 0.9rem; }
.gm-head .avatar { --size: 26px; border-width: 2px; }
.gm-line { margin-top: 4px; font-size: 0.9rem; color: var(--cream); }
.gm-req { display: flex; gap: 10px; align-items: center; margin-top: 6px; }
.gm-req .gcard { width: 54px; flex: none; }
.gm-req-info { flex: 1; min-width: 0; display: grid; gap: 4px; }
.gm-req-info b { font-family: var(--btnfont); font-weight: normal; }
.gm-req-info small { color: var(--dim); }
.member-list { display: grid; gap: 6px; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 12px; background: rgba(0, 0, 0, 0.25); flex-wrap: wrap; }
.member-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; width: 100%; }
.dot-online { display: inline-block; width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; background: #5cff8a; box-shadow: 0 0 6px #5cff8a; vertical-align: 0.15em; }
.grin-sum { display: flex; gap: 12px; align-items: center; }
.grin-desc { color: var(--cream); margin-bottom: 4px; }
.grin-meta { color: var(--muted); font-size: 0.85rem; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.ask-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.ask-card { padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer; text-align: center; font-size: 0.7rem; }
.ask-card .gcard { width: 100%; }
