/* Pénélope — un jeu Ludolympe. La chambre de Pénélope à Ithaque, de nuit : violet de la série, or, laines de couleur.
   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: #1f1129; --bg2: #140b1c; --panel: #3a2352; --edge: #0e0716; --ink: #f6f0e4; --ink2: #c3b3d9;
  --gold: #ffc93c; --red: #ff4458; --green: #3ddc97; --orange: #ff8a3d;
  --pourpre: #c55be0; --safran: #f5b31c; --azur: #4a9bff; --olive: #7cc44a;
  --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%, #4a2a5e 0%, #2b1838 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, #7a3c9c, #c55be0); transition: width .5s cubic-bezier(.2, .8, .3, 1); }
.goal.done .gfill { background: linear-gradient(90deg, #1c8f5e, #3ddc97); }
.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: #5a1c3a; border: 2px solid var(--edge); font: 400 14px/1.2 var(--game); color: #ffd6e6; text-align: center; }
.boss b { color: #fff; }
.days { display: none; }

/* ---------- Cartes ---------- */
.card { position: relative; width: var(--cw, 56px); height: calc(var(--cw, 56px) * 1.42); border-radius: calc(var(--cw, 56px) * .17); background: #fbf5e6;
  border: 3px solid var(--edge); box-shadow: 0 3px 0 var(--edge); display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--edge);
  --fs: calc(var(--cw, 56px) * .56); }
.card .v { font: 400 var(--fs)/1 var(--game); color: var(--c); -webkit-text-stroke: 2px var(--edge); paint-order: stroke fill; }
.card .s { font-size: calc(var(--fs) * .55); line-height: 1; margin-top: 1px; }
.card .c1 { position: absolute; top: 2px; left: 5px; font: 400 calc(var(--fs) * .4) var(--game); color: var(--c); }
.card.back { background: repeating-linear-gradient(45deg, #6b3c8c 0 5px, #4e2a68 5px 10px), #4e2a68; }
.card.back::after { content: ''; position: absolute; inset: 4px; border-radius: inherit; border: 2px solid rgba(255, 201, 60, .45); }
/* fil d'or (×3) et laine d'Iris (toutes les laines) */
.card.gold { background: linear-gradient(145deg, #fff6c8, #ffd95e 55%, #f0b62a); }
.card.gold::before { content: '✨'; position: absolute; top: 1px; right: 3px; font-size: calc(var(--fs) * .32); }
.card.iris { background: linear-gradient(160deg, #ffe0f4, #e3f1ff 50%, #e6ffd8); }
.card.mini { --cw: 26px; border-width: 2px; border-radius: 6px; box-shadow: 0 2px 0 var(--edge); display: inline-flex; vertical-align: middle; }
.card.mini .v { -webkit-text-stroke: 1px var(--edge); } .card.mini .c1, .card.mini::before { display: none; }

/* ---------- Le métier : colonnes de cartes, seule celle du dessus est visible ---------- */
.loom { --n: 7; --rows: 4; --gap: 5px; --pad: 8px; flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: var(--gap);
  container-type: size; padding: var(--pad) 6px; align-items: start; border-radius: 18px; border: 3px solid var(--edge);
  background: linear-gradient(#5a3a22, #3c2614); box-shadow: inset 0 0 30px rgba(0, 0, 0, .45), 0 3px 0 var(--edge); position: relative; }
/* les fils de chaîne du métier, derrière les cartes */
.loom::before { content: ''; position: absolute; inset: 10px 8px; border-radius: 12px; pointer-events: none;
  background: repeating-linear-gradient(90deg, rgba(255, 230, 190, .1) 0 1px, transparent 1px 9px); }
/* taille des cartes : la plus grande qui tient en largeur ET en hauteur ; les cartes cachées s'étalent pour remplir le
   métier (on voit combien il en reste sous chaque carte) */
.col { --cwW: calc((100cqw - 12px - (var(--n) - 1) * var(--gap)) / var(--n));
  --cwH: calc((100cqh - 2 * var(--pad)) / (1.42 * (1 + (var(--rows) - 1) * .42)));
  --cw: min(var(--cwW), var(--cwH), var(--cwMax, 999px)); --ch: calc(var(--cw) * 1.42);
  --step: min(calc(var(--ch) * .55), calc((100cqh - 2 * var(--pad) - var(--ch)) / (var(--rows) - 1)));
  position: relative; display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.col .card { flex: none; }
.col .card + .card { margin-top: calc(var(--step) - var(--ch)); }
.col .card.top { transition: transform .15s, box-shadow .15s; }
.col .card.ok { box-shadow: 0 3px 0 var(--edge), 0 0 0 3px var(--gold), 0 0 16px rgba(255, 201, 60, .55); }
.col .card.aim { box-shadow: 0 3px 0 var(--edge), 0 0 0 3px #fff; }
.col .card.locked { filter: grayscale(.8) brightness(.75); }
.col .card.locked::after { content: '🔒'; position: absolute; bottom: 2px; right: 2px; font-size: calc(var(--fs) * .32); }
.col.empty::after { content: ''; width: var(--cw); height: calc(var(--cw) * 1.42); border-radius: calc(var(--cw) * .17); border: 2px dashed rgba(255, 230, 190, .25); }
.card.flip { animation: flip .35s; } @keyframes flip { 0% { transform: rotateY(90deg); } 100% { transform: none; } }

/* ---------- La pièce en cours : les cartes du fil et ce qu'elle rapporte ---------- */
.weave { flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 66px; padding: 6px 10px; border-radius: 14px;
  background: rgba(14, 7, 22, .45); border: 2px solid rgba(255, 255, 255, .08); }
.strip { display: flex; justify-content: center; min-height: 37px; padding-left: 5px; }
.strip .card { margin-left: -5px; }
.strip .card:last-child { animation: drop .25s; } @keyframes drop { from { transform: translateY(-10px); opacity: 0; } }
.piece { font: 400 18px var(--game); color: #fff; -webkit-text-stroke: 3px var(--edge); paint-order: stroke fill; font-variant-numeric: tabular-nums; }
.piece .m { color: var(--orange); } .piece b { color: var(--gold); font-weight: 400; }
.piece small { font: 600 12.5px var(--body); color: var(--ink2); -webkit-text-stroke: 0; }
.weave.long { border-color: rgba(255, 138, 61, .55); box-shadow: 0 0 18px rgba(255, 138, 61, .25); }
.weave.ghost { position: fixed; z-index: 6; margin: 0; pointer-events: none; background: rgba(58, 35, 82, .95); border-color: var(--gold); }
.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; }
@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; } }

/* ---------- L'établi : pelote, navette, fuseaux ---------- */
.bench { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 12px; }
.nav-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.hint { min-height: 2.3em; display: flex; align-items: flex-end; justify-content: center; text-align: center; text-wrap: balance; font: 400 14px/1.15 var(--game); color: var(--gold); max-width: 190px; }
.hint b { color: #fff; font-weight: 400; }
.navette { --cw: 78px; }
.navette .card { box-shadow: 0 5px 0 var(--edge), 0 0 0 4px rgba(255, 201, 60, .6); }
.pelote { justify-self: start; position: relative; --cw: 60px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: var(--ink); cursor: pointer; font: inherit; }
.pelote .card { box-shadow: 0 3px 0 var(--edge), 4px 4px 0 -1px #4e2a68, 4px 4px 0 2px var(--edge); }
.pcount { position: absolute; top: -8px; right: -10px; min-width: 28px; height: 26px; padding: 0 6px; display: grid; place-items: center; font: 400 15px var(--game); color: var(--edge);
  background: var(--gold); border: 3px solid var(--edge); border-radius: 13px; }
.plabel { font: 600 11.5px var(--body); color: var(--ink2); white-space: nowrap; }
.pend { font: 400 15px var(--game); color: var(--edge); background: var(--gold); border: 3px solid var(--edge); border-radius: 14px; padding: 10px 10px 12px; box-shadow: 0 4px 0 var(--edge); max-width: 110px; }
/* Argos : la prochaine carte de la pelote, visible mais clairement « dans la pelote » (pas une carte à jouer) */
.pelote .card.peek { filter: brightness(.82) saturate(.8); }
.pelote .card.peek::after { content: '🐕'; position: absolute; bottom: -8px; left: -8px; width: 26px; height: 26px; display: grid; place-items: center; font-size: 14px;
  background: var(--panel); border: 2px solid var(--edge); border-radius: 50%; }
.pelote.call .card { animation: call 1s infinite; } @keyframes call { 50% { transform: translateY(-5px); box-shadow: 0 3px 0 var(--edge), 0 0 0 3px var(--gold), 0 0 18px rgba(255, 201, 60, .7); } }
.tools { justify-self: end; display: flex; flex-direction: column; 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(#a3542a, #6d3216); 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(#e08a3a, #a3542a); }
#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); }

/* ---------- Fiches ---------- */
#sheet { position: fixed; inset: 0; z-index: 8; background: rgba(10, 5, 16, .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(#7b4fa8, #563384); }
.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 { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; font-variant-numeric: tabular-nums; }
.board li { display: grid; grid-template-columns: 30px 1fr auto; gap: 8px; padding: 8px 12px; background: var(--bg); border-radius: 10px; text-align: left; }
.board li.me { outline: 2px solid var(--gold); } .board b { font: 400 16px var(--game); color: var(--gold); }
.pseudo { display: flex; gap: 8px; }
.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; }
.deckgrid { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px 4px; justify-items: center; }
.deckgrid .card.mini { --cw: 30px; cursor: pointer; }
.deckgrid .card.sel { outline: 3px solid var(--gold); transform: translateY(-3px); }
.deckgrid .card.off { opacity: .35; cursor: default; }

/* ---------- 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 { --cw: 52px; display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px; min-height: 120px;
  background: linear-gradient(#5a3a22, #3c2614); border: 2px solid var(--edge); border-radius: 14px; padding: 10px; }
.slide .demo .card.ok { box-shadow: 0 3px 0 var(--edge), 0 0 0 3px var(--gold); }
.slide .demo .card.nav { --cw: 64px; }
.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; } }

/* ---------- Nuit et marché d'Ithaque : 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(#a0622e, #6e3d17); 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 (un nom sur deux lignes ne rend pas un objet « plus important ») */
.wares { position: relative; z-index: 1; display: flex; gap: 10px; justify-content: center; align-items: stretch; padding-bottom: 18px; }
.wares.nights { padding-bottom: 6px; }
.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(#6b4a92, #4a2f6e); }
.ware:nth-child(odd) { transform: rotate(-2deg); } .ware:nth-child(even) { transform: rotate(2deg); }
.ware.k-use { background: linear-gradient(#a3542a, #6d3216); } .ware.k-live { background: linear-gradient(#2f8f63, #1c5c3f); } .ware.k-score { background: linear-gradient(#b8860b, #7a5506); }
.ware.k-night { background: linear-gradient(#3a4a8f, #252f66); padding-bottom: 12px; }
.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 (Gio est minutieux sur les marges) : 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(20, 11, 28, .96), rgba(20, 11, 28, .62) 45%, rgba(20, 11, 28, .9) 70%, rgba(20, 11, 28, .98)); }
body.at-title .top, body.at-title .hud, body.at-title .gauges, body.at-title .relics, body.at-title .boss, body.at-title .weave, body.at-title .bench, body.at-title .days { visibility: hidden; }
.ts-logo h1 { margin: 6px 0 0; font: 400 clamp(46px, 13vw, 68px)/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(-8deg); } }
.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(#ffb36b, var(--orange) 50%, #c9541a); }
.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; }
@media (prefers-reduced-motion: reduce) { .spindle, .medal, #toast.on, .gauge[data-level="low"], .slide.on *, .pelote.call .card, .card.flip, .strip .card { animation: none !important; } }

/* 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; }
  .navette { --cw: 66px; } .pelote { --cw: 52px; } .weave { min-height: 58px; padding: 4px 8px; } .hint { min-height: 2.2em; font-size: 13px; }
}

/* ---------- Ordinateur : vraie mise en page (pas la colonne du téléphone étirée) ----------
   À gauche ce qu'il faut tenir (objectif, fil, jauges, reliques), au centre le métier en grand, en bas la pièce en
   cours et l'établi. Survol qui soulève les cartes jouables. */
@media (min-width: 960px) and (min-height: 600px) {
  #app { max-width: 1280px; display: grid; grid-template-columns: 320px minmax(0, 1fr); grid-template-rows: auto auto auto auto 1fr auto auto;
    column-gap: 26px; 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; } #pelBox { 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; }
  .days { grid-column: 1; grid-row: 5 / 8; align-self: start; display: flex; flex-direction: column; gap: 6px; }
  .days .label { margin: 4px 0 2px !important; }
  .dayrow { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 12px; background: rgba(58, 35, 82, .55);
    border: 2px solid transparent; font: 400 16px var(--game); color: var(--ink2); }
  .dayrow .dn { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--bg2); border: 2px solid var(--edge); font-size: 14px; }
  .dayrow b { font-weight: 400; font-variant-numeric: tabular-nums; }
  .dayrow.boss-day { color: #ffc0d6; }
  .dayrow.past { opacity: .55; } .dayrow.past .dn { background: var(--green); color: var(--edge); }
  .dayrow.now { background: var(--panel); border-color: var(--gold); color: #fff; box-shadow: 0 3px 0 var(--edge); } .dayrow.now .dn { background: var(--gold); color: var(--edge); }
  .loom { grid-column: 2; grid-row: 3 / 6; --gap: 14px; padding: var(--pad) 22px; }
  #app:not(:has(.boss:not([hidden]))) .loom { grid-row: 2 / 6; }
  .col { --step: min(calc(var(--ch) * .72), calc((100cqh - 2 * var(--pad) - var(--ch)) / (var(--rows) - 1))); }
  .loom { --pad: 18px; } .col { --cwMax: 130px; --cwW: calc((100cqw - 44px - (var(--n) - 1) * var(--gap)) / var(--n)); }
  .strip .card.mini { --cw: 32px; }
  .col .card.ok:hover { transform: translateY(-6px); }
  /* la pièce en cours, en bandeau sous le métier : le fil à gauche, le calcul à droite */
  .weave { grid-column: 2; grid-row: 6; flex-direction: row; justify-content: center; gap: 22px; min-height: 64px; padding: 8px 18px; }
  .piece { font-size: 26px; }
  .bench { grid-column: 2; grid-row: 7; grid-template-columns: 1fr auto 1fr; }
  .navette { --cw: 104px; } .pelote { --cw: 84px; justify-self: end; } .tools { justify-self: start; flex-direction: row; }
  .tool { min-width: 72px; font-size: 24px; padding: 8px 10px 9px; }
  .hint { font-size: 18px; max-width: 320px; }
  #toast { font-size: 44px; }
}
@media (min-width: 1600px) and (min-height: 900px) {
  #app { max-width: 1560px; grid-template-columns: 360px minmax(0, 1fr); }
  .col { --cwMax: 150px; }
  .navette { --cw: 120px; } .pelote { --cw: 96px; }
}
/* Écran titre sur ordinateur : plein écran, deux colonnes (le grand titre à gauche, le menu à droite) ;
   la partie de démonstration se devine derrière, sous un voile qui couvre tout l'écran. */
@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(20, 11, 28, .55), rgba(20, 11, 28, .92) 70%), linear-gradient(90deg, rgba(20, 11, 28, .35), rgba(20, 11, 28, .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(64px, 6.4vw, 124px); -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; }
}
