:root {
  --ink: #2b1a33;
  --sky1: #5cc8ff;
  --sky2: #c6efff;
  --grass: #74d85c;
  --grass2: #68cc50;
  --grass-d: #3f9e3a;
  --cream: #fff8e6;
  --cream-d: #f3e2bd;
  --green: #5ad10f;
  --green-d: #3e9a00;
  --orange: #ffab1f;
  --orange-d: #e07800;
  --purple: #a36bff;
  --purple-d: #6f36d6;
  --gold: #ffd23f;
  --red: #ff4d6d;
  --grey: #cfc6d6;
  --font-title: "Lilita One", "Fredoka", system-ui, sans-serif;
  --font: "Fredoka", system-ui, -apple-system, "Segoe UI", sans-serif;
  --outline: 0 3px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 -2px 0 var(--ink), 2px 2px 0 var(--ink), -2px 2px 0 var(--ink);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky1) 0%, var(--sky2) 55%, #b8ecae 100%) fixed;
  background-color: var(--sky2);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
img { -webkit-user-drag: none; user-select: none; }
button { font-family: inherit; color: inherit; cursor: pointer; -webkit-user-select: none; user-select: none; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- ciel */
.sky { position: fixed; inset: 0; pointer-events: none; z-index: -1; overflow: hidden; }
.sun {
  position: absolute; top: -90px; right: -90px; width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, #fff7b0 0 28%, #ffe66d 29% 34%, transparent 35%),
              repeating-conic-gradient(rgba(255, 244, 160, .55) 0 10deg, transparent 10deg 20deg);
  animation: spin 40s linear infinite;
}
.cloud {
  position: absolute; width: 180px; height: 60px; border-radius: 60px; background: #fff; opacity: .9;
  box-shadow: 40px -25px 0 10px #fff, 90px -10px 0 0 #fff, inset 0 -8px 0 #e3f4ff;
  animation: drift linear infinite;
}
.c1 { top: 12%; animation-duration: 70s; }
.c2 { top: 35%; transform: scale(.7); animation-duration: 95s; animation-delay: -40s; }
.c3 { top: 62%; transform: scale(1.2); animation-duration: 120s; animation-delay: -80s; opacity: .7; }
@keyframes drift { from { left: -260px; } to { left: 110vw; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- HUD */
.hud {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  max-width: 1700px; margin: 0 auto; padding: 10px 16px;
}
.brand { text-decoration: none; display: flex; align-items: center; gap: 6px; font-family: var(--font-title); line-height: .9; color: #fff;
  font-size: 1.05rem; text-shadow: var(--outline); }
.brand b { font-size: 1.5rem; color: var(--gold); font-weight: 400; }
.brand img { width: 46px; height: 46px; animation: wobble 3s ease-in-out infinite; }

.money {
  flex: 1; max-width: 420px; margin: 0 auto;
  display: flex; align-items: center; gap: 8px;
  background: var(--cream); border: 4px solid var(--ink); border-radius: 999px;
  padding: 4px 8px 4px 6px; box-shadow: 0 5px 0 var(--ink);
}
.money.bump { animation: bump .18s ease-out; }
.coin-ico {
  width: 44px; height: 44px; flex: none;
  background: url(../assets/sprites/coin.png) 0 0 / 528px 44px;
  animation: coinspin 1.1s steps(12) infinite;
}
@keyframes coinspin { to { background-position: -528px 0; } }
.money-txt { display: flex; flex-direction: column; line-height: 1; min-width: 0; flex: 1; }
#coins { font-family: var(--font-title); font-size: 1.9rem; letter-spacing: .5px; }
#rate { font-weight: 600; font-size: .85rem; color: #8a6c52; }
.lvl { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: none; }
.lvl b {
  display: grid; place-items: center; min-width: 38px; height: 38px; padding: 0 4px; border-radius: 12px;
  background: linear-gradient(180deg, #c7a4ff, var(--purple)); border: 3px solid var(--ink); color: #fff;
  font-family: var(--font-title); font-weight: 400; font-size: 1.15rem; text-shadow: 0 2px 0 var(--purple-d);
}
.lvl b::before { content: "★"; font-size: .6rem; margin-right: 1px; color: var(--gold); text-shadow: none; }
.xpbar { width: 46px; height: 7px; border-radius: 6px; background: #e4d6ee; border: 2px solid var(--ink); overflow: hidden; }
.xpbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #c7a4ff, #ff6b9a); transition: width .2s; }
.lvl.bump { animation: bump .4s cubic-bezier(.3, 1.8, .5, 1); }

.hud-right { display: flex; align-items: center; gap: 8px; }
.pill {
  display: flex; align-items: center; gap: 6px; height: 46px; padding: 0 14px; white-space: nowrap;
  border: 4px solid var(--ink); border-radius: 999px; font-family: var(--font-title); font-size: 1.15rem;
  box-shadow: 0 5px 0 var(--ink); transition: transform .08s;
}
.pill:active, .icon-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.ad-pill { background: linear-gradient(180deg, #ffc94d, var(--orange)); color: #fff; text-shadow: 0 2px 0 var(--orange-d);
  animation: pulse 1.6s ease-in-out infinite; }
.ad-pill.on { background: linear-gradient(180deg, #8ef05a, var(--green)); text-shadow: 0 2px 0 var(--green-d); animation: none; }
.icon-btn {
  position: relative; width: 46px; height: 46px; border-radius: 14px; border: 4px solid var(--ink);
  background: var(--cream); box-shadow: 0 5px 0 var(--ink); display: grid; place-items: center; padding: 0; font-size: 1.1rem; font-weight: 700;
}
.icon-btn img { width: 40px; height: 40px; object-fit: contain; }
.icon-btn .badge { display: none; }
#btnDaily.ready { animation: wobble 1.2s ease-in-out infinite; background: #fff1b8; }
#btnDaily.ready .badge {
  display: grid; place-items: center; position: absolute; top: -10px; right: -10px; width: 22px; height: 22px;
  background: var(--red); color: #fff; border: 3px solid var(--ink); border-radius: 50%; font-size: .75rem; font-weight: 700;
}

/* ---------------------------------------------------------------- layout */
.layout {
  max-width: 1700px; margin: 0 auto; padding: 6px 16px 24px;
  display: grid; grid-template-columns: 260px minmax(0, 1fr) 350px; gap: 18px; align-items: start;
}

/* --- classement toujours visible a gauche */
.lb-side {
  position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--cream); border: 5px solid var(--ink); border-radius: 26px; box-shadow: 0 10px 0 var(--ink);
  padding: 12px 10px; scrollbar-width: thin;
}
.lb-side .rank-list li { grid-template-columns: 34px minmax(0, 1fr) auto; font-size: .85rem; padding: 6px; }
.lb-side .rank-list .sd { display: none; }
.lb-side .rank h3 { font-size: 1.3rem; }
.lb-toggle, .lb-backdrop { display: none; }
.garden-wrap { min-width: 0; }

/* ---------------------------------------------------------------- jardin */
.garden {
  position: relative;
  padding: 0 2.5% 18px;
  border: 5px solid var(--ink); border-radius: 28px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, .35), transparent 55%),
    repeating-linear-gradient(90deg, var(--grass) 0 64px, var(--grass2) 64px 128px);
  box-shadow: inset 0 -14px 0 rgba(0, 0, 0, .08), 0 10px 0 var(--grass-d), 0 10px 0 5px var(--ink);
  user-select: none; -webkit-user-select: none;
  overflow: hidden;
}
.garden-top {
  position: relative; height: clamp(64px, 10vw, 96px); margin: 0 -3%;
  background: url(../assets/sprites/fence.png) 0 100% / auto 62% repeat-x;
}
.deco { position: absolute; pointer-events: none; }
.tree { left: 30%; bottom: -12px; height: 150%; }
.flowers { right: 16%; bottom: -8px; height: 75%; }

.buyamt { position: absolute; top: 12px; right: 3%; z-index: 6; display: flex; gap: 6px; }
.buyamt button {
  border: 3px solid var(--ink); border-radius: 10px; background: #fff; padding: 2px 10px;
  font-family: var(--font-title); font-size: .95rem; box-shadow: 0 3px 0 var(--ink);
}
.buyamt button.on { background: var(--ink); color: #fff; }

/* --- bouton carte des mondes */
.map-btn {
  position: absolute; z-index: 6; top: 10px; left: 3%; display: flex; align-items: center; gap: 6px;
  padding: 3px 12px 3px 4px; border: 3px solid var(--ink); border-radius: 16px; background: var(--cream);
  box-shadow: 0 4px 0 var(--ink); text-align: left; transition: transform .08s;
}
.map-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.map-btn img { width: 52px; height: 52px; margin: -10px 0 -8px; animation: float 3s ease-in-out infinite; }
.map-btn span { display: flex; flex-direction: column; line-height: 1.05; }
.map-btn small { font-weight: 700; font-size: .7rem; color: #8a6c52; }
.map-btn b { font-family: var(--font-title); font-weight: 400; font-size: 1.1rem; }
.map-dot { position: absolute; top: -8px; right: -8px; width: 18px; height: 18px; border-radius: 50%; background: var(--red); border: 3px solid var(--ink); animation: pulse 1s infinite; }

/* --- carte des mondes */
.map { position: fixed; inset: 0; z-index: 240; display: grid; place-items: center; padding: 12px; background: rgba(43, 26, 51, 0); transition: background .25s; }
.map.open { background: rgba(43, 26, 51, .6); }
.map-sheet {
  position: relative; width: min(640px, 100%); height: min(92vh, 900px); display: flex; flex-direction: column; overflow: hidden;
  border: 5px solid var(--ink); border-radius: 28px; box-shadow: 0 10px 0 var(--ink);
  background: radial-gradient(circle at 80% 8%, rgba(255, 255, 255, .7) 0 40px, transparent 41px),
              linear-gradient(180deg, #2b2a6b 0%, #6c5ce7 22%, #74c7ff 55%, #bdf0ff 100%);
  transform: scale(.85); opacity: 0; transition: transform .3s cubic-bezier(.3, 1.5, .5, 1), opacity .2s;
}
.map.open .map-sheet { transform: none; opacity: 1; }
.map-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 6px 18px; }
.map-head h2 { margin: 0; font-family: var(--font-title); font-weight: 400; font-size: 1.7rem; color: #fff; text-shadow: var(--outline); }
.map-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.map-path { position: relative; padding: 20px 14px 40px; }
.map-svg { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.map-svg .route { fill: none; stroke: #fff8e6; stroke-width: 6; stroke-linecap: round; stroke-dasharray: 2 16; }
.map-svg .route-shadow { fill: none; stroke: rgba(43, 26, 51, .35); stroke-width: 10; stroke-linecap: round; stroke-dasharray: 2 16; transform: translateY(3px); }
.island { position: relative; z-index: 1; display: flex; align-items: center; gap: 4px; width: 78%; margin-bottom: 18px; cursor: pointer; }
.island.left { margin-right: auto; }
.island.right { margin-left: auto; flex-direction: row-reverse; text-align: right; }
.island-img { flex: none; width: min(44vw, 200px); animation: float 3.2s ease-in-out infinite; }
.island-img img { width: 100%; height: auto; display: block; filter: drop-shadow(0 12px 10px rgba(0, 0, 0, .25)); }
.island.next .island-img img { filter: saturate(.55) brightness(.95) drop-shadow(0 12px 10px rgba(0, 0, 0, .25)); }
.island.far .island-img img { filter: saturate(.2) brightness(.55) drop-shadow(0 12px 10px rgba(0, 0, 0, .25)); }
.island.here .island-img img { filter: drop-shadow(0 0 18px rgba(255, 240, 150, .95)) drop-shadow(0 12px 10px rgba(0, 0, 0, .25)); }
.plate {
  display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 8px 12px; background: var(--cream);
  border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 4px 0 var(--ink);
}
.island.right .plate { align-items: flex-end; }
.plate small { font-weight: 700; font-size: .72rem; color: #8a6c52; }
.plate b { font-family: var(--font-title); font-weight: 400; font-size: 1.35rem; line-height: 1; }
.plate em { font-style: normal; font-size: .78rem; font-weight: 600; color: #7a6a80; }
.plate em.reached { color: var(--green-d); }
.plate .pin { font-weight: 700; font-size: .85rem; color: var(--red); }
.plate .soon {
  align-self: flex-start; padding: 1px 8px; border-radius: 999px; background: linear-gradient(180deg, #ffe98a, var(--gold));
  border: 2px solid var(--ink); font-family: var(--font-title); font-size: .8rem; transform: rotate(-3deg);
}
.island.right .plate .soon { align-self: flex-end; transform: rotate(3deg); }
.island.far .plate { opacity: .8; }
.wprog { width: 140px; max-width: 100%; height: 12px; border: 2px solid var(--ink); border-radius: 8px; background: #eee3f1; overflow: hidden; }
.wprog i { display: block; height: 100%; background: linear-gradient(90deg, #ffd23f, #ff9214); }

/* --- contenu : liste des mondes, message sans JS */
.world-list { list-style: none; padding: 0; display: grid; gap: 10px; }
.world-list li { display: flex; gap: 12px; align-items: center; }
.world-list img { width: 96px; height: 96px; flex: none; }
.world-list h3 { margin: 0; }
.world-list p { margin: 2px 0 0; }
.world-list small { font-family: var(--font); font-size: .72rem; padding: 1px 8px; border-radius: 999px; vertical-align: 2px; }
.world-list small.ok { background: #d8f7c8; }
.world-list small.soon { background: #fff1b8; }
.noscript { max-width: 900px; margin: 10px auto; padding: 12px 16px; background: var(--cream); border: 3px solid var(--ink); border-radius: 16px; font-weight: 700; text-align: center; }

/* --- lignes */
.rows { position: relative; display: flex; flex-direction: column; gap: 10px; }
.row { position: relative; }
.row-bed { position: relative; height: var(--bedh); margin-top: var(--over); cursor: pointer; touch-action: none; }
.bed-mid {
  position: absolute; top: 0; bottom: 0; left: calc(var(--u) * .5); right: calc(var(--u) * .5);
  background: url(../assets/sprites/bed_m.png) 0 0 / var(--u) 100% repeat-x;
}
.cap { position: absolute; top: 0; bottom: 0; width: calc(var(--u) * .5 + 1px); background-size: 100% 100%; }
.cap.l { left: 0; background-image: url(../assets/sprites/bed_l.png); }
.cap.r { right: 0; background-image: url(../assets/sprites/bed_r.png); }
.row-bed::before {
  content: ""; position: absolute; left: 4%; right: 4%; top: -60%; bottom: 35%; pointer-events: none;
  background: radial-gradient(ellipse at 50% 90%, rgba(255, 246, 170, .75), transparent 65%);
  opacity: 0; transition: opacity .3s;
}
.row.ready .row-bed::before { opacity: 1; animation: glowpulse 1.1s ease-in-out infinite; }
.slots { position: absolute; top: 0; bottom: 0; left: calc(var(--u) * .5); right: calc(var(--u) * .5); display: flex; pointer-events: none; }
.slot { position: relative; flex: 1 1 0; }
.plant {
  position: absolute; width: var(--ph); width: var(--pw); height: var(--ph);
  left: calc(50% - var(--pw) / 2); top: calc(var(--ground) - var(--ph) * var(--ay));
  background-size: 700% 400%; background-repeat: no-repeat;
  transform-origin: 50% calc(var(--ay) * 100%);
}
.plant.pop { animation: plantpop .4s cubic-bezier(.3, 1.8, .5, 1) both; }
.row-n {
  position: absolute; right: calc(var(--u) * .1); top: calc(var(--ground) - 34px); z-index: 4;
  background: var(--ink); color: #fff; font-family: var(--font-title); font-size: .95rem;
  padding: 1px 8px; border-radius: 999px; border: 2px solid #fff;
}
.hit { position: absolute; z-index: 2; cursor: pointer; border-radius: 18px; }
.row.locked .hit, .row.mystery .hit { display: none; }
.row-bee.bee { position: absolute; left: 0; top: 0; width: calc(var(--u) * .62); max-width: none; z-index: 5; pointer-events: none; }

.row-bar {
  position: relative; z-index: 3; margin: 6px 1.5% 0;
  display: grid; align-items: center; gap: 8px;
  grid-template-columns: 42px minmax(96px, 1fr) minmax(110px, 1.4fr) auto auto;
  grid-template-areas: "ico name prog bee buy";
  background: var(--cream); border: 3px solid var(--ink); border-radius: 16px; padding: 5px 6px;
  box-shadow: 0 4px 0 rgba(43, 26, 51, .35);
}
.row-ico { grid-area: ico; width: 42px; height: 42px; object-fit: contain; }
.row-name { grid-area: name; min-width: 0; }
.row-name b { font-family: var(--font-title); font-weight: 400; font-size: 1.08rem; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.lv { font-family: var(--font); font-weight: 700; font-size: .72rem; background: var(--ink); color: #fff; border-radius: 8px; padding: 1px 6px; }
.ms { position: relative; margin-top: 3px; height: 13px; background: #eee3f1; border: 2px solid var(--ink); border-radius: 8px; overflow: hidden; }
.ms i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #ffb74d, #ff6b9a); }
.ms span { position: relative; display: block; text-align: center; font-size: .62rem; font-weight: 700; line-height: 9px; white-space: nowrap; }
.prog {
  grid-area: prog; position: relative; height: 30px; background: #e9dcef; border: 3px solid var(--ink); border-radius: 12px; overflow: hidden;
}
.prog i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(180deg, #a8f56f, #5ad10f); }
.row.ready .prog i { background: linear-gradient(90deg, #ffe066, #fff3b0, #ffd23f); background-size: 200% 100%; animation: shimmer 1s linear infinite; }
.prog .pv, .prog .pt { position: absolute; top: 50%; transform: translateY(-50%); font-family: var(--font-title); white-space: nowrap; }
.prog .pv { left: 8px; font-size: 1.05rem; color: #fff; text-shadow: var(--outline); }
.prog .pt { right: 7px; font-size: .8rem; color: var(--ink); opacity: .75; }
.beebtn { grid-area: bee; display: flex; align-items: center; gap: 4px; padding: 5px 8px; font-size: .95rem; }
.beebtn:not(.can) { background: linear-gradient(180deg, #e7dfee, var(--grey)); color: #8b7f94; text-shadow: none; }
.beebtn.can { background: linear-gradient(180deg, #ffe680, #ffc21a); color: var(--ink); text-shadow: none; animation: canbuy 1.4s ease-in-out infinite; }
.bee-ico { width: 26px; height: 26px; background: url(../assets/sprites/icons/bee.png) center / contain no-repeat; }
.row-bar .buy { grid-area: buy; }

/* lignes verrouillees */
.row.locked .row-bed, .row.mystery .row-bed { margin-top: 14px; cursor: default; }
.row.locked .bed-mid, .row.locked .cap { filter: saturate(.35) brightness(.95); opacity: .75; }
.row.mystery .bed-mid, .row.mystery .cap { filter: grayscale(1); opacity: .35; }
.row-unlock { position: absolute; inset: 0; display: grid; place-items: center; z-index: 4; }
.row-unlock .sil { width: 44px; filter: brightness(0) opacity(.35); }
.row.mystery .row-unlock { display: flex; justify-content: center; gap: 10px; font-weight: 700; color: rgba(43, 26, 51, .6); }
.btn.unlock { display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 8px; text-align: left; }
.btn.unlock img { width: 48px; height: 48px; object-fit: contain; }
.btn.unlock span { display: flex; flex-direction: column; line-height: 1.05; }
.btn.unlock small { font-family: var(--font); font-weight: 700; font-size: .72rem; }
.btn.unlock b { font-weight: 400; font-size: 1.25rem; }
.btn.unlock em { font-style: normal; display: flex; align-items: center; gap: 3px; background: rgba(0, 0, 0, .18); border-radius: 10px; padding: 3px 8px; }
.btn.unlock:not(.can) { background: linear-gradient(180deg, #f3edf6, #d9cfe0); color: #7d7086; text-shadow: none; }
.btn.unlock.can { animation: canbuy 1.4s ease-in-out infinite, pulse 1.4s ease-in-out infinite; }

.coin-inline { display: inline-block; width: 1.1em; height: 1.1em; vertical-align: -0.2em; background: url(../assets/sprites/coin.png) 0 0 / 1200% 100%; }
.coin-inline.big { width: 40px; height: 40px; }

/* abeilles */
.bee {
  position: absolute; left: 0; top: 0; width: 8%; max-width: 60px; aspect-ratio: 1;
  background: url(../assets/sprites/bee.png) 0 0 / 800% 100% no-repeat; pointer-events: none;
  will-change: transform;
}
.bee.gold {
  z-index: 30; width: 11%; max-width: 96px; pointer-events: auto; cursor: pointer;
  background-image: url(../assets/sprites/bee_gold.png);
  filter: drop-shadow(0 0 8px #ffe066) drop-shadow(0 0 16px #ffb300);
  animation: goldglow .6s ease-in-out infinite alternate;
}

/* combo / frenzy / hint */
#combo {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 25; pointer-events: none;
  font-family: var(--font-title); color: #fff; opacity: 0; white-space: nowrap; text-shadow: var(--outline);
}
#combo.show { opacity: 1; animation: pop .25s cubic-bezier(.3, 1.8, .5, 1); }
#combo.warm { color: #ffd23f; }
#combo.hot { color: #ff6b9a; animation: pop .25s cubic-bezier(.3, 1.8, .5, 1), hue 1s linear infinite; }
.frenzy {
  position: absolute; top: 12px; left: 3%; z-index: 25; pointer-events: none;
  background: linear-gradient(180deg, #fff3a0, var(--gold)); border: 3px solid var(--ink); border-radius: 999px;
  padding: 4px 12px; font-family: var(--font-title); box-shadow: 0 4px 0 var(--ink); animation: pulse .8s infinite;
}
.hint {
  position: absolute; left: 50%; transform: translateX(-50%); top: calc(clamp(64px, 10vw, 96px) + 10px); z-index: 26; pointer-events: none;
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
  font-family: var(--font-title); color: #fff; font-size: clamp(.95rem, 2vw, 1.25rem); text-shadow: var(--outline);
}
.hint span { font-size: 2rem; animation: tapfinger 1s ease-in-out infinite; display: inline-block; }

/* ---------------------------------------------------------------- panneau */
.panel {
  position: sticky; top: 76px;
  background: var(--cream); border: 5px solid var(--ink); border-radius: 26px;
  box-shadow: 0 10px 0 var(--ink); padding: 12px;
  max-height: calc(100vh - 96px); overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin;
}
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.tabs button {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 2px; border: 3px solid var(--ink); border-radius: 14px; background: #fff;
  box-shadow: 0 4px 0 var(--ink); font-weight: 700; font-size: .82rem;
}
.tabs button img { width: 32px; height: 32px; object-fit: contain; }
.tabs button .emoji { font-size: 1.4rem; line-height: 32px; }
.tabs button.on { background: linear-gradient(180deg, #ffe98a, var(--gold)); transform: translateY(2px); box-shadow: 0 2px 0 var(--ink); }
.tabs button.lockedtab img { filter: grayscale(1) opacity(.6); }
.tabs button.dot::after {
  content: ""; position: absolute; top: -7px; right: -7px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--red); border: 3px solid var(--ink); animation: pulse 1s infinite;
}

.card {
  display: grid; grid-template-columns: 60px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  background: #fff; border: 3px solid var(--ink); border-radius: 18px; padding: 8px 8px 8px 6px;
  margin-bottom: 10px; box-shadow: 0 4px 0 rgba(43, 26, 51, .25);
}
.sicon { width: 60px; height: 60px; object-fit: contain; }
.card .name { font-family: var(--font-title); font-size: 1.05rem; line-height: 1.1; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.card .stats { font-size: .8rem; font-weight: 600; color: #7a6a80; margin-top: 2px; }

.btn {
  border: 3px solid var(--ink); border-radius: 14px; padding: 8px 14px;
  font-family: var(--font-title); font-size: 1.05rem; color: #fff;
  background: linear-gradient(180deg, #8ef05a, var(--green)); text-shadow: 0 2px 0 var(--green-d);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .18), 0 4px 0 var(--ink);
  transition: transform .06s, filter .15s;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .18), 0 1px 0 var(--ink); }
.btn:disabled { filter: grayscale(1) opacity(.55); cursor: not-allowed; }
.btn.buy { min-width: 96px; display: flex; flex-direction: column; align-items: center; line-height: 1.05; padding: 5px 10px; }
.btn.buy small { font-family: var(--font); font-weight: 700; font-size: .68rem; opacity: .95; white-space: nowrap; }
.btn.buy b { font-weight: 400; font-size: 1.1rem; }
.btn.buy:not(.can):not(:disabled) { background: linear-gradient(180deg, #e7dfee, var(--grey)); color: #8b7f94; text-shadow: none; }
.btn.buy.can { animation: canbuy 1.4s ease-in-out infinite; }
.btn.ad { background: linear-gradient(180deg, #ffc94d, var(--orange)); text-shadow: 0 2px 0 var(--orange-d); }
.btn.purple { background: linear-gradient(180deg, #c7a4ff, var(--purple)); text-shadow: 0 2px 0 var(--purple-d); }
.btn.ghost { background: #fff; color: var(--ink); text-shadow: none; }
.small-btn { font-size: .85rem; padding: 4px 10px; }
.big-btn { width: 100%; font-size: 1.35rem; padding: 12px; margin-top: 6px; }
.big-btn:not(:disabled) { animation: pulse 1.3s ease-in-out infinite; }
.small { font-size: .85rem; color: #7a6a80; }

/* --- Grand Compost */
.compost { text-align: center; padding: 4px 4px 8px; }
.compost h3 { font-family: var(--font-title); font-weight: 400; font-size: 1.6rem; margin: 2px 0 4px; }
.compost-img { width: 110px; animation: float 2.4s ease-in-out infinite; filter: drop-shadow(0 0 12px rgba(255, 210, 63, .7)); }
.compost.locked .compost-img { filter: grayscale(.9) opacity(.6); animation: none; }
.compost .owned { font-weight: 700; margin: 6px 0; }
.lvl-progress { position: relative; height: 24px; margin: 10px 8px; border-radius: 12px; border: 3px solid var(--ink); background: #eee3f1; overflow: hidden; }
.lvl-progress i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #c7a4ff, var(--purple)); }
.lvl-progress span { position: relative; font-family: var(--font-title); line-height: 18px; }
.sac-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
.sac-item { min-width: 0;
  position: relative; display: flex; align-items: center; gap: 6px; text-align: left; padding: 6px 26px 6px 6px;
  background: #fff; border: 3px solid #d9cfe0; border-radius: 14px; transition: transform .1s, border-color .15s;
}
.sac-item img, .sac-item .coin-inline { width: 38px; height: 38px; object-fit: contain; flex: none; }
.sac-item span { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.sac-item b { font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sac-item small { font-size: .7rem; color: #7a6a80; }
.sac-item .check { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; border-radius: 6px; border: 2px solid #b9aec2; }
.sac-item.on { border-color: var(--red); background: #fff0f3; }
.sac-item.on .check { background: var(--red); border-color: var(--ink); }
.sac-item.on .check::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: .75rem; font-weight: 700; }
.sac-item:active { transform: scale(.96); }
.bonus-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 12px 0 8px; }
.chip { padding: 3px 9px; border-radius: 999px; background: #eee3f1; font-size: .78rem; font-weight: 600; color: #8b7f94; border: 2px solid transparent; }
.chip.on { background: #fff3c2; color: var(--ink); border-color: var(--gold); }
.gain-box { display: flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--font-title); font-size: 1.35rem; color: var(--purple-d); }
.gain-box img { width: 44px; animation: wobble 1.5s ease-in-out infinite; }
.gain-box small { font-size: .85rem; color: #7a6a80; }

/* --- classement */
.rank { text-align: center; }
.rank h3 { font-family: var(--font-title); font-weight: 400; font-size: 1.5rem; margin: 2px 0; }
.rank-join { background: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: 8px 10px; margin: 8px 0 12px; }
.rank-join p { margin: 2px 0 8px; font-weight: 600; font-size: .9rem; }
.rank-form { display: flex; gap: 6px; }
.rank-form input {
  flex: 1; min-width: 0; font: inherit; font-weight: 600; padding: 8px 10px; border: 3px solid var(--ink); border-radius: 12px; background: var(--cream);
}
.rank-form input:focus { outline: 3px solid var(--gold); }
.err { color: var(--red); min-height: 1em; margin: 4px 0 0; }
.rank-me { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 8px 0 12px; font-size: 1.05rem; }
.rank-msg { padding: 16px 8px; font-weight: 600; color: #7a6a80; }
.rank-list { list-style: none; margin: 0; padding: 0; text-align: left; }
.rank-list li {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto 54px; align-items: center; gap: 6px;
  padding: 7px 8px; margin-bottom: 5px; border-radius: 12px; background: #fff; border: 2px solid #eadff0; font-weight: 600; font-size: .9rem;
}
.rank-list li:nth-child(-n+3) { background: #fff8d6; border-color: var(--gold); }
.rank-list li.me { background: #eaffdc; border: 3px solid var(--green); }
.rank-list .pos { font-family: var(--font-title); text-align: center; font-size: 1.05rem; }
.rank-list .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-list .sc { font-family: var(--font-title); font-weight: 400; white-space: nowrap; }
.rank-list .sd { font-size: .78rem; color: #7a6a80; text-align: right; white-space: nowrap; }
.rank-sep { color: #7a6a80; line-height: 1; margin: 2px 0 6px; }

.ach-head { font-family: var(--font-title); text-align: center; margin: 4px 0 10px; }
.ach { display: flex; gap: 8px; align-items: center; padding: 7px 10px; border-radius: 12px; background: #f1eaf4; margin-bottom: 6px; font-weight: 600; font-size: .9rem; color: #9a8ca3; }
.ach.done { background: #fff4c2; color: var(--ink); border: 2px solid var(--gold); }

/* ---------------------------------------------------------------- pubs */
.ad-slot { margin-top: 18px; }
.ad-banner { min-height: 90px; }
.ad-side { min-height: 250px; margin-top: 12px; }
.ad-placeholder {
  display: grid; place-items: center; border: 3px dashed rgba(43, 26, 51, .35); border-radius: 16px;
  color: rgba(43, 26, 51, .5); font-weight: 700; letter-spacing: 2px; background: rgba(255, 255, 255, .35);
}
.fake-ad {
  position: fixed; inset: 0; z-index: 400; background: #111; color: #fff; display: grid; place-items: center; text-align: center;
  font-family: var(--font-title); font-size: 1.4rem;
}
.fake-ad div { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.fake-count { width: 70px; height: 70px; border-radius: 50%; border: 5px solid #fff; display: grid; place-items: center; font-size: 2rem; }

/* ---------------------------------------------------------------- effets */
#fx { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 200; }
#floaters { position: fixed; inset: 0; pointer-events: none; z-index: 210; }
.float {
  position: fixed; transform: translate(-50%, -50%); white-space: nowrap;
  font-family: var(--font-title); font-size: 1.5rem; color: #fff; text-shadow: var(--outline);
  animation: floatup 1s ease-out forwards;
}
.float.big { font-size: 2rem; color: var(--gold); }
.float.small { font-size: 1.05rem; color: #fff7c2; }

#toasts { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 440px); }
.toast {
  background: var(--cream); border: 4px solid var(--ink); border-radius: 18px; padding: 10px 16px; text-align: center;
  font-weight: 600; box-shadow: 0 5px 0 var(--ink); animation: toastin .35s cubic-bezier(.3, 1.6, .5, 1);
}
.toast.gold { background: linear-gradient(180deg, #fff6c2, #ffe066); }
.toast.trophy { background: linear-gradient(180deg, #fff, #f3e8ff); }
.toast.out { animation: toastout .4s forwards; }

.modal { position: fixed; inset: 0; z-index: 250; display: grid; place-items: center; padding: 16px;
  background: rgba(43, 26, 51, 0); transition: background .25s, backdrop-filter .25s; }
.modal.open { background: rgba(43, 26, 51, .55); backdrop-filter: blur(3px); }
.modal .card {
  display: block; width: min(420px, 100%); text-align: center; padding: 22px 20px 20px; border-width: 5px; border-radius: 28px;
  background: var(--cream); box-shadow: 0 10px 0 var(--ink); transform: scale(.6); opacity: 0;
  transition: transform .3s cubic-bezier(.3, 1.6, .5, 1), opacity .2s;
}
.modal.open .card { transform: scale(1); opacity: 1; }
.modal h2 { font-family: var(--font-title); font-weight: 400; font-size: 1.8rem; margin: 6px 0; }
.modal-icon { position: relative; height: 120px; display: grid; place-items: center; }
.modal-icon::before {
  content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%; z-index: 0;
  background: repeating-conic-gradient(rgba(255, 210, 63, .45) 0 12deg, transparent 12deg 24deg);
  -webkit-mask: radial-gradient(circle, #000 20%, transparent 70%); mask: radial-gradient(circle, #000 20%, transparent 70%);
  animation: spin 8s linear infinite;
}
.modal-img { position: relative; width: 120px; z-index: 1; }
.big-x2 { position: relative; z-index: 1; font-family: var(--font-title); font-size: 4rem; color: var(--gold); text-shadow: var(--outline); animation: wobble 1.2s infinite; }
.bee-sleep { position: relative; z-index: 1; width: 120px; height: 120px; background: url(../assets/sprites/bee.png) 0 0 / 800% 100%; animation: beeflap .35s steps(8) infinite, float 2s ease-in-out infinite; }
@keyframes beeflap { to { background-position: -960px 0; } }
.reward { font-family: var(--font-title); font-size: 2rem; margin: 8px 0; }
.reward .coin-inline { width: 36px; height: 36px; vertical-align: -6px; }
.modal-btns { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.modal-btns .btn { font-size: 1.2rem; padding: 12px; }
.streak { display: flex; justify-content: center; gap: 6px; margin: 4px 0; }
.day { width: 32px; height: 32px; border-radius: 10px; border: 3px solid var(--ink); display: grid; place-items: center; font-weight: 700; background: #fff; }
.day.on { background: var(--gold); }
.wobble { animation: wobble 1s ease-in-out infinite; }

/* ---------------------------------------------------------------- contenu */
.content {
  max-width: 900px; margin: 30px auto; padding: 24px 28px; background: rgba(255, 248, 230, .92);
  border: 4px solid var(--ink); border-radius: 24px; line-height: 1.6; box-shadow: 0 8px 0 var(--ink);
}
.content h1 { font-family: var(--font-title); font-weight: 400; font-size: 2rem; line-height: 1.15; margin-top: 0; }
.content h2 { font-family: var(--font-title); font-weight: 400; font-size: 1.4rem; margin-bottom: 4px; }
.content h3 { font-size: 1.05rem; margin-bottom: 0; }
.foot { text-align: center; padding: 10px 16px 40px; font-weight: 600; }
.foot a { color: var(--ink); }

/* ---------------------------------------------------------------- animations */
@keyframes bump { 50% { transform: scale(1.08); } }
@keyframes pulse { 50% { transform: scale(1.05); } }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
@keyframes plantpop { 0% { transform: scale(1, 1); } 30% { transform: scale(1.25, .75); } 60% { transform: scale(.9, 1.15); } 100% { transform: scale(1, 1); } }
@keyframes glowpulse { 50% { opacity: .55; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes canbuy { 0%, 100% { box-shadow: inset 0 -4px 0 rgba(0,0,0,.18), 0 4px 0 var(--ink), 0 0 0 0 rgba(90, 209, 15, .6); }
  50% { box-shadow: inset 0 -4px 0 rgba(0,0,0,.18), 0 4px 0 var(--ink), 0 0 0 6px rgba(90, 209, 15, 0); } }
@keyframes goldglow { to { filter: drop-shadow(0 0 14px #fff3a0) drop-shadow(0 0 26px #ffb300); } }
@keyframes pop { 0% { transform: translateX(-50%) scale(.5); } 100% { transform: translateX(-50%) scale(1); } }
@keyframes hue { to { filter: hue-rotate(360deg); } }
@keyframes tapfinger { 50% { transform: translateY(8px) scale(.9); } }
@keyframes floatup { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -260%) scale(1); } }
@keyframes toastin { from { transform: translateY(-30px) scale(.8); opacity: 0; } }
@keyframes toastout { to { transform: translateY(-20px); opacity: 0; } }
@keyframes float { 50% { transform: translateY(-8px); } }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr) 340px; }
  /* classement : tiroir a gauche + bouton fixe toujours visible */
  .lb-side {
    position: fixed; z-index: 120; top: 0; bottom: 0; left: 0; width: min(300px, 86vw); max-height: none;
    border-radius: 0 26px 26px 0; border-left: 0; transform: translateX(-105%); transition: transform .3s cubic-bezier(.3, 1.3, .5, 1);
  }
  body.lb-open .lb-side { transform: none; }
  .lb-toggle {
    display: flex; flex-direction: column; align-items: center; gap: 0; position: fixed; z-index: 110; left: 0; top: 42%;
    padding: 8px 8px 8px 6px; border: 4px solid var(--ink); border-left: 0; border-radius: 0 16px 16px 0;
    background: linear-gradient(180deg, #ffe98a, var(--gold)); box-shadow: 0 5px 0 var(--ink); font-family: var(--font-title);
  }
  .lb-toggle span { font-size: 1.4rem; line-height: 1.1; }
  .lb-toggle b { font-weight: 400; font-size: .9rem; }
  body.lb-open .lb-backdrop { display: block; position: fixed; inset: 0; z-index: 115; background: rgba(43, 26, 51, .45); }
}
@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .panel { position: static; max-height: none; }
}
@media (max-width: 640px) {
  .row-bar {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    grid-template-areas: "ico name buy" "prog prog bee";
    row-gap: 6px;
  }
  .row-ico { width: 36px; height: 36px; }
  .row.bee-on .row-bar { grid-template-areas: "ico name buy" "prog prog prog"; }
}
@media (max-width: 560px) {
  .hud { padding: 8px 10px; gap: 8px; }
  .brand span { display: none; }
  .brand img { width: 38px; height: 38px; }
  .coin-ico { width: 34px; height: 34px; background-size: 408px 34px; }
  @keyframes coinspin { to { background-position: -408px 0; } }
  #coins { font-size: 1.4rem; }
  .lvl b { min-width: 30px; height: 30px; font-size: .95rem; }
  .xpbar { width: 34px; }
  .pill { height: 40px; padding: 0 10px; font-size: 1rem; }
  .icon-btn { width: 40px; height: 40px; }
  .icon-btn img { width: 32px; height: 32px; }
  #btnLang { display: none; }
  .layout { padding: 4px 8px 20px; }
  .garden { border-radius: 20px; padding: 0 2% 14px; }
  .flowers { display: none; }
  .tree { left: auto; right: 0; height: 120%; }
  .map-btn img { width: 42px; height: 42px; }
  .island { width: 92%; }
  .plate b { font-size: 1.1rem; }
  .content { margin: 20px 10px; padding: 18px; }
  .sac-list { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
