/* Mnémosyne — un jeu Ludolympe. Le temple des Muses au bord du Léthé, de nuit : violet de la série, or, brume
   bleu-vert du fleuve. Police Lilita One, panneaux cerclés de noir, ombres pleines. */
@font-face { font-family: 'Lilita One'; src: url(fonts/lilita-one.woff2) format('woff2'); font-display: swap; }
:root {
  --bg: #16122e; --bg2: #0e0b1f; --panel: #2c2652; --edge: #0b0818; --ink: #f6f0e4; --ink2: #b9b2dc;
  --gold: #ffc93c; --red: #ff4458; --green: #3ddc97; --orange: #ff8a3d; --mist: #7fd6c8;
  --game: 'Lilita One', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}
/* pas de zoom au double toucher : touch-action ne s'hérite pas, on le pose partout */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; color: var(--ink); font: 15px/1.4 var(--body); overflow: hidden; user-select: none; -webkit-user-select: none;
  background: radial-gradient(110% 60% at 50% 0%, #3b2f6e 0%, #241c48 40%, var(--bg) 75%), var(--bg2); }
#app { position: relative; height: 100%; max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) max(12px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 10px) max(12px, env(safe-area-inset-left, 0px)); }

/* ---------- Bandeau du haut : jauges lisibles d'un coup d'œil ---------- */
.top { display: flex; align-items: center; gap: 8px; }
.top h1 { flex: 1; min-width: 0; margin: 0; font: 400 18px var(--game); color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.help { flex: none; width: 34px; height: 34px; border-radius: 50%; font: 400 18px var(--game); color: var(--edge); background: var(--gold);
  border: 3px solid var(--edge); box-shadow: 0 2px 0 var(--edge); cursor: pointer; }
.hud { display: flex; gap: 8px; }
.goal { position: relative; flex: 1; min-width: 0; height: 48px; border-radius: 16px; overflow: hidden; background: var(--panel); border: 3px solid var(--edge); box-shadow: 0 3px 0 var(--edge); }
.gfill { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #5a3c9c, #8b6bff); transition: width .5s cubic-bezier(.2, .8, .3, 1); }
.goal.done .gfill { background: linear-gradient(90deg, #1c8f5e, #3ddc97); box-shadow: 0 0 18px rgba(61, 220, 151, .6); }
.goal.done .gtext::after { content: '✓'; color: var(--green); }
.gtext { position: relative; height: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  font: 400 22px var(--game); color: #fff; -webkit-text-stroke: 4px var(--edge); paint-order: stroke fill; font-variant-numeric: tabular-nums; }
.gtext .gico { font-size: 20px; -webkit-text-stroke: 0; }
.medal { flex: none; width: 80px; height: 48px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 35% 30%, #fff1a8, #ffc93c 55%, #d18d0c); border: 3px solid var(--edge); box-shadow: 0 3px 0 var(--edge); transition: background .3s; }
.medal small { font: 700 9.5px var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--edge); opacity: .75; margin-bottom: -2px; }
.medal b { font: 400 24px/1 var(--game); color: var(--edge); }
.medal[data-level="warm"] { background: radial-gradient(circle at 35% 30%, #ffd0a8, var(--orange) 55%, #c9541a); }
.medal[data-level="hot"] { background: radial-gradient(circle at 35% 30%, #ffb0c0, var(--red) 55%, #a31a35); animation: hot 1s infinite; }
@keyframes hot { 50% { box-shadow: 0 3px 0 var(--edge), 0 0 16px rgba(255, 68, 88, .7); } }
.pop { animation: pop .3s; } @keyframes pop { 50% { transform: scale(1.12); } }
.gauges { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; }
.gauge { display: grid; grid-template-columns: auto 1fr; column-gap: 6px; align-items: center; padding: 5px 9px 6px; border-radius: 14px;
  background: var(--panel); border: 3px solid var(--edge); box-shadow: 0 3px 0 var(--edge); min-width: 0; overflow: hidden; }
.gauge .gico { grid-row: 1 / 3; font-size: 22px; line-height: 1; }
.gauge b { font: 400 22px/1 var(--game); color: #fff; font-variant-numeric: tabular-nums; }
.gauge small { font: 600 12px var(--body); color: var(--ink2); white-space: nowrap; }
.gauge .slots { grid-column: 1 / 3; display: flex; gap: 3px; height: 7px; margin-top: 4px; }
.gauge .slots i { flex: 1; border-radius: 3px; background: rgba(255, 255, 255, .1); }
.gauge .slots i.on { background: var(--green); }
.gauge[data-level="mid"] .slots i.on { background: var(--orange); }
.gauge[data-level="low"] { border-color: var(--red); animation: alarm 1s infinite; }
.gauge[data-level="low"] .slots i.on { background: var(--red); } .gauge[data-level="low"] b { color: var(--red); }
@keyframes alarm { 50% { box-shadow: 0 3px 0 var(--edge), 0 0 14px rgba(255, 68, 88, .6); } }
.relics { display: flex; gap: 6px; flex-wrap: wrap; }
.relics:empty { display: none; }
.relic { width: 34px; height: 34px; border-radius: 10px; font-size: 18px; line-height: 1; background: var(--panel); border: 2px solid var(--edge); box-shadow: 0 2px 0 var(--edge); cursor: pointer; padding: 0; }
.boss { padding: 6px 10px; border-radius: 12px; background: #1c4a52; border: 2px solid var(--edge); font: 400 14px/1.2 var(--game); color: #d6fff6; text-align: center; }
.boss b { color: #fff; }
.muses { display: none; }

/* ---------- Le plateau : la plus grande tuile carrée qui tient en largeur ET en hauteur ---------- */
.board { --cols: 4; --rows: 4; --gap: 8px; flex: 1; min-height: 0; container-type: size; position: relative; display: grid; place-content: center;
  grid-template-columns: repeat(var(--cols), var(--t)); gap: var(--gap); padding: 10px; border-radius: 20px; border: 3px solid var(--edge);
  background: radial-gradient(120% 80% at 50% 100%, rgba(127, 214, 200, .16), transparent 60%), linear-gradient(#2a2350, #1b1638);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, .45), 0 3px 0 var(--edge);
  --t: min(calc((100cqw - 20px - (var(--cols) - 1) * var(--gap)) / var(--cols)), calc((100cqh - 20px - (var(--rows) - 1) * var(--gap)) / var(--rows)), 120px); }
.board.misting { box-shadow: inset 0 0 60px rgba(127, 214, 200, .45), 0 3px 0 var(--edge); }
.tile { position: relative; width: var(--t); height: var(--t); padding: 0; border: 0; background: none; cursor: pointer; perspective: 600px; outline: none; }
.tile .face { position: absolute; inset: 0; border-radius: calc(var(--t) * .2); border: 3px solid var(--edge); box-shadow: 0 3px 0 var(--edge);
  display: grid; place-items: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform .32s cubic-bezier(.3, .7, .4, 1.2); }
/* dos : une petite colonne grecque sur fond violet, liseré d'or */
.tile .back { background: radial-gradient(circle at 50% 38%, #6b58c4, #3d2f86 70%); }
.tile .back::before { content: '🏛️'; font-size: calc(var(--t) * .34); opacity: .55; filter: grayscale(.4); }
.tile .back::after { content: ''; position: absolute; inset: 4px; border-radius: inherit; border: 2px solid rgba(255, 201, 60, .4); }
.tile .front { transform: rotateY(180deg); font-size: calc(var(--t) * .5); line-height: 1;
  background: radial-gradient(circle at 50% 40%, #fffaf0 0, #fbf5e6 55%, color-mix(in srgb, var(--h) 45%, #fbf5e6)); }
.tile .front::after { content: ''; position: absolute; inset: auto 10% 8% 10%; height: 12%; border-radius: 999px; background: var(--h); opacity: .85; border: 2px solid var(--edge); }
.tile.up .back { transform: rotateY(-180deg); }
.tile.up .front { transform: none; }
.tile.done .front { box-shadow: 0 3px 0 var(--edge), 0 0 0 3px var(--h); filter: saturate(.9); }
.tile.done { cursor: default; animation: none; }
.tile.done .front { opacity: .78; }
/* un regard (Œil, Eunoé, Lyre) : la tuile se montre à demi, dans un halo de brume */
.tile.peek .back { transform: rotateY(-180deg); }
.tile.peek .front { transform: none; box-shadow: 0 3px 0 var(--edge), 0 0 0 3px var(--mist), 0 0 18px rgba(127, 214, 200, .7); }
.tile.glow .front { animation: glow .7s; } @keyframes glow { 40% { transform: scale(1.12); box-shadow: 0 3px 0 var(--edge), 0 0 0 4px var(--gold), 0 0 26px rgba(255, 201, 60, .9); } }
.tile.lit .back { box-shadow: 0 3px 0 var(--edge), 0 0 0 3px var(--orange), 0 0 20px rgba(255, 138, 61, .8); }
.tile:focus-visible .face { outline: 3px solid #fff; outline-offset: 2px; }
.board.aim .tile:not(.up) .back { box-shadow: 0 3px 0 var(--edge), 0 0 0 3px var(--mist); }
@media (hover: hover) { .tile:not(.up):hover .back { transform: translateY(-3px); filter: brightness(1.12); } }

/* ---------- En bas : la brume qui approche, le conseil, les offrandes ---------- */
.bench { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; min-height: 52px; }
.mist { justify-self: start; display: flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: 14px; background: rgba(127, 214, 200, .1); border: 2px solid rgba(127, 214, 200, .3); }
.mist .mico { font-size: 20px; margin-right: 2px; }
.mist i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--mist); }
.mist i.on { background: var(--mist); box-shadow: 0 0 8px var(--mist); }
.hint { text-align: center; text-wrap: balance; font: 400 15px/1.15 var(--game); color: var(--gold); max-width: 200px; }
.hint b { color: #fff; font-weight: 400; }
.tools { justify-self: end; display: flex; gap: 8px; }
.tool { min-width: 58px; display: flex; align-items: center; justify-content: center; gap: 4px; font: 400 20px var(--game); color: #fff; border: 3px solid var(--edge); box-shadow: 0 3px 0 var(--edge);
  border-radius: 12px; padding: 5px 8px 6px; background: linear-gradient(#3a8f86, #1f5c56); cursor: pointer; }
.tool small { font: 400 13px var(--game); }
.tool:disabled { opacity: .4; cursor: default; } .tool.on { outline: 3px solid var(--gold); background: linear-gradient(#5ec9bd, #3a8f86); }
#toast { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); z-index: 4; font: 400 28px/1.1 var(--game); color: #fff; text-align: center;
  -webkit-text-stroke: 6px var(--edge); paint-order: stroke fill; pointer-events: none; opacity: 0; transition: opacity .2s; width: 92%; }
#toast.on { opacity: 1; animation: pop .35s; } #toast em { font-style: normal; color: var(--gold); }
#toast small { display: block; margin-top: 6px; font: 600 15px/1.3 var(--body); -webkit-text-stroke: 0; text-shadow: 0 2px 0 var(--edge), 0 0 6px var(--edge); }
.float { position: fixed; z-index: 7; translate: -50% -50%; font: 400 28px var(--game); -webkit-text-stroke: 5px var(--edge); paint-order: stroke fill; pointer-events: none;
  animation: floatup 1.1s ease-out forwards; white-space: nowrap; }
@keyframes floatup { 0% { transform: translateY(0) scale(.6); opacity: 0; } 15% { transform: translateY(-6px) scale(1.15); opacity: 1; } 100% { transform: translateY(-46px); opacity: 0; } }

/* ---------- Fiches ---------- */
#sheet { position: fixed; inset: 0; z-index: 8; background: rgba(8, 6, 20, .8); display: grid; place-items: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.sheet { width: 100%; max-width: 440px; max-height: 100%; overflow: auto; touch-action: pan-y; background: var(--panel); border: 3px solid var(--edge);
  box-shadow: 0 6px 0 var(--edge); border-radius: 20px; padding: 18px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.sheet h2 { margin: 0; font: 400 26px/1.1 var(--game); color: var(--gold); text-wrap: balance; }
.sheet p { margin: 0; } .muted { color: var(--ink2); font-size: 14px; } .muted b { color: var(--ink); }
.label { margin: 2px 0 -4px !important; font: 600 12px var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--ink2); text-align: left; }
.btn { font: 400 18px var(--game); color: #fff; border: 3px solid var(--edge); box-shadow: 0 4px 0 var(--edge); border-radius: 14px;
  padding: 10px 14px 12px; cursor: pointer; background: linear-gradient(#6b58c4, #45378f); }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--edge); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.gold { background: linear-gradient(#ffe07a, var(--gold) 50%, #d18d0c); color: var(--edge); }
.btn.red { background: linear-gradient(#ff6b6b, #e8364f); }
.btn.ghost { background: var(--bg); }
.btn small { display: block; font: 600 12px var(--body); opacity: .85; }
a.btn { text-decoration: none; text-align: center; }
.row { display: flex; gap: 12px; } .row .btn { flex: 1; }
.recap { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; text-align: left; }
.recap b { font: 400 18px var(--game); text-align: right; }
.board-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; font-variant-numeric: tabular-nums; }
.board-list li { display: grid; grid-template-columns: 30px 1fr auto; gap: 8px; padding: 8px 12px; background: var(--bg); border-radius: 10px; text-align: left; }
.board-list li.me { outline: 2px solid var(--gold); } .board-list b { font: 400 16px var(--game); color: var(--gold); }
.pseudo { display: flex; gap: 12px; }
.pseudo input { flex: 1; min-width: 0; min-height: 48px; font: 600 16px var(--body); color: var(--ink); background: var(--bg); border: 2px solid var(--edge); border-radius: 12px; padding: 8px 10px; touch-action: auto; }
.pseudo .btn { width: auto; }

/* ---------- Tutoriel en diapositives ---------- */
.slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin: 0 -18px; touch-action: pan-x; }
.slides::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: center; padding: 0 18px; display: flex; flex-direction: column; gap: 10px; }
.slide .demo { --t: 58px; display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px; min-height: 120px;
  background: linear-gradient(#2a2350, #1b1638); border: 2px solid var(--edge); border-radius: 14px; padding: 10px; }
.demo-tile { display: inline-block; cursor: default; }
.slide .arrow { font: 400 24px var(--game); color: var(--gold); }
.demo-sum { width: 100%; font: 400 20px var(--game); color: var(--gold); -webkit-text-stroke: 3px var(--edge); paint-order: stroke fill; }
.slide .sp b { color: var(--gold); }
.dots { display: flex; justify-content: center; gap: 8px; } .dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--ink2); opacity: .35; cursor: pointer; }
.dots i.on { opacity: 1; background: var(--gold); width: 22px; border-radius: 6px; }
.slide.on .fly { animation: flyin 2.4s infinite; } @keyframes flyin { 0% { transform: translateY(30px) scale(.6); opacity: 0; } 25%, 85% { transform: none; opacity: 1; } 100% { opacity: 0; } }
.slide.on .fly2 { animation: swap 2.4s infinite; } @keyframes swap { 30% { transform: none; } 60%, 100% { transform: translateX(-66px); } }
.slide.on .fly:not(.up) { animation: swap2 2.4s infinite; } @keyframes swap2 { 30% { transform: none; } 60%, 100% { transform: translateX(66px); } }

/* ---------- L'autel des Muses : jetons sur étagères ---------- */
.purse { display: flex; justify-content: space-between; align-items: center; font: 400 18px var(--game);
  position: sticky; top: -18px; z-index: 3; margin: -18px -18px 0; padding: 12px 18px; background: var(--panel); border-bottom: 3px solid var(--edge); box-shadow: 0 4px 10px rgba(8, 5, 18, .5); }
.purse b { color: var(--gold); font-size: 24px; }
.camp-sub { font: 400 18px var(--game); color: var(--gold); } .camp-sub span { display: block; font: 13px var(--body); color: var(--ink2); margin-top: 2px; }
.keeper { display: flex; align-items: center; gap: 10px; justify-content: center; }
.keeper-face { font-size: 34px; }
.keeper-say { position: relative; background: #f6f0e4; color: var(--edge); font: 400 15px var(--game); padding: 7px 12px 8px; border-radius: 14px; border: 3px solid var(--edge); box-shadow: 0 3px 0 var(--edge); }
.rack { position: relative; padding-bottom: 16px; text-align: left; }
.rack::after { content: ''; position: absolute; left: -4px; right: -4px; bottom: 0; height: 12px; border-radius: 6px; z-index: 0;
  background: linear-gradient(#d8d0c0, #a39a88); border: 3px solid var(--edge); box-shadow: 0 3px 0 var(--edge); }
.rack-label { font: 400 14px var(--game); letter-spacing: .08em; text-transform: uppercase; color: var(--ink2); margin-bottom: 8px; }
.rack-label small { font: 12px var(--body); text-transform: none; letter-spacing: 0; color: var(--ink); margin-left: 6px; }
/* tous les jetons d'un rayon ont la même taille */
.wares { position: relative; z-index: 1; display: flex; gap: 10px; justify-content: center; align-items: stretch; padding-bottom: 18px; }
.ware { position: relative; flex: 1 1 0; max-width: 128px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; margin-top: 8px;
  padding: 10px 6px 20px; border-radius: 18px; border: 3px solid var(--edge); box-shadow: 0 5px 0 var(--edge); cursor: pointer; color: var(--ink);
  font: inherit; transition: transform .12s; background: linear-gradient(#6b58c4, #45378f); }
.ware:nth-child(odd) { transform: rotate(-2deg); } .ware:nth-child(even) { transform: rotate(2deg); }
.ware.k-use { background: linear-gradient(#3a8f86, #1f5c56); } .ware.k-live { background: linear-gradient(#6b58c4, #45378f); } .ware.k-score { background: linear-gradient(#b8860b, #7a5506); }
.ware.sel { transform: translateY(-8px) scale(1.06) rotate(0); outline: 3px solid var(--gold); box-shadow: 0 10px 0 var(--edge), 0 0 24px rgba(255, 201, 60, .55); }
.ware.poor { filter: saturate(.45) brightness(.8); }
.ware-ico { font-size: 32px; line-height: 1; width: 50px; height: 50px; display: grid; place-items: center; border-radius: 50%; background: rgba(14, 9, 32, .35); border: 2px solid rgba(255, 255, 255, .18); }
.ware-name { font: 400 14px/1.05 var(--game); text-align: center; text-wrap: balance; min-height: 2.1em; display: flex; align-items: center; justify-content: center; }
.ware-fx { font: 600 11.5px/1.15 var(--body); text-align: center; color: #fff4d6; opacity: .92; text-wrap: balance; min-height: 2.3em; display: flex; align-items: flex-start; justify-content: center; }
.coin { position: absolute; bottom: -13px; left: 50%; transform: translateX(-50%); z-index: 2; min-width: 38px; height: 26px; padding: 0 8px;
  display: grid; place-items: center; font: 400 17px var(--game); color: var(--edge); border-radius: 13px; border: 3px solid var(--edge);
  background: radial-gradient(circle at 35% 30%, #fff1a8, #ffc93c 55%, #d18d0c); }
.ware.poor .coin { background: #6b6290; color: var(--ink2); }
.count { position: absolute; top: -8px; right: -6px; font: 400 13px var(--game); color: var(--edge); background: var(--green); border: 2px solid var(--edge); border-radius: 10px; padding: 1px 6px; }
.next { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; font-size: 13px; color: var(--ink2); border-top: 2px dashed rgba(255, 255, 255, .12); padding-top: 10px; text-align: left; }
.next b { color: var(--ink); }
/* la barre du bas respire : rien ne se touche, bouton principal pleine largeur */
.shopnav { display: flex; flex-direction: column; gap: 14px; position: sticky; bottom: -18px; margin: 0 -18px -18px; padding: 14px 18px 18px;
  background: var(--panel); border-top: 3px solid var(--edge); box-shadow: 0 -4px 10px rgba(8, 5, 18, .5); z-index: 3; }
.shopnav .row { gap: 12px; }
#buyrow { display: flex; flex-direction: column; gap: 12px; }
#buyrow #buy { width: 100%; margin: 0; }
.pick-hint { color: var(--ink2); font: 400 15px var(--game); padding: 4px 0; }
.detail { display: flex; gap: 10px; align-items: center; background: var(--bg); border: 2px solid var(--edge); border-radius: 12px; padding: 8px 10px; font-size: 13px; color: var(--ink2); text-align: left; }
.detail b { display: block; font: 400 16px var(--game); color: var(--gold); } .detail-ico { font-size: 28px; flex: none; }

/* ---------- Menu titre ---------- */
.title-screen { position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 16px; text-align: center; max-width: 560px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 30px) max(20px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 16px) max(20px, env(safe-area-inset-left, 0px));
  background: linear-gradient(rgba(14, 11, 31, .96), rgba(14, 11, 31, .62) 45%, rgba(14, 11, 31, .9) 70%, rgba(14, 11, 31, .98)); }
body.at-title .top, body.at-title .hud, body.at-title .gauges, body.at-title .relics, body.at-title .boss, body.at-title .bench, body.at-title .muses { visibility: hidden; }
.ts-logo h1 { margin: 6px 0 0; font: 400 clamp(42px, 12vw, 66px)/1 var(--game); color: var(--gold); -webkit-text-stroke: 4px var(--edge); paint-order: stroke fill; text-shadow: 0 7px 0 var(--edge), 0 0 40px rgba(255, 201, 60, .3); }
.ts-logo p { margin: 10px 0 0; font: 400 18px/1.25 var(--game); }
.spindle { font-size: 58px; line-height: 1; display: inline-block; animation: spin 3s ease-in-out infinite; } @keyframes spin { 50% { transform: translateY(-6px) rotate(-4deg); } }
.ts-menu { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; }
.ts-menu .btn.gold { font-size: 24px; padding: 12px 16px 14px; }
.ts-menu .btn.daily { background: linear-gradient(#7fd6c8, #3a8f86 50%, #1f5c56); }
.ts-menu .btn.ghost { background: var(--panel); }
.ts-row { display: flex; gap: 12px; } .ts-row .btn { flex: 1; font-size: 16px; padding: 9px 8px 11px; }
.ts-foot p { margin: 4px 0; } .ts-foot .record { font: 400 17px var(--game); } .ts-foot .record b { color: var(--gold); }
.ts-foot .version { font-size: 12px; color: var(--ink2); } .ts-foot a { color: var(--ink2); }
.update { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); z-index: 20; display: flex; gap: 10px; align-items: center;
  background: var(--panel); border: 3px solid var(--edge); border-radius: 14px; padding: 8px 10px 8px 14px; box-shadow: 0 4px 0 var(--edge); font: 400 15px var(--game); }
.update button { font: 400 15px var(--game); background: var(--gold); color: var(--edge); border: 2px solid var(--edge); border-radius: 10px; padding: 4px 10px; }

/* petits écrans (iPhone SE) : on resserre */
@media (max-height: 600px) {
  #app { gap: 6px; } .goal, .medal { height: 42px; } .gauge { padding: 3px 8px 4px; } .gauge b { font-size: 19px; }
  .board { --gap: 6px; padding: 8px; } .hint { font-size: 13px; } .bench { min-height: 44px; }
}

/* ---------- Ordinateur : vraie mise en page (pas la colonne du téléphone étirée) ----------
   À gauche ce qu'il faut tenir (paires, série, souffle, reliques, les neuf salles), au centre le plateau en grand. */
@media (min-width: 960px) and (min-height: 600px) {
  #app { max-width: 1280px; display: grid; grid-template-columns: clamp(300px, 24vw, 360px) minmax(0, 1fr); grid-template-rows: auto auto auto auto 1fr auto;
    column-gap: 40px; row-gap: 12px; padding: 18px 28px 16px; }
  .top { grid-column: 1 / -1; } .top h1 { font-size: 26px; } .help { width: 42px; height: 42px; font-size: 22px; }
  .hud { grid-column: 1; grid-row: 2; } .goal, .medal { height: 58px; } .gtext { font-size: 26px; } .medal { width: 96px; } .medal b { font-size: 28px; }
  .gauges { grid-column: 1; grid-row: 3; grid-template-columns: 1fr 1fr; } #souffleBox { grid-column: 1 / -1; }
  .relics { grid-column: 1; grid-row: 4; align-self: start; } .relic { width: 44px; height: 44px; font-size: 24px; }
  .relics:empty { display: flex; }
  .boss { grid-column: 2; grid-row: 2; font-size: 17px; padding: 9px 12px; }
  .muses { grid-column: 1; grid-row: 5 / 7; align-self: start; display: flex; flex-direction: column; gap: 6px; }
  .muses .label { margin: 4px 0 2px !important; }
  .musrow { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 12px; background: rgba(44, 38, 82, .55);
    border: 2px solid transparent; font: 400 16px var(--game); color: var(--ink2); }
  .musrow .dn { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--bg2); border: 2px solid var(--edge); font-size: 14px; }
  .musrow b { font-weight: 400; font-variant-numeric: tabular-nums; }
  .musrow.boss-row { color: #bff3ea; }
  .musrow.past { opacity: .55; } .musrow.past .dn { background: var(--green); color: var(--edge); }
  .musrow.now { background: var(--panel); border-color: var(--gold); color: #fff; box-shadow: 0 3px 0 var(--edge); } .musrow.now .dn { background: var(--gold); color: var(--edge); }
  .board { grid-column: 2; grid-row: 3 / 6; --gap: 14px; padding: 20px; --t: min(calc((100cqw - 40px - (var(--cols) - 1) * var(--gap)) / var(--cols)), calc((100cqh - 40px - (var(--rows) - 1) * var(--gap)) / var(--rows)), 150px); }
  #app:not(:has(.boss:not([hidden]))) .board { grid-row: 2 / 6; }
  .bench { grid-column: 2; grid-row: 6; min-height: 60px; }
  .hint { font-size: 19px; max-width: 360px; }
  .tool { min-width: 72px; font-size: 24px; padding: 8px 10px 9px; }
  #toast { font-size: 44px; }
}
/* Écran titre sur ordinateur : plein écran, deux colonnes (le grand titre à gauche, le menu à droite) */
@media (min-width: 960px) and (min-height: 600px) {
  .title-screen { max-width: none; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr); grid-template-rows: 1fr auto;
    align-items: center; justify-items: center; column-gap: 5vw; padding: 6vh 7vw 3vh;
    background: radial-gradient(ellipse at 30% 45%, rgba(14, 11, 31, .55), rgba(14, 11, 31, .92) 70%), linear-gradient(90deg, rgba(14, 11, 31, .35), rgba(14, 11, 31, .85)); }
  .ts-logo { text-align: left; justify-self: end; }
  .ts-logo .spindle { font-size: clamp(80px, 11vh, 130px); }
  .ts-logo h1 { white-space: nowrap; font-size: clamp(60px, 6vw, 118px); -webkit-text-stroke: 6px var(--edge); text-shadow: 0 10px 0 var(--edge), 0 0 60px rgba(255, 201, 60, .35); }
  .ts-logo p { font-size: clamp(22px, 2.2vw, 32px); margin-top: 16px; }
  .ts-menu { max-width: 420px; justify-self: start; gap: 12px; }
  .ts-menu .btn { transition: transform .12s, filter .12s; } .ts-menu .btn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.08); }
  .ts-menu .btn.gold { font-size: 30px; padding: 16px 16px 18px; }
  .ts-foot { grid-column: 1 / -1; }
}

/* ---------- Animations : éclats, confettis, paliers de la série ---------- */
.spark { position: fixed; z-index: 9; pointer-events: none; border-radius: 50%; border: 1.5px solid var(--edge); }
.spark.confetti { border-radius: 2px; border-width: 1px; }
.combo { position: absolute; left: 50%; top: 40%; z-index: 7; translate: -50% -50%; display: flex; flex-direction: column; align-items: center; pointer-events: none; opacity: 0; text-align: center; }
.combo b { font: 400 86px/1 var(--game); color: var(--gold); -webkit-text-stroke: 8px var(--edge); paint-order: stroke fill; text-shadow: 0 8px 0 var(--edge); }
.combo span { font: 400 26px/1.1 var(--game); color: #fff; -webkit-text-stroke: 6px var(--edge); paint-order: stroke fill; white-space: nowrap; }
.combo[data-tier="1"] b { color: var(--orange); } .combo[data-tier="2"] b { color: #ff6b8a; font-size: 100px; } .combo[data-tier="3"] b { color: #ff4458; font-size: 116px; text-shadow: 0 8px 0 var(--edge), 0 0 40px rgba(255, 68, 88, .8); }
.combo.on { animation: combo 1.25s cubic-bezier(.2, .9, .3, 1) forwards; }
@keyframes combo { 0% { opacity: 0; transform: scale(.3) rotate(-12deg); } 18% { opacity: 1; transform: scale(1.18) rotate(3deg); } 30% { transform: scale(1) rotate(0); } 75% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-40px) scale(.9); } }
#sheet:not([hidden]) { animation: fadein .2s ease-out; }
#sheet:not([hidden]) .sheet { animation: sheetin .38s cubic-bezier(.2, 1.3, .4, 1); }
@keyframes fadein { from { opacity: 0; } }
@keyframes sheetin { from { transform: translateY(30px) scale(.92); opacity: 0; } }
@media (min-width: 960px) and (min-height: 600px) { .combo b { font-size: 120px; } .combo[data-tier="2"] b { font-size: 140px; } .combo[data-tier="3"] b { font-size: 160px; } .combo span { font-size: 36px; } }
@media (prefers-reduced-motion: reduce) { .spindle, .medal, #toast.on, .gauge[data-level="low"], .slide.on *, .tile.glow .front, .combo.on, #sheet:not([hidden]), #sheet:not([hidden]) .sheet { animation: none !important; } .combo.on { opacity: 1; } .tile .face { transition: none; } }

/* ---------- Avis : étoiles et message ---------- */
.stars { display: flex; justify-content: center; gap: 6px; }
.star { width: 48px; height: 48px; padding: 0; font-size: 36px; line-height: 1; color: rgba(255, 255, 255, .22); background: none; border: 0; cursor: pointer;
  -webkit-text-stroke: 2px var(--edge); paint-order: stroke fill; transition: transform .12s, color .12s; }
.star.on { color: var(--gold); } .star:active { transform: scale(.9); }
@media (hover: hover) { .star:hover { transform: scale(1.12); } }
.avis-text { width: 100%; min-height: 104px; resize: vertical; font: 16px/1.4 var(--body); color: var(--ink); background: var(--bg); border: 2px solid var(--edge);
  border-radius: 12px; padding: 10px 12px; touch-action: auto; user-select: text; -webkit-user-select: text; }
.rate { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px; border-radius: 14px; background: var(--bg); }
.rate > span { font: 400 16px var(--game); color: var(--ink2); }
.rated { font: 400 16px var(--game); color: var(--green); }
.shopnav #aSend { width: 100%; }

/* ---------- Bandeau d'installation (écran titre uniquement : en jeu il cacherait le plateau) ---------- */
.install { position: fixed; left: 12px; right: 12px; z-index: 15; bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); max-width: 496px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px; padding: 10px 8px 10px 10px; border-radius: 16px; background: var(--panel); border: 3px solid var(--edge); box-shadow: 0 4px 0 var(--edge); }
body:not(.at-title) .install { display: none !important; }
.install img { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.install-text { flex: 1; min-width: 0; font-size: 13px; color: var(--ink2); line-height: 1.3; }
.install-text > b { display: block; font: 400 16px var(--game); color: var(--ink); }
.install-btn { flex: none; font: 400 15px var(--game); color: var(--edge); background: var(--gold); border: 2px solid var(--edge); border-radius: 10px; padding: 7px 12px 8px; cursor: pointer; }
.install-close { flex: none; background: none; border: 0; color: var(--ink2); font-size: 18px; padding: 6px; cursor: pointer; }
.share-ico { width: 16px; height: 16px; vertical-align: -3px; color: var(--gold); }
/* le pied de l'écran titre reste visible au-dessus du bandeau */
body.has-install .title-screen { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 96px); }

/* écran de fin : le classement respire (étiquette, pseudo, liste espacés de 12 px) */
#lb { display: flex; flex-direction: column; gap: 12px; }
#lb:empty { display: none; }
#lb .label { margin: 6px 0 0 !important; }
