:root {
  --bg: #0d1220; --bg2: #141b2d; --panel: rgba(24, 32, 50, .88); --panel2: rgba(36, 46, 70, .9);
  --line: rgba(255, 255, 255, .08); --text: #e9edf5; --muted: #8e99ad;
  --gold: #f5c451; --gold2: #e09a2b; --green: #7bd389; --red: #ff6b6b; --blue: #5cb8ff; --purple: #b48cff;
  --r: 14px; --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Nunito, system-ui, sans-serif; color: var(--text); font-size: 14px;
  background: radial-gradient(1200px 600px at 70% -10%, #23305a 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, #1d3b2e 0%, transparent 60%), var(--bg);
  display: grid; grid-template-columns: 220px 1fr; grid-template-rows: 64px 1fr; overflow: hidden;
}
h1, h2, h3 { font-family: Fredoka, Nunito, sans-serif; margin: 0 0 8px; font-weight: 600; letter-spacing: .2px; }
h2 { font-size: 20px; } h3 { font-size: 16px; }
p { margin: 6px 0; line-height: 1.45; }
small { color: var(--muted); }
img { image-rendering: auto; }
img.ico { width: 16px !important; height: 16px !important; vertical-align: -3px; display: inline !important; }
.muted { color: var(--muted); }
.ok { color: var(--green); font-weight: 700; }
.warn { color: #ffb347; font-weight: 700; }
.gold { color: var(--gold); }
.center { text-align: center; }
.big { width: 96px; height: 96px; object-fit: contain; }
.huge { font-size: 32px; font-family: Fredoka; color: var(--gold); }

/* Barre du haut */
#topbar {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; padding: 0 16px;
  background: linear-gradient(180deg, rgba(20, 27, 45, .98), rgba(15, 20, 34, .95)); border-bottom: 1px solid var(--line); z-index: 5;
}
.brand { display: flex; align-items: center; gap: 8px; font-family: Fredoka; font-size: 19px; color: var(--gold); min-width: 190px; }
.brand img { width: 30px; }
.purse { display: flex; gap: 10px; }
.r { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); }
.r img { width: 22px; height: 22px; object-fit: contain; }
.r b { font-family: Fredoka; font-size: 16px; }
.r.main { border-color: rgba(245, 196, 81, .4); box-shadow: 0 0 0 3px rgba(245, 196, 81, .07); }
.r.main b { color: var(--gold); font-size: 18px; min-width: 70px; }
.r small { color: var(--green); font-weight: 700; }
#buffs { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.buff { font-size: 12px; padding: 4px 9px; border-radius: 999px; background: rgba(255, 120, 60, .18); border: 1px solid rgba(255, 140, 60, .4); }
.buff.alm { background: rgba(92, 184, 255, .15); border-color: rgba(92, 184, 255, .4); }
.tools { display: flex; gap: 6px; }

/* Navigation */
#nav { background: rgba(14, 19, 32, .9); border-right: 1px solid var(--line); padding: 10px 8px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.nav-btn {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 10px; background: transparent;
  color: var(--text); font: 700 14px Nunito; cursor: pointer; text-align: left; position: relative; transition: background .15s;
}
.nav-btn img { width: 26px; height: 26px; object-fit: contain; }
.nav-btn:hover { background: rgba(255, 255, 255, .05); }
.nav-btn.on { background: linear-gradient(90deg, rgba(245, 196, 81, .2), rgba(245, 196, 81, .04)); color: var(--gold); box-shadow: inset 3px 0 0 var(--gold); }
.badge { position: absolute; right: 8px; background: var(--red); color: #fff; font-size: 11px; border-radius: 999px; padding: 1px 6px; }

#view { overflow-y: auto; padding: 18px 22px 80px; display: flex; flex-direction: column; gap: 14px; }

/* Composants */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.btn {
  border: 1px solid rgba(255, 255, 255, .12); background: var(--panel2); color: var(--text); font: 700 13px Nunito;
  padding: 8px 12px; border-radius: 10px; cursor: pointer; transition: transform .08s, filter .15s, background .15s; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
}
.btn:hover:not(:disabled) { filter: brightness(1.15); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.gold { background: linear-gradient(180deg, var(--gold), var(--gold2)); color: #2b1a00; border-color: rgba(255, 220, 140, .6); }
.btn.danger { background: #7a2630; border-color: #b33a48; }
.btn.small { padding: 5px 9px; font-size: 12px; }
.btn.wide { width: 100%; margin-top: 10px; }
.btn.icon { width: 38px; height: 38px; padding: 0; font-size: 17px; }
.btn.work { background: linear-gradient(180deg, #3b8f55, #2b6b3f); border-color: #59b977; }
.bar { height: 8px; background: rgba(255, 255, 255, .08); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold2), var(--gold)); border-radius: 99px; transition: width .25s linear; }
.bar.xpb i { background: linear-gradient(90deg, #3a7bd5, var(--blue)); }
.bar.matb i { background: linear-gradient(90deg, #b44fd1, #ff7ad9); }
.bar.msb i, .bar.qb i, .bar.ordb i { background: linear-gradient(90deg, #2f9e5a, var(--green)); }
.toolbar { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; align-items: center; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.seg.wrap { flex-wrap: wrap; }
.seg .muted { padding: 0 6px; font-size: 12px; }
.seg button { border: 0; background: transparent; color: var(--text); font: 700 12px Nunito; padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.seg button.on { background: var(--gold); color: #2b1a00; }
.seg.tiny button { padding: 4px 8px; }
.row-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.row-head > img { width: 44px; height: 44px; object-fit: contain; }
.row-head > div { flex: 1; }
.effect { background: rgba(123, 211, 137, .1); border: 1px solid rgba(123, 211, 137, .3); padding: 8px 10px; border-radius: 10px; }
.next { color: var(--blue); }

/* Village */
.hero-banner {
  border-radius: var(--r); padding: 22px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center;
  background: linear-gradient(110deg, rgba(14, 14, 16, .92) 30%, rgba(145, 70, 255, .18)); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.hero-banner h1 { font-size: 28px; color: var(--gold); }
.hero-banner p { max-width: 520px; color: #cbd3e2; }
.chips { display: flex; gap: 10px; flex-wrap: wrap; }
.chip { display: flex; align-items: center; gap: 8px; background: rgba(20, 27, 45, .85); border: 1px solid var(--line); padding: 8px 12px; border-radius: 12px; }
.chip img { width: 28px; height: 28px; object-fit: contain; }
.chip small { display: block; font-size: 11px; }
.chip b { font-family: Fredoka; font-size: 15px; }
.mainq { display: flex; align-items: center; gap: 14px; }
.mainq img { width: 42px; height: 42px; object-fit: contain; }
.mainq > div { flex: 1; display: flex; flex-direction: column; }
.mainq.ready { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(245, 196, 81, .25), var(--shadow); }
.build-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.build-row img { width: 32px; height: 32px; object-fit: contain; }
.build-row span { min-width: 200px; }
.grow { flex: 1; display: flex; align-items: center; gap: 8px; }
.grow .bar { flex: 1; }
.map {
  border-radius: var(--r); padding: 16px; border: 1px solid var(--line); box-shadow: var(--shadow);
  background: radial-gradient(circle at 20% 10%, rgba(255, 255, 255, .06), transparent 40%), repeating-linear-gradient(45deg, rgba(0, 0, 0, .04) 0 12px, transparent 12px 24px), linear-gradient(160deg, #3f6b2f, #2c5226 50%, #24451f);
}
.district { font-size: 15px; color: #f3e6b5; text-shadow: 0 2px 4px rgba(0, 0, 0, .6); margin: 14px 4px 6px; display: flex; align-items: center; gap: 8px; }
.district::after { content: ''; flex: 1; height: 2px; background: linear-gradient(90deg, rgba(243, 230, 181, .4), transparent); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.tile {
  position: relative; height: 170px; border-radius: 14px; cursor: pointer; display: flex; align-items: flex-end; justify-content: center;
  background: radial-gradient(ellipse 60% 22% at 50% 82%, rgba(0, 0, 0, .35), transparent 70%), radial-gradient(ellipse at 50% 80%, rgba(210, 190, 120, .25), transparent 60%);
  transition: transform .15s;
}
.tile:hover { transform: translateY(-3px); }
.tile:hover .house { filter: drop-shadow(0 0 10px rgba(245, 196, 81, .7)); }
.tile .house { position: absolute; bottom: 28px; max-height: 130px; max-width: 110px; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .5)); transition: filter .15s; }
.tile.locked .house { filter: grayscale(1) brightness(.55); opacity: .55; }
.tile.locked { background: repeating-linear-gradient(135deg, rgba(0, 0, 0, .12) 0 8px, transparent 8px 16px); outline: 2px dashed rgba(255, 255, 255, .15); outline-offset: -4px; }
.tile.building .house { filter: grayscale(.5) brightness(.85); }
.job-badge { position: absolute; top: 6px; left: 6px; width: 30px; height: 30px; border-radius: 50%; background: rgba(13, 18, 32, .85); padding: 3px; border: 1px solid rgba(245, 196, 81, .5); }
.plate { position: relative; display: flex; align-items: center; gap: 6px; background: rgba(13, 18, 32, .88); border: 1px solid rgba(245, 196, 81, .35); padding: 3px 4px 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 800; margin-bottom: 4px; max-width: 96%; }
.plate span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plate b { background: var(--gold); color: #2b1a00; border-radius: 99px; padding: 0 7px; font-size: 11px; }
.price { position: absolute; top: 50px; background: rgba(13, 18, 32, .85); padding: 3px 8px; border-radius: 8px; font-size: 12px; font-weight: 800; color: var(--gold); text-align: center; max-width: 92%; }
.tile-prog { position: absolute; top: 8px; left: 10px; right: 10px; background: rgba(13, 18, 32, .85); border-radius: 8px; padding: 4px 6px; display: flex; flex-direction: column; gap: 2px; font-size: 11px; }
.tile-prog small { color: var(--text); text-align: center; }

/* Vue 3D du village : le sol est incliné, les maisons (sprites) restent debout face à la caméra */
.map { position: relative; }
.map-toggle { position: absolute; top: 10px; right: 10px; z-index: 2; }
.stand { display: contents; }
.tree { display: none; }
.map.v3d {
  --tilt: 45deg; overflow: hidden; flex-shrink: 0; perspective: 2400px; perspective-origin: 50% 0; padding: 100px 40px 20px; cursor: grab;
  background: linear-gradient(180deg, #8fc6e8, #cfe7d6 180px, #6f9a4c 181px, #3f6b2f);
}
.map.v3d:active { cursor: grabbing; }
.map.v3d .ground {
  transform-style: preserve-3d; transform-origin: 50% 100%; transform: rotateX(var(--tilt)) rotateZ(var(--yaw));
  position: relative; padding: 26px 34px 60px; border-radius: 40px; user-select: none;
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, .08), transparent 45%), radial-gradient(circle at 80% 70%, rgba(0, 0, 0, .12), transparent 40%), repeating-linear-gradient(45deg, rgba(0, 0, 0, .05) 0 14px, transparent 14px 28px), linear-gradient(160deg, #4f8a36, #3a6e2c 50%, #2f5c26);
  box-shadow: inset 0 0 0 10px rgba(120, 90, 50, .55), inset 0 0 0 14px rgba(70, 50, 25, .5);
}
.map.v3d .tiles, .map.v3d .tile { transform-style: preserve-3d; }
.map.v3d .tiles { padding: 14px; border-radius: 22px; background: linear-gradient(135deg, rgba(214, 190, 136, .55), rgba(170, 140, 90, .55)); box-shadow: inset 0 0 0 3px rgba(120, 90, 50, .5); }
.map.v3d .district { margin: 22px 4px 8px; font-size: 18px; transform-origin: 50% 100%; transform: rotateX(calc(-1 * var(--tilt))); }
.map.v3d .tile { height: 150px; transition: none; }
/* Rangées espacées et étiquettes empilées sous la maison : la rangée de devant ne cache plus les noms de celle de derrière */
.map.v3d .tile .house { position: static; max-height: 120px; max-width: 115px; margin-bottom: -6px; }
.map.v3d .price { position: static; margin-bottom: 3px; padding: 1px 7px; font-size: 11px; }
.map.v3d .tile:hover { transform: none; }
.map.v3d .stand {
  display: flex; flex-direction: column; position: absolute; left: 0; right: 0; bottom: 10px; align-items: center; justify-content: flex-end;
  transform-origin: 50% 100%; transform: rotateZ(calc(-1 * var(--yaw))) rotateX(calc(-1 * var(--tilt))); transition: translate .15s;
}
.map.v3d .tile:hover .stand { translate: 0 0 14px; }
.map.v3d img { -webkit-user-drag: none; }
.map.v3d .tree {
  display: block; position: absolute; font-size: 54px; font-style: normal; line-height: 1; pointer-events: none;
  transform-origin: 50% 100%; transform: translate(-50%, -100%) rotateZ(calc(-1 * var(--yaw))) rotateX(calc(-1 * var(--tilt))); filter: drop-shadow(0 6px 4px rgba(0, 0, 0, .35));
}

/* Métiers */
.grid.jobs { grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); }
.job { display: flex; flex-direction: column; gap: 10px; transition: box-shadow .3s; }
.job.flash { box-shadow: 0 0 0 3px var(--gold); }
.job.locked { opacity: .75; }
.jhead { display: flex; align-items: center; gap: 10px; }
.jhead img { width: 46px; height: 46px; object-fit: contain; }
.jhead > div { flex: 1; }
.jhead h3 { margin: 0; }
.mult { background: rgba(123, 211, 137, .15); color: var(--green); font-weight: 800; border-radius: 8px; padding: 3px 8px; font-size: 12px; }
.tier { display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, .04); border-radius: 10px; padding: 6px 8px; }
.tier img { width: 38px; height: 38px; object-fit: contain; }
.tier div { display: flex; flex-direction: column; }
.inputs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 800; }
.inputs span { display: inline-flex; align-items: center; gap: 2px; background: rgba(255, 255, 255, .05); border-radius: 8px; padding: 2px 6px 2px 2px; }
.inputs img { width: 26px; height: 26px; object-fit: contain; }
.inputs i { color: var(--muted); font-style: normal; }
.inputs em { color: #ffb347; font-style: normal; font-size: 12px; margin-left: auto; cursor: help; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.stats div { background: rgba(0, 0, 0, .18); border-radius: 8px; padding: 6px 8px; display: flex; flex-direction: column; }
.stats small { font-size: 11px; }
.stats .wide { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; }
.stats b { font-family: Fredoka; font-weight: 500; font-size: 15px; }
.ms { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.actions .btn.gold { flex: 1; }
.jlocked { display: flex; flex-direction: column; gap: 8px; }
.float { position: fixed; pointer-events: none; color: var(--green); font: 700 16px Fredoka; transform: translate(-50%, 0); animation: floatUp .9s ease-out forwards; z-index: 50; text-shadow: 0 2px 4px #000; }
@keyframes floatUp { to { transform: translate(-50%, -50px); opacity: 0; } }

/* HDV */
.hdv-head, .elev-head, .ach-head, .shop-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.hdv-head > img, .elev-head > img, .ach-head > img, .shop-head > img { width: 72px; height: 72px; object-fit: contain; }
.hdv-head > div, .elev-head > div, .ach-head > div, .shop-head > div { flex: 1; min-width: 260px; }
#incomeChart { background: rgba(0, 0, 0, .2); border-radius: 10px; max-width: 100%; }
.table-wrap { overflow-x: auto; padding: 6px; }
table.hdv { width: 100%; border-collapse: collapse; }
.hdv th { text-align: left; color: var(--muted); font-size: 12px; padding: 8px; border-bottom: 1px solid var(--line); }
.hdv td { padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.res { display: flex; align-items: center; gap: 8px; }
.res img { width: 34px; height: 34px; object-fit: contain; }
.res div { display: flex; flex-direction: column; }
.trend { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 12px; }
.trend.up { color: var(--green); } .trend.down { color: var(--red); }

/* Élevage */
.wilds { display: flex; gap: 12px; flex-wrap: wrap; }
.wild { display: flex; flex-direction: column; align-items: center; gap: 4px; background: rgba(255, 255, 255, .04); padding: 10px 14px; border-radius: 12px; }
.wild img { width: 64px; height: 64px; object-fit: contain; }
.wild > div { display: flex; gap: 4px; }
.enclos { border-radius: var(--r); padding: 14px; background-size: cover; background-position: center; border: 1px solid var(--line); box-shadow: var(--shadow); }
.enclos-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.enclos-head h3 { margin: 0; text-shadow: 0 2px 4px #000; }
.toggle { display: inline-flex; gap: 6px; align-items: center; font-weight: 700; cursor: pointer; }
.mounts { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.mount { display: flex; gap: 8px; background: rgba(13, 18, 32, .82); border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.mount.preg { border-color: #ff7ad9; }
.mount > img { width: 62px; height: 62px; object-fit: contain; }
.mi { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mi .f { color: #ff7ad9; } .mi .m { color: var(--blue); }
.mact { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.collection { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 6px; }
.col { text-align: center; background: rgba(0, 0, 0, .2); border-radius: 10px; padding: 4px; cursor: help; }
.col img { width: 46px; height: 46px; object-fit: contain; filter: brightness(0) opacity(.35); }
.col.got img { filter: none; }
.col small { display: block; font-size: 10px; }

/* Donjons */
.dofus { display: flex; flex-wrap: wrap; gap: 8px; }
.dof { width: 52px; height: 52px; border-radius: 12px; background: rgba(0, 0, 0, .25); display: grid; place-items: center; cursor: help; }
.dof img { width: 40px; height: 40px; object-fit: contain; filter: grayscale(1) brightness(.4); }
.dof.got { background: radial-gradient(circle, rgba(245, 196, 81, .3), rgba(0, 0, 0, .2)); }
.dof.got img { filter: drop-shadow(0 0 6px rgba(245, 196, 81, .8)); }
.heroes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.hero { display: flex; gap: 10px; background: rgba(255, 255, 255, .04); border: 2px solid transparent; border-radius: 12px; padding: 8px; cursor: pointer; }
.hero.sel { border-color: var(--gold); background: rgba(245, 196, 81, .1); }
.hero.busy { opacity: .6; cursor: default; }
.hero > img { width: 64px; height: 80px; object-fit: cover; border-radius: 8px; }
.hi { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.recruit { margin-top: 10px; }
.recruit summary { list-style: none; }
.classes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin-top: 8px; }
.cls { display: flex; flex-direction: column; align-items: center; gap: 4px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 8px; color: var(--text); cursor: pointer; font-family: Nunito; }
.cls:hover { border-color: var(--gold); }
.cls img { width: 60px; height: 60px; object-fit: cover; border-radius: 50%; }
.cls small { text-align: center; font-size: 11px; }
.dungeons { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.dun { display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, .04); border-radius: 12px; padding: 8px; }
.dun.won { box-shadow: inset 3px 0 0 var(--green); }
.dun > img { width: 64px; height: 64px; object-fit: contain; }
.di { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.drop { display: flex; align-items: center; gap: 4px; color: var(--gold); }
.drop img { width: 18px; height: 18px; }
.log { display: flex; flex-direction: column; gap: 4px; max-height: 60vh; overflow-y: auto; }
.log-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px; background: rgba(255, 255, 255, .03); border-radius: 8px; }
.log-row img { width: 28px; height: 28px; object-fit: contain; }
.log-row span { flex: 1; }
.log-row.ok { box-shadow: inset 3px 0 0 var(--green); } .log-row.ko { box-shadow: inset 3px 0 0 var(--red); }
.archis { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 4px; }
.archis img { width: 44px; height: 44px; object-fit: contain; filter: brightness(0) opacity(.3); }
.archis img.got { filter: none; }
.archi { position: fixed; width: 90px; height: 90px; object-fit: contain; cursor: pointer; z-index: 40; filter: drop-shadow(0 0 12px #ffd76a) drop-shadow(0 0 4px #fff); animation: archi 12s ease-in-out forwards; }
@keyframes archi { 0% { opacity: 0; transform: scale(.3) rotate(-20deg); } 8% { opacity: 1; transform: scale(1.1); } 25%, 75% { transform: translateY(-14px) scale(1); } 50% { transform: translateY(10px) scale(1.05); } 90% { opacity: 1; } 100% { opacity: 0; transform: scale(.6); } }

/* Commandes */
.grid.orders { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.order { display: flex; flex-direction: column; gap: 8px; }
.order.wait { align-items: center; justify-content: center; opacity: .6; min-height: 150px; }
.order.wait img { width: 40px; }

/* Quêtes */
.almanax h3 { color: var(--blue); }
.offering { display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, .04); border-radius: 10px; padding: 8px; margin: 8px 0; }
.offering img { width: 48px; height: 48px; }
.offering div { display: flex; flex-direction: column; }
.calendar { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; margin: 10px 0; }
.day { background: rgba(255, 255, 255, .04); border-radius: 10px; padding: 6px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; font-size: 10.5px; border: 2px solid transparent; }
.day img { width: 30px; height: 30px; object-fit: contain; }
.day.done { opacity: .45; }
.day.today { border-color: var(--gold); background: rgba(245, 196, 81, .12); }
.quests { display: flex; flex-direction: column; gap: 8px; }
.quest { display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, .04); border-radius: 12px; padding: 8px 10px; }
.quest.done { opacity: .55; }
.quest > img { width: 36px; height: 36px; object-fit: contain; }
.qi { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.chain { display: flex; flex-direction: column; gap: 4px; }
.step { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; color: var(--muted); }
.step span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .06); font-weight: 800; font-size: 12px; }
.step b { flex: 1; font-weight: 600; }
.step.done { color: var(--green); } .step.done span { background: rgba(123, 211, 137, .2); }
.step.cur { color: var(--text); background: rgba(245, 196, 81, .1); } .step.cur span { background: var(--gold); color: #2b1a00; }

/* Succès & boutique */
.grid.achs { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.ach { display: flex; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; opacity: .55; }
.ach.got { opacity: 1; border-color: rgba(245, 196, 81, .45); }
.ach img { width: 46px; height: 46px; object-fit: contain; filter: grayscale(1); }
.ach.got img { filter: none; }
.ach div { display: flex; flex-direction: column; }
.ach .rew { color: var(--gold); }
.grid.shop { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.item { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.item img { width: 64px; height: 64px; object-fit: contain; }
.item.owned { opacity: .6; }
.wallet { font: 600 24px Fredoka; display: flex; align-items: center; gap: 6px; }
.wallet .ico { width: 28px; height: 28px; }

/* Renaissance & options */
.prestige { text-align: center; max-width: 760px; margin: 0 auto; }
.pp { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.pp div { background: rgba(0, 0, 0, .2); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; }
.pp b { font: 600 26px Fredoka; }
.stats-t { width: 100%; border-collapse: collapse; }
.stats-t td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
.stats-t td:last-child { text-align: right; font-weight: 800; }
.opt { display: flex; align-items: center; gap: 10px; margin: 10px 0; font-weight: 700; }
.opt input[type=range] { flex: 1; accent-color: var(--gold); }
.savebox { width: 100%; height: 140px; background: rgba(0, 0, 0, .3); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 8px; font-family: monospace; font-size: 11px; }

/* Toasts, modale */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: rgba(20, 27, 45, .97); border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 10px; padding: 10px 12px; box-shadow: var(--shadow); animation: tin .3s ease-out; font-size: 13px; }
.toast.gold, .toast.ach { border-left-color: var(--gold); }
.toast.warn { border-left-color: #ffb347; }
.toast.lvl { border-left-color: var(--blue); }
.toast.out { opacity: 0; transform: translateX(30px); transition: .4s; }
@keyframes tin { from { opacity: 0; transform: translateX(30px); } }
#modal { position: fixed; inset: 0; background: rgba(5, 8, 15, .7); backdrop-filter: blur(4px); display: none; place-items: center; z-index: 70; padding: 16px; }
#modal.on { display: grid; }
.modal-card { position: relative; background: var(--bg2); border: 1px solid rgba(245, 196, 81, .3); border-radius: 18px; padding: 22px; width: min(520px, 100%); max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow); animation: pop .2s ease-out; }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }
.modal-card .x { position: absolute; top: 10px; right: 10px; border: 0; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; }
.mhead { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.mhouse { width: 90px; height: 110px; object-fit: contain; }
.mjob { width: 64px; height: 64px; }

/* Mobile */
@media (max-width: 860px) {
  body { grid-template-columns: 1fr; grid-template-rows: auto 1fr 62px; }
  #topbar { flex-wrap: wrap; padding: 8px 16px; gap: 8px; }
  .brand { display: none; } .r small { display: none; } .purse { gap: 6px; flex: 1; } .tools .btn.icon { width: 32px; height: 32px; font-size: 15px; }
  .r { padding: 4px 8px; } .r.main b { min-width: 0; font-size: 16px; }
  #buffs { order: 5; flex-basis: 100%; }
  #nav { grid-row: 3; flex-direction: row; overflow-x: auto; border-right: 0; border-top: 1px solid var(--line); padding: 4px 6px; }
  .nav-btn { flex-direction: column; gap: 2px; font-size: 10px; padding: 4px 8px; min-width: 64px; align-items: center; text-align: center; }
  .nav-btn span { white-space: nowrap; }
  .nav-btn.on { box-shadow: inset 0 -3px 0 var(--gold); }
  .badge { top: 2px; right: 4px; }
  #view { padding: 12px 16px 24px; }
  .grid.two { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .tile { height: 150px; } .tile .house { max-height: 105px; max-width: 92px; }
  .map.v3d { --tilt: 40deg; padding: 70px 6px 10px; }
  .map.v3d .ground { padding: 14px 10px 30px; border-radius: 24px; }
  .map.v3d .tiles { grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 6px; }
  .map.v3d .tile { height: 120px; } .map.v3d .tile .house { max-height: 70px; max-width: 70px; }
  .map.v3d .plate { font-size: 10px; } .map.v3d .tree { font-size: 34px; }
  .build-row span { min-width: 0; flex-basis: 100%; } .build-row { flex-wrap: wrap; }

  .pp { grid-template-columns: 1fr; }
  .grid.jobs, .mounts, .heroes, .dungeons { grid-template-columns: 1fr; }
}

/* DA des mini-jeux Lomitall : fond, barre du haut, menu, sans barres de défilement */
:root { --bg: #0e0e10; --bg2: #18181b; --panel: rgba(24, 24, 27, .88); --panel2: rgba(39, 39, 42, .9); --line: rgba(255, 255, 255, .1); --muted: #a1a1aa; }
* { scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }
body { font-family: Inter, system-ui, sans-serif; background: radial-gradient(1200px 600px at 70% -10%, rgba(145, 70, 255, .16) 0%, transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(6, 182, 212, .1) 0%, transparent 60%), var(--bg); }
.nav-btn, .btn, .seg button { font-family: Inter, system-ui, sans-serif; }
#topbar { background: rgba(14, 14, 16, .85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
#nav { background: rgba(14, 14, 16, .85); }
.nav-btn.on { background: linear-gradient(90deg, rgba(145, 70, 255, .3), rgba(145, 70, 255, .05)); color: #fff; box-shadow: inset 3px 0 0 #9146FF; }
.brand { min-width: 0; gap: 10px; }
.lm-ico { width: 32px; height: 32px; border-radius: 9999px; flex: none; display: flex; align-items: center; justify-content: center; background: rgba(66, 32, 6, .5); border: 1px solid rgba(245, 158, 11, .4); box-shadow: 0 4px 6px rgba(0, 0, 0, .3); }
.brand .lm-ico img { width: 20px; }
.lm-brand { display: inline-flex; flex-direction: column; font-family: Inter, sans-serif; font-size: 15px; }
.lm-brand b { font-weight: 800; letter-spacing: .15em; background: linear-gradient(135deg, #fff 0%, #d4eaf7 50%, #b2e2f8 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lm-brand i { height: 2px; margin-top: 1px; border-radius: 9999px; background: linear-gradient(90deg, rgba(6, 182, 212, .8) 0%, rgba(145, 70, 255, .6) 50%, transparent 100%); }
.lm-game { padding-left: 10px; border-left: 1px solid var(--line); white-space: nowrap; }

/* Mention de droits (credits.js) au-dessus de la barre de navigation mobile */
@media (max-width: 860px) { .lm-credits { bottom: 66px !important; } }
