@font-face { font-family: 'Bagel Fat One'; src: url(fonts/bagel-fat-one.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Bricolage Grotesque'; src: url(fonts/bricolage-grotesque.woff2) format('woff2'); font-weight: 400 800; font-display: swap; }

:root {
  --ink: #2A1915;
  --ink-soft: #5A3A2E;
  --ground: #C8793A;
  --gold: #FFC83D;
  --gold-lip: #E0A21C;
  --cream: #FFF4DC;
  --cream-lip: #E8D4AE;
  --cream-dim: #E6D2BF;
  --tomato: #D2371C;
  --tomato-hi: #E8452A;
  --tomato-lip: #A52812;
  --blue: #2F5BEA;
  --mint: #1FAF7A;
  --display: 'Bagel Fat One', 'Bricolage Grotesque', sans-serif;
  --ui: 'Bricolage Grotesque', system-ui, sans-serif;
  --out: cubic-bezier(.16, 1, .3, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  /* Une étiquette en carton : une tranche claire dessous, une ombre douce sur la table. */
  --label: inset 0 -4px 0 var(--cream-lip), 0 10px 20px rgba(42, 25, 21, .32), 0 2px 4px rgba(42, 25, 21, .2);
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  background: var(--ground); color: var(--ink);
  font: 500 15px/1.35 var(--ui); font-variant-numeric: tabular-nums;
  overflow: hidden; -webkit-font-smoothing: antialiased;
  user-select: none; -webkit-user-select: none;
}
::selection { background: var(--ink); color: var(--gold); }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
[hidden] { display: none !important; }

html { overflow: hidden; }
#app { height: 100dvh; width: 100%; max-width: 100vw; overflow: hidden; display: grid; grid-template-rows: minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); }
#stage { position: relative; min-height: 0; }
#c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#app[data-placing] #c { cursor: none; }

/* ---------- Étiquettes du haut ---------- */
#hud { position: absolute; inset: 14px 18px auto; display: flex; align-items: center; gap: 12px; pointer-events: none; }
#hud > * { pointer-events: auto; }
.pill {
  display: flex; align-items: center; gap: 8px; height: 50px; padding: 0 18px 4px 12px;
  background: var(--cream); border-radius: 18px; box-shadow: var(--label); rotate: -2.5deg;
}
#money { rotate: 1.5deg; }
.pill b { font: 400 25px/1 var(--display); min-width: 2ch; }
.pill svg { width: 28px; height: 28px; }
.pill.bump { animation: bump .45s var(--spring); }
#lives.danger { background: var(--tomato-hi); color: #fff; animation: danger .76s ease-in-out infinite; }
#lives.danger svg { filter: brightness(0) invert(1); }
@keyframes danger { 0%, 100% { scale: 1; } 12% { scale: 1.16; } 30% { scale: 1.08; } }
@keyframes bump { 0% { scale: 1.2; } 100% { scale: 1; } }
#streak { font-weight: 800; font-size: 13px; padding: 3px 9px; border-radius: 11px; background: var(--ink); color: var(--gold); rotate: 4deg; }
#streak.bump { animation: bump .45s var(--spring); }

.wave { margin-left: auto; display: flex; align-items: center; gap: 12px; height: 50px; padding: 0 7px 4px 18px; background: var(--cream); border-radius: 18px; box-shadow: var(--label); rotate: 1deg; }
.wave:has(#go[hidden]) { padding-right: 18px; }
#waveLabel { font: 400 20px/1 var(--display); white-space: nowrap; }
#waveBar { width: 104px; height: 12px; border-radius: 6px; background: rgba(42, 25, 21, .14); overflow: hidden; }
#waveBar b { display: block; height: 100%; border-radius: 6px; background: var(--tomato-hi); transform-origin: left; transition: transform .3s var(--out); }
#mult { font: 400 18px/1 var(--display); color: var(--tomato); min-width: 3.5ch; }
#preview { display: flex; align-items: center; gap: 10px; }
#preview span { display: flex; align-items: center; gap: 3px; font-weight: 800; font-size: 14px; color: var(--ink-soft); }
#preview canvas { width: 28px; height: 28px; background: var(--gold); border-radius: 50%; }

.btn { height: 36px; padding: 0 18px 3px; border-radius: 14px; font-weight: 800; font-size: 15px; white-space: nowrap; transition: transform .25s var(--spring), background-color .15s, filter .15s; }
.btn.primary { background: var(--tomato-hi); color: #fff; box-shadow: inset 0 -4px 0 var(--tomato-lip); }
.btn.primary:hover { filter: brightness(1.08); transform: scale(1.06) rotate(-2deg); }
.btn.dark { background: var(--ink); color: var(--cream); box-shadow: inset 0 -4px 0 #120A08; }
.btn.dark:hover { background: #3A241D; transform: scale(1.04); }
.btn.ghost { box-shadow: inset 0 0 0 2px var(--ink); padding-bottom: 0; }
.btn.ghost:hover { background: rgba(42, 25, 21, .08); transform: scale(1.04); }
.btn:active { transform: scale(.94) translateY(2px); }
.btn:disabled { opacity: .45; cursor: default; transform: none; filter: none; }
#go { animation: invite 1.4s ease-in-out infinite; }
@keyframes invite { 50% { scale: 1.07; } }

.round { width: 50px; height: 50px; padding-bottom: 4px; border-radius: 18px; background: var(--cream); display: grid; place-items: center; box-shadow: var(--label); rotate: 3deg; transition: transform .25s var(--spring); }
.round:hover { transform: scale(1.08) rotate(-6deg); }
.round svg { width: 24px; height: 24px; }
.round .cross, .round[aria-pressed="true"] .waves { display: none; }
.round[aria-pressed="true"] .cross { display: inline; }

#hint { position: absolute; left: 50%; bottom: 20px; translate: -50% 0; padding: 10px 20px 13px; background: var(--cream); border-radius: 18px; font-weight: 800; white-space: nowrap; box-shadow: var(--label); pointer-events: none; animation: bob 2s ease-in-out infinite; }
@keyframes bob { 50% { translate: -50% -6px; rotate: -1deg; } }

#help b { font: 400 24px/1 var(--display); }
#speed b { font: 400 19px/1 var(--display); }
#speed { rotate: 2deg; }
#speed[aria-pressed="true"] { background: var(--gold); box-shadow: inset 0 -4px 0 var(--gold-lip), 0 10px 20px rgba(42, 25, 21, .32); }
#help { rotate: -3deg; }
#go.early { animation: none; background: var(--ink); color: var(--gold); box-shadow: inset 0 -4px 0 #120A08; }
#forecast { position: absolute; top: 76px; right: 18px; max-width: min(360px, 80vw); padding: 8px 14px 11px; background: var(--cream); border-radius: 16px; box-shadow: var(--label); font-size: 13.500px; font-weight: 600; color: var(--ink-soft); rotate: -1deg; pointer-events: none; animation: rise .4s var(--spring); }
#forecast b { display: block; font: 400 17px/1.2 var(--display); color: var(--ink); }
#forecast[data-w="soleil"] b { color: #B36A00; } #forecast[data-w="pluie"] b { color: #1F47B8; } #forecast[data-w="brouillard"] b { color: #5A6470; }

#toasts { position: absolute; top: 78px; left: 50%; translate: -50% 0; display: grid; justify-items: center; gap: 8px; pointer-events: none; z-index: 3; }
.toast { display: flex; align-items: center; gap: 12px; max-width: min(460px, 88vw); padding: 9px 18px 12px 12px; background: var(--cream); border-radius: 18px; box-shadow: var(--label); animation: toast 5.600s var(--out) forwards; }
.toast:nth-child(odd) { rotate: -1.2deg; } .toast:nth-child(even) { rotate: 1deg; }
.toast canvas { flex: none; width: 44px; height: 44px; border-radius: 14px; background: var(--gold); }
.toast p { font-size: 13.500px; font-weight: 600; color: var(--ink-soft); padding-left: 6px; }
.toast canvas + p { padding-left: 0; }
.toast b { display: block; font: 400 18px/1.15 var(--display); color: var(--ink); }
@keyframes toast { 0% { opacity: 0; transform: translateY(-16px) scale(.9); } 6% { opacity: 1; transform: none; } 90% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-10px); } }

/* ---------- Choix du tracé ---------- */
#menu { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: flex-start; padding: clamp(18px, 3.5vh, 40px) clamp(18px, 4vw, 56px); pointer-events: none; }
#menu h1 {
  font: 400 clamp(52px, 9.5vw, 100px)/.9 var(--display); letter-spacing: 0; rotate: -2deg; transform-origin: left;
  -webkit-text-stroke: clamp(9px, 1.3vw, 16px) var(--cream); paint-order: stroke fill;
  filter: drop-shadow(0 8px 10px rgba(42, 25, 21, .35));
}
#menu .lede { margin: 14px 0 0 6px; padding: 8px 16px 11px; background: var(--cream); border-radius: 16px; box-shadow: var(--label); font-size: clamp(15px, 1.5vw, 19px); font-weight: 700; rotate: 1deg; }
#helpMenu { margin: 12px 0 0 6px; pointer-events: auto; padding: 8px 16px 12px; border-radius: 16px; font: 400 16px/1 var(--display); background: var(--ink); color: var(--gold); box-shadow: inset 0 -4px 0 #120A08, 0 10px 20px rgba(42, 25, 21, .32); rotate: 1.5deg; transition: transform .3s var(--spring); }
#helpMenu:hover { transform: translateY(-4px) scale(1.05); }
#routes { margin-top: auto; align-self: stretch; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px; pointer-events: auto; }
.route {
  display: grid; justify-items: center; gap: 6px; padding: 14px 8px 18px; text-align: center;
  background: var(--cream); border-radius: 22px; box-shadow: var(--label); transition: transform .35s var(--spring);
}
.route:nth-child(odd) { rotate: -1.5deg; } .route:nth-child(even) { rotate: 1deg; }
.route:hover, .route:focus-visible { transform: translateY(-10px) scale(1.05) rotate(1deg); }
.route:active { transform: translateY(-2px) scale(.98); }
.route .tarts { display: flex; justify-content: center; gap: 3px; height: 30px; }
.route .tarts svg { width: 30px; height: 30px; filter: drop-shadow(0 2px 2px rgba(42, 25, 21, .3)); }
.route strong { font: 400 clamp(16px, 1.500vw, 22px)/1.05 var(--display); white-space: nowrap; }
.route em { font-style: normal; font-weight: 800; font-size: 12.500px; padding: 3px 11px 5px; border-radius: 11px; background: var(--mint); color: #fff; }
.route.d-moyenne em { background: var(--gold); color: var(--ink); }
.route.d-difficile em { background: var(--tomato-hi); color: #fff; }
.route.d-hardcore { background: var(--ink); color: var(--cream); box-shadow: inset 0 -4px 0 #120A08, 0 10px 20px rgba(42, 25, 21, .4); }
.route.d-hardcore em { background: var(--cream); color: var(--ink); }
/* La Fourmilière de la mort : une étiquette couleur sang séché ; verrouillée, elle est éteinte. */
.route.d-mortel { background: #4A0F18; color: var(--cream); box-shadow: inset 0 -4px 0 #2A070C, 0 10px 20px rgba(42, 25, 21, .4); }
.route.d-mortel strong { white-space: normal; font-size: clamp(14px, 1.250vw, 18px); text-wrap: balance; }
.route.d-mortel em { background: var(--tomato-hi); color: #fff; }
.route.shut { background: #6B5A52; color: #E9DCCB; box-shadow: inset 0 -4px 0 #4A3C36, 0 8px 16px rgba(42, 25, 21, .3); }
.route.shut em { background: rgba(42, 25, 21, .45); color: #E9DCCB; white-space: nowrap; }
.route .tarts .lock, #sudden .lock { width: 26px; height: 26px; }
.menu-row { margin: 12px 0 0 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; pointer-events: auto; }
.menu-row #helpMenu { margin: 0; }
#sudden { display: inline-flex; align-items: center; gap: 8px; rotate: -1deg; }
#sudden .lock { width: 18px; height: 18px; }
#sudden b { font-weight: 400; }
#sudden i { font: 800 12.500px var(--ui); font-style: normal; padding: 2px 8px 4px; border-radius: 9px; background: rgba(255, 255, 255, .22); }
#sudden[aria-pressed="true"] { background: var(--tomato-hi); color: #fff; box-shadow: inset 0 -4px 0 var(--tomato-lip), 0 10px 20px rgba(42, 25, 21, .32); }
#sudden.shut { background: #6B5A52; color: #E9DCCB; box-shadow: inset 0 -4px 0 #4A3C36, 0 8px 16px rgba(42, 25, 21, .3); }
/* En mort subite, l'étiquette des parts est rouge : il n'y en a qu'une. */
#app[data-sudden] #lives { background: var(--tomato-hi); color: #fff; box-shadow: inset 0 -4px 0 var(--tomato-lip), 0 10px 20px rgba(42, 25, 21, .32); }

/* ---------- Compte et classement ---------- */
#account { position: absolute; top: clamp(18px, 3.500vh, 40px); right: clamp(18px, 4vw, 56px); display: flex; align-items: center; gap: 10px; pointer-events: auto; }
.map { padding: 8px 16px 12px; border-radius: 16px; background: var(--cream); color: var(--ink); box-shadow: var(--label); font: 400 17px/1 var(--display); text-decoration: none; transition: transform .3s var(--spring); }
.map:hover { transform: translateY(-4px) scale(1.05); }
.map.onche { background: var(--tomato-hi); color: #fff; box-shadow: inset 0 -4px 0 var(--tomato-lip), 0 10px 20px rgba(42, 25, 21, .32); }
.map[aria-pressed="true"] { background: var(--gold); box-shadow: inset 0 -4px 0 var(--gold-lip), 0 10px 20px rgba(42, 25, 21, .32); }
#account .who { display: flex; align-items: center; gap: 8px; padding: 5px 14px 8px 6px; border-radius: 16px; background: var(--cream); box-shadow: var(--label); font-weight: 800; }
#account .who img, .ranks img, .ranks .noav { width: 32px; height: 32px; border-radius: 10px; object-fit: cover; background: var(--cream-lip); flex: none; }
#mini { position: absolute; top: calc(clamp(18px, 3.500vh, 40px) + 58px); right: clamp(18px, 4vw, 56px); width: 250px; padding: 14px 16px 18px; background: var(--cream); border-radius: 20px; box-shadow: var(--label); rotate: 1.2deg; pointer-events: none; }
#mini h3 { font: 400 20px/1 var(--display); margin-bottom: 8px; }
#mini em { display: inline-block; margin: -2px 0 8px; padding: 1px 8px 3px; border-radius: 9px; background: var(--tomato-hi); color: #fff; font: 800 12px var(--ui); font-style: normal; }
#mini ol { list-style: none; padding: 0; display: grid; gap: 3px; }
#mini li { display: flex; align-items: baseline; gap: 8px; padding: 3px 8px 4px; border-radius: 9px; font-size: 14px; }
#mini li.me { background: var(--gold); }
#mini li span { width: 14px; font: 400 15px/1 var(--display); color: var(--tomato); }
#mini li b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
#mini li i { font-style: normal; font-weight: 800; font-size: 13px; white-space: nowrap; }
#mini p { font-size: 13.500px; font-weight: 600; color: var(--ink-soft); }
#mini ol + p { margin-top: 8px; }
@media (max-width: 900px) { #mini { display: none; } }
#invite { position: fixed; inset: 0; z-index: 25; display: grid; place-items: center; padding: 20px; background: rgba(42, 25, 21, .6); animation: fade .3s; }
#invite .sheet { max-width: 420px; }
#invite .btn { display: inline-grid; place-items: center; text-decoration: none; }
#inviteClose { position: absolute; top: -14px; right: -14px; width: 46px; height: 46px; rotate: 6deg; }
#board { position: fixed; inset: 0; z-index: 20; overflow-y: auto; padding: clamp(12px, 4vh, 40px) 16px; background: rgba(42, 25, 21, .72); animation: fade .3s; }
#board .book-inner { max-width: 640px; }
#board h2 { font: 400 clamp(32px, 5vw, 50px)/1 var(--display); }
#board .modes { margin-top: 16px; display: inline-flex; gap: 4px; padding: 4px; border-radius: 18px; background: var(--cream-lip); }
#board .modes .map { font-size: 15px; padding: 6px 14px 9px; border-radius: 14px; background: none; box-shadow: none; }
#board .modes .map[aria-pressed="true"] { background: var(--ink); color: var(--gold); }
#board .modes .map[data-m="1"][aria-pressed="true"] { background: var(--tomato-hi); color: #fff; }
#board .modes .map:hover { transform: none; }
#board .tabs { margin: 12px 0 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.ranks.mort .lv { display: none; }
#board .tabs .map { font-size: 15px; padding: 7px 12px 10px; box-shadow: inset 0 -3px 0 var(--cream-lip), 0 0 0 1.500px var(--cream-lip); }
#board .tabs .map[aria-pressed="true"] { box-shadow: inset 0 -3px 0 var(--gold-lip); }
.ranks { list-style: none; padding: 0; display: grid; gap: 6px; }
.ranks li { display: flex; align-items: center; gap: 12px; padding: 7px 14px 7px 8px; border-radius: 14px; background: #FFFBEF; box-shadow: inset 0 0 0 1.500px var(--cream-lip); }
.ranks li.me { background: var(--gold); box-shadow: inset 0 -3px 0 var(--gold-lip); }
.ranks .rk { width: 30px; text-align: center; font: 400 20px/1 var(--display); }
.ranks li:nth-child(1) .rk { color: var(--tomato); font-size: 26px; }
.ranks img, .ranks .noav { width: 36px; height: 36px; }
.ranks b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranks .wv { font: 400 18px/1 var(--display); white-space: nowrap; }
.ranks .lv { width: 68px; text-align: right; font-size: 13px; font-weight: 700; color: var(--ink-soft); white-space: nowrap; }
#board .wait, #board .mine { padding: 16px 4px; font-weight: 700; color: var(--ink-soft); }
#board .mine a { color: var(--tomato); }
#endRank { margin-top: 8px; font-size: 15px; font-weight: 800; color: var(--tomato); min-height: 1.300em; }
#endRank:empty { display: none; }

/* ---------- Boutique : une étagère, des cartes posées dessus ---------- */
#shop {
  display: flex; justify-content: center; gap: 2px; padding: 16px 12px 12px; overflow-x: auto;
  background: linear-gradient(#55331F, #3A2218 70%); border-top: 4px solid #7A4C2E; box-shadow: inset 0 10px 14px rgba(0, 0, 0, .28);
  scrollbar-width: thin; scrollbar-color: #7A4C2E #3A2218;
}
.tile { position: relative; flex: none; width: 86px; display: grid; justify-items: center; color: var(--cream); }
.tile .ico {
  position: relative; width: 70px; height: 70px; border-radius: 20px; background: var(--cream); display: grid; place-items: center;
  box-shadow: inset 0 -5px 0 var(--cream-lip), 0 8px 12px rgba(0, 0, 0, .4);
  transition: transform .35s var(--spring), background-color .15s, box-shadow .15s;
}
.tile:nth-child(odd) .ico { rotate: -2.5deg; } .tile:nth-child(even) .ico { rotate: 2deg; } .tile:nth-child(3n) .ico { rotate: -1deg; }
.tile canvas { width: 60px; height: 60px; margin-top: -4px; }
.tile kbd { position: absolute; top: -5px; left: -5px; z-index: 1; width: 19px; height: 19px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--cream); font: 800 10px var(--ui); }
.tile kbd:empty { display: none; }
.tile .price { order: 2; position: relative; margin-top: -11px; padding: 1px 10px 3px; border-radius: 10px; background: var(--gold); color: var(--ink); font-weight: 800; font-size: 14px; rotate: -3deg; box-shadow: inset 0 -2px 0 var(--gold-lip), 0 3px 5px rgba(0, 0, 0, .3); transition: transform .35s var(--spring); }
.tile .name { order: 3; margin-top: 5px; font-weight: 700; font-size: 12px; white-space: nowrap; }
.tile .lock { display: none; position: absolute; inset: 0; margin: auto; width: 26px; height: 26px; color: var(--cream-dim); }
.tile:hover .ico { transform: translateY(-7px) rotate(3deg) scale(1.06); }
.tile:hover .price { transform: translateY(-5px) rotate(5deg); }
.tile[aria-pressed="true"] .ico { transform: translateY(-14px) rotate(-5deg) scale(1.08); background: var(--gold); box-shadow: inset 0 -5px 0 var(--gold-lip), 0 16px 16px rgba(0, 0, 0, .4); }
.tile[aria-pressed="true"] .price { transform: translateY(-12px); background: var(--ink); color: var(--gold); box-shadow: none; }
.tile.poor .ico { background: #B79C86; box-shadow: inset 0 -5px 0 #99806C, 0 8px 12px rgba(0, 0, 0, .4); }
.tile.poor .ico canvas { opacity: .6; }
.tile .price.up { background: #FFB02E; }
.tile.poor .price { background: #8F7568; color: var(--cream); box-shadow: none; }
.tile.locked .ico { background: #5E4238; box-shadow: inset 0 -5px 0 #4A3229, 0 6px 10px rgba(0, 0, 0, .3); }
.tile.locked .ico canvas { filter: brightness(0) invert(.75); opacity: .16; }
.tile.locked .lock { display: block; }
.tile.locked .name { opacity: .55; }
.tile.locked .price { background: none; box-shadow: none; color: var(--cream-dim); font-size: 12px; font-weight: 700; rotate: 0deg; margin-top: 4px; order: 4; }
.tile.locked kbd { display: none; }
.tile.no .ico { animation: no .3s; }
@keyframes no { 25% { translate: -6px 0; } 75% { translate: 6px 0; } }
.tile.new .ico { animation: fresh 1s var(--spring); }
@keyframes fresh { 0% { translate: 0 -26px; scale: 1.3; background: var(--gold); } 100% { translate: 0 0; scale: 1; } }

/* ---------- Fiches : un bristol tenu par un bout de ruban ---------- */
.panel { position: fixed; z-index: 5; width: 268px; padding: 20px 18px 20px; background: var(--cream); border-radius: 20px; rotate: -1.2deg; box-shadow: inset 0 -5px 0 var(--cream-lip), 0 16px 34px rgba(42, 25, 21, .38), 0 2px 6px rgba(42, 25, 21, .2); animation: rise .35s var(--spring); }
.panel::before, .sheet::before { content: ''; position: absolute; top: -11px; left: 50%; width: 82px; height: 24px; translate: -50% 0; rotate: -3deg; border-radius: 3px; background: repeating-linear-gradient(135deg, #EE6A53 0 7px, #F6A193 7px 14px); opacity: .92; box-shadow: 0 2px 3px rgba(42, 25, 21, .2); }
#pop { rotate: 1deg; }
#info { pointer-events: none; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.9); } }
.panel h3 { font: 400 25px/1 var(--display); display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.panel h3 small { font: 800 12px var(--ui); padding: 3px 9px 4px; border-radius: 10px; background: var(--ink); color: var(--gold); translate: 0 -4px; rotate: 3deg; }
.panel p { margin-top: 6px; font-size: 14px; color: var(--ink-soft); }
.panel dl { margin-top: 12px; display: grid; grid-template-columns: auto 1fr; gap: 7px 12px; align-items: center; font-size: 13px; font-weight: 700; }
.pips { display: flex; gap: 4px; }
.pips i { flex: 1; height: 10px; border-radius: 5px; background: rgba(42, 25, 21, .13); }
.pips i.on { background: var(--ink); }
.pips i.plus { background: var(--mint); }
.chips { margin-top: 12px; display: flex; gap: 6px; }
.chip { padding: 3px 11px 4px; border-radius: 10px; font-weight: 800; font-size: 12px; background: var(--ink); color: var(--cream); }
.chip.off { background: none; box-shadow: inset 0 0 0 1.500px rgba(42, 25, 21, .35); color: rgba(42, 25, 21, .6); text-decoration: line-through; }
.panel .next { margin-top: 10px; font-size: 13px; font-weight: 700; color: #12784F; }
.panel .next.lock { color: var(--tomato); }
.panel .next.wait { color: var(--ink-soft); font-weight: 600; }
.panel .row { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.panel .row .btn { padding: 0 8px 3px; height: 40px; font-size: 14px; }
.panel .row .btn.ghost { padding-bottom: 0; }

.panel h3 small.bad { background: var(--tomato); color: #fff; }
#shop.closed .tile { opacity: .4; }

/* ---------- Règles et bestiaire ---------- */
#book { position: fixed; inset: 0; z-index: 20; overflow-y: auto; padding: clamp(12px, 4vh, 40px) 16px; background: rgba(42, 25, 21, .72); animation: fade .3s; user-select: text; -webkit-user-select: text; scrollbar-color: var(--cream-lip) transparent; }
.book-inner { position: relative; max-width: 1000px; margin: 0 auto; padding: clamp(22px, 4vw, 40px); background: var(--cream); border-radius: 30px; box-shadow: inset 0 -6px 0 var(--cream-lip), 0 30px 60px rgba(0, 0, 0, .4); animation: rise .5s var(--spring); }
#bookClose { position: sticky; top: 0; float: right; z-index: 1; }
#book h2 { font: 400 clamp(32px, 5vw, 50px)/1 var(--display); }
#book h3 { margin: 30px 0 12px; font: 400 26px/1 var(--display); }
.rules { padding-left: 20px; max-width: 72ch; display: grid; gap: 7px; font-size: 15.500px; }
.rules li::marker { color: var(--tomato); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.card { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: start; padding: 12px; border-radius: 18px; background: #FFFBEF; box-shadow: inset 0 0 0 1.500px var(--cream-lip); }
.card canvas { width: 64px; height: 64px; border-radius: 18px; background: var(--gold); }
.card h4 { font: 400 19px/1.1 var(--display); }
.card p { margin-top: 3px; font-size: 13.500px; line-height: 1.35; color: var(--ink-soft); }
.card .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.card .tags span { padding: 1px 8px 2px; border-radius: 8px; background: var(--ink); color: var(--cream); font-size: 11.500px; font-weight: 700; }
.card.unknown canvas { background: var(--cream-lip); }
.card.unknown h4 { color: var(--ink-soft); }

/* ---------- Fin ---------- */
#end { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(42, 25, 21, .6); padding: 20px; animation: fade .4s; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: relative; max-width: 520px; padding: 40px 36px 34px; background: var(--cream); border-radius: 30px; text-align: center; rotate: -1.5deg; box-shadow: inset 0 -6px 0 var(--cream-lip), 0 30px 60px rgba(0, 0, 0, .4); animation: rise .6s var(--spring); }
.sheet::before { width: 120px; height: 30px; top: -14px; }
.sheet h2 { font: 400 clamp(34px, 5vw, 54px)/.95 var(--display); text-wrap: balance; }
.sheet p { margin-top: 12px; font-size: 17px; font-weight: 600; color: var(--ink-soft); }
.sheet .row { margin-top: 24px; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.sheet .btn { height: 46px; padding: 0 22px 4px; border-radius: 16px; font-size: 16px; }
.sheet .btn.ghost { padding-bottom: 0; }

/* Écrans étroits : les treize cartes de la boutique doivent tenir sans défiler, et les messages ne passent pas sous l'annonce météo. */
@media (max-width: 1180px) {
  #routes { gap: 8px; }
  .route .tarts svg { width: 22px; height: 22px; } .route .tarts { height: 22px; }
  .tile { width: 72px; }
  .tile .ico { width: 60px; height: 60px; border-radius: 17px; }
  .tile canvas { width: 52px; height: 52px; }
  .tile .name { font-size: 11px; }
  .tile .price { font-size: 12.500px; padding: 1px 7px 3px; }
  #toasts { top: 176px; }
}
/* ---------- Téléphone, tenu en hauteur ----------
   La carte est pivotée (entrées en haut). Étiquettes sur deux lignes, boutique sur deux rangées : les 13 armes tiennent sans défiler. */
@media (max-width: 760px) {
  #hud { inset: max(8px, env(safe-area-inset-top)) 8px auto; flex-wrap: wrap; gap: 6px; }
  .pill { height: 40px; padding: 0 12px 3px 8px; border-radius: 14px; rotate: 0deg; gap: 5px; }
  #money { rotate: 0deg; }
  .pill b { font-size: 20px; }
  .pill svg { width: 22px; height: 22px; }
  #streak { font-size: 11px; padding: 2px 6px; rotate: 0deg; }
  .round { width: 40px; height: 40px; padding-bottom: 3px; border-radius: 14px; rotate: 0deg; }
  .round svg { width: 20px; height: 20px; }
  #speed { margin-left: auto; rotate: 0deg; } #help { rotate: 0deg; }
  #speed b { font-size: 16px; } #help b { font-size: 20px; }
  .wave { order: 5; flex: 1 0 100%; margin-left: 0; height: 44px; padding: 0 5px 3px 12px; border-radius: 14px; rotate: 0deg; gap: 8px; }
  #waveLabel { font-size: 16px; }
  .wave { min-width: 0; } #waveBar { flex: 1; width: auto; min-width: 16px; } #go { flex-shrink: 0; }
  #preview { flex: 1; min-width: 0; overflow: hidden; gap: 6px; }
  #preview canvas { width: 22px; height: 22px; }
  #preview span { font-size: 12px; }
  #go { margin-left: auto; }
  #forecast { top: 112px; left: 8px; right: 8px; max-width: none; padding: 6px 12px 9px; font-size: 12.500px; rotate: 0deg; }
  #forecast b { font-size: 15px; }
  #toasts { top: 112px; left: 8px; right: 8px; translate: none; }
  #forecast:not([hidden]) ~ #toasts { top: 176px; }
  .toast { max-width: 100%; padding: 7px 12px 10px 8px; rotate: 0deg !important; }
  .toast b { font-size: 15px; } .toast p { font-size: 12.500px; }
  /* L'aide tient sur une ligne, à cheval sur le bord de la boutique : elle ne recouvre ni la tarte ni l'arrivée des fourmis. */
  #hint { bottom: -13px; left: 8px; right: 8px; z-index: 6; translate: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; padding: 4px 12px 6px; font-size: 12px; border-radius: 12px; animation: none; }

  #shop { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px 0; justify-items: center; padding: 12px 4px max(8px, env(safe-area-inset-bottom)); overflow: visible; }
  .tile { width: 100%; min-width: 0; touch-action: none; }
  .tile .ico { width: 46px; height: 46px; border-radius: 14px; box-shadow: inset 0 -4px 0 var(--cream-lip), 0 5px 8px rgba(0, 0, 0, .4); }
  .tile canvas { width: 40px; height: 40px; margin-top: -3px; }
  .tile kbd, .tile .name { display: none; }
  .tile .price { margin-top: -8px; padding: 0 5px 2px; font-size: 11px; border-radius: 8px; }
  .tile.locked .price { margin-top: 2px; font-size: 9.500px; white-space: nowrap; padding: 0; }
  .tile .lock { width: 20px; height: 20px; }
  .tile:hover .ico, .tile:hover .price { transform: none; }
  .tile[aria-pressed="true"] .ico { transform: translateY(-6px) scale(1.08); }

  /* Fiche d'une arme posée : elle recouvre la boutique, pas la carte. */
  .panel { left: 8px !important; right: 8px; width: auto; top: auto !important; bottom: max(8px, env(safe-area-inset-bottom)); z-index: 30; padding: 14px 14px 14px; rotate: 0deg !important; }
  .panel h3 { font-size: 22px; } .panel dl { margin-top: 6px; gap: 4px 10px; } .panel .tags { margin-top: 6px; } .panel .next { margin-top: 6px; } .panel .row { margin-top: 8px; }

  #menu { padding: max(12px, env(safe-area-inset-top)) 10px 10px; }
  #menu h1 { font-size: clamp(38px, 13vw, 58px); -webkit-text-stroke-width: 8px; }
  #menu .lede { margin: 8px 0 0 2px; padding: 6px 12px 9px; font-size: 13.500px; }
  .menu-row { margin: 8px 0 0 2px; gap: 6px; } #helpMenu { padding: 6px 12px 9px; font-size: 14px; }
  #sudden i { display: none; } #sudden .lock { width: 15px; height: 15px; }
  .route.d-mortel strong { font-size: 11px; } .route.shut em { font-size: 8.500px; padding: 1px 4px 2px; } .route .tarts .lock { width: 15px; height: 15px; }
  /* Téléphone : le classement tient sur une ligne d'onglets qui défile, sans mur de boutons. */
  #board .tabs { flex-wrap: nowrap; overflow-x: auto; margin-inline: -14px; padding: 4px 14px 8px; scrollbar-width: none; } #board .tabs .map { flex: none; font-size: 13.500px; }
  #board .modes { display: flex; } #board .modes .map { flex: 1; }
  #menu .lede { display: none; }
  #account { position: static; order: 1; margin: 8px 0 0 2px; flex-wrap: wrap; gap: 6px; }
  .map { padding: 6px 12px 9px; font-size: 14px; border-radius: 13px; }
  #account .who { padding: 3px 10px 6px 4px; border-radius: 13px; font-size: 13px; }
  #account .who img { width: 26px; height: 26px; }
  #routes { order: 2; grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .route { padding: 8px 2px 10px; border-radius: 14px; gap: 3px; rotate: 0deg !important; }
  .route .tarts { height: 15px; gap: 1px; } .route .tarts svg { width: 15px; height: 15px; }
  .route strong { font-size: 12px; white-space: normal; line-height: 1.05; }
  .route em { font-size: 10px; padding: 1px 6px 3px; border-radius: 8px; }
  .sheet { padding: 30px 18px 24px; border-radius: 24px; }
  .sheet .btn { height: 42px; padding: 0 16px 4px; font-size: 15px; }
  #inviteClose { top: -12px; right: -6px; }
  .book-inner { padding: 18px 14px 22px; border-radius: 22px; }
  .grid { grid-template-columns: 1fr; }
  .ranks .lv { display: none; }
}

/* ---------- Téléphone, tenu en largeur : la carte reste couchée, la boutique tient sur une rangée ---------- */
@media (max-height: 520px) and (min-width: 761px) {
  #hud { inset: 8px 10px auto; gap: 6px; }
  .pill, .wave { height: 40px; border-radius: 14px; rotate: 0deg; } #money { rotate: 0deg; }
  .pill b { font-size: 20px; } .pill svg { width: 22px; height: 22px; }
  .round { width: 40px; height: 40px; border-radius: 14px; rotate: 0deg; } #speed, #help { rotate: 0deg; }
  #waveLabel { font-size: 16px; }
  #shop { gap: 0; padding: 10px 6px max(6px, env(safe-area-inset-bottom)); justify-content: space-evenly; overflow: visible; }
  .tile { width: 54px; touch-action: none; }
  .tile .ico { width: 44px; height: 44px; border-radius: 13px; }
  .tile canvas { width: 38px; height: 38px; margin-top: -3px; }
  .tile kbd, .tile .name { display: none; }
  .tile .price { margin-top: -8px; padding: 0 5px 2px; font-size: 11px; }
  .tile.locked .price { margin-top: 2px; font-size: 10px; }
  #forecast { top: 56px; right: 10px; } #toasts { top: 56px; }
  #hint { bottom: 6px; padding: 6px 12px 9px; font-size: 13px; animation: none; }
  .panel { padding: 14px 14px 14px; } .panel dl { margin-top: 8px; gap: 4px 10px; }
  #menu { padding: 10px 14px; } #menu h1 { font-size: 44px; }
  #menu .lede { display: none; }
  .route { padding: 8px 4px 10px; gap: 3px; }
  .route .tarts { height: 18px; } .route .tarts svg { width: 18px; height: 18px; }
  .route strong { font-size: 14px; }
}
/* Au toucher, pas de survol : la fiche d'une arme resterait affichée par-dessus la carte et empêcherait de viser. */
@media (hover: none) { #info { display: none !important; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
/* Au toucher, la description de l'arme en main s'efface d'elle-même : elle ne doit pas masquer le bas de la carte. */
@keyframes hintout { to { opacity: 0; visibility: hidden; } }
@media (hover: none) { #hint { animation: hintout .4s 3s forwards; } #hint.arme { animation: hintout .4s 2.4s forwards; } }
