/* ==========================================================================
   Page TRAJECTOIRE — complète site.css (mêmes jetons, mêmes boutons).
   ========================================================================== */

/* ---------- en-tête de page + cadre de jeu ---------- */
.tj-hero { position: relative; isolation: isolate; padding: calc(var(--header-h) + 18px) 0 clamp(40px, 6vw, 72px); }
.tj-hero__bg {
  position: absolute; inset: 0; z-index: -1; overflow: hidden;
  background:
    radial-gradient(50% 45% at 80% 12%, rgba(116, 36, 223, .10), transparent 70%),
    radial-gradient(40% 40% at 10% 0%, rgba(40, 84, 219, .07), transparent 70%),
    var(--white);
}
.tj-crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: .86rem; color: var(--muted); margin: 6px 0 18px; }
.tj-crumbs a { color: var(--muted); text-decoration: none; }
.tj-crumbs a:hover { color: var(--violet); text-decoration: underline; }
.tj-hero__head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px clamp(24px, 5vw, 72px); align-items: end; margin-bottom: clamp(20px, 3vw, 30px); }
.tj-hero__head .eyebrow { margin-bottom: 10px; }
.tj-title { font-size: clamp(3rem, 1.6rem + 5.2vw, 6.2rem); letter-spacing: -.055em; line-height: .95; font-weight: 600; }
.tj-title__word { display: inline-block; padding: 0 .04em .08em 0; background: linear-gradient(100deg, var(--navy) 0%, var(--navy) 38%, var(--violet) 70%, var(--blue) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tj-title__sub { display: block; margin-top: 12px; font-size: clamp(.98rem, .9rem + .3vw, 1.15rem); letter-spacing: 0; text-transform: none; font-weight: 450; color: var(--ink-2); line-height: 1.35; }
.tj-hero__intro { padding-bottom: 6px; }
.tj-claim { font-size: clamp(1.35rem, 1rem + 1.2vw, 2rem); font-weight: 600; letter-spacing: -.025em; line-height: 1.15; margin-bottom: 10px; }
.tj-hero__intro p:last-child { color: var(--ink-2); margin: 0; max-width: 44ch; }

.tj-stage {
  --r: 26px;
  position: relative; overflow: hidden; isolation: isolate;
  width: 100%; aspect-ratio: 16 / 9; max-height: min(82svh, 760px);
  border-radius: var(--r);
  background: #05061A;
  box-shadow: 0 2px 4px rgba(16, 19, 68, .08), 0 40px 80px -36px rgba(40, 20, 120, .55);
  color: #fff; outline: none;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.tj-stage:focus-visible { box-shadow: 0 0 0 3px var(--gold-l), 0 40px 80px -36px rgba(40, 20, 120, .55); }
.tj-canvas, .tj-canvas canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tj-stage.is-playing .tj-canvas { touch-action: none; cursor: grab; }
/* chargement : un fond sobre et un anneau qui tourne, rien d'autre ; le bouton n'apparaît qu'une fois la scène prête */
.tj-loader {
  position: absolute; inset: 0; z-index: 6; display: grid; place-content: center; justify-items: center; gap: 16px;
  background: radial-gradient(90% 80% at 50% 45%, #1a1f5c 0%, #0b0d33 55%, #05061A 100%);
  transition: opacity .6s ease, visibility 0s .6s;
}
.tj-loader__ring { width: 46px; height: 46px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .14); border-top-color: var(--gold-l); border-right-color: rgba(255, 196, 102, .45); animation: tj-spin .9s linear infinite; }
.tj-loader__label { font-size: .86rem; letter-spacing: .04em; color: rgba(255, 255, 255, .72); }
.tj-stage.is-ready .tj-loader, .tj-stage.is-error .tj-loader { opacity: 0; visibility: hidden; }
.tj-stage:not(.is-ready) .tj-start { opacity: 0; visibility: hidden; }
.tj-start { transition: opacity .5s ease .1s; }

/* écran de départ */
.tj-start {
  position: absolute; inset: 0; z-index: 5; display: grid; place-content: center; justify-items: center; gap: 18px; padding: 20px;
  background: radial-gradient(60% 60% at 50% 55%, rgba(5, 6, 26, .15), rgba(5, 6, 26, .55));
  text-align: center;
}
.tj-play {
  display: inline-flex; align-items: center; gap: 14px; cursor: pointer;
  min-height: 64px; padding: 14px 34px 14px 24px; border: 0; border-radius: 999px;
  background: linear-gradient(120deg, #FFE0A3, var(--gold-l) 45%, var(--gold));
  color: var(--navy); font-size: 1.2rem; font-weight: 600; letter-spacing: .01em;
  box-shadow: 0 18px 40px -14px rgba(232, 160, 42, .8), inset 0 0 0 1px rgba(255, 255, 255, .5);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
.tj-play svg { width: 26px; height: 26px; fill: currentColor; }
.tj-play:hover { transform: translateY(-2px) scale(1.02); box-shadow: 0 24px 50px -14px rgba(232, 160, 42, .95), inset 0 0 0 1px rgba(255, 255, 255, .6); }
.tj-play:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
.tj-start__note { margin: 0; font-size: .88rem; color: rgba(255, 255, 255, .78); text-shadow: 0 1px 8px rgba(0, 0, 0, .5); }
.tj-stage.is-playing .tj-start { display: none; }

/* repères en jeu */
.tj-hud { position: absolute; inset: 0 0 auto; z-index: 4; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; opacity: 0; pointer-events: none; transition: opacity .4s; }
.tj-stage.is-playing .tj-hud { opacity: 1; pointer-events: auto; }
.tj-steps { display: flex; gap: 6px; list-style: none; }
.tj-steps li { width: 22px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .22); transition: background .4s, width .4s var(--ease); }
.tj-steps li.is-done { background: rgba(255, 196, 102, .75); }
.tj-steps li.is-current { width: 34px; background: var(--gold-l); }
.tj-tools { display: flex; gap: 8px; }
.tj-tool {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; cursor: pointer;
  border: 0; background: rgba(10, 12, 40, .5); color: #fff;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); transition: background .2s;
}
.tj-tool:hover { background: rgba(40, 44, 110, .7); }
.tj-tool:focus-visible { outline: 2px solid var(--gold-l); outline-offset: 2px; }
.tj-tool svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tj-tool svg path:first-child { fill: currentColor; stroke: none; }
.tj-tool[data-tj-restart] svg path:first-child, .tj-tool[data-tj-fs] svg path:first-child { fill: none; stroke: currentColor; }
.tj-tool[data-tj-sound] .on { display: none; }
.tj-tool[data-tj-sound][aria-pressed="true"] .on { display: inline; }
.tj-tool[data-tj-sound][aria-pressed="true"] .off { display: none; }

/* messages : lisibles, en haut, jamais devant l'action */
.tj-msg { position: absolute; left: 0; right: 0; top: clamp(58px, 9%, 84px); z-index: 3; display: flex; justify-content: center; padding: 0 6%; pointer-events: none; }
.tj-msg span {
  font-size: clamp(1.15rem, .7rem + 2.1vw, 2.35rem); font-weight: 600; letter-spacing: -.02em; line-height: 1.15; text-align: center; text-wrap: balance;
  text-shadow: 0 2px 18px rgba(5, 6, 26, .85), 0 0 2px rgba(5, 6, 26, .6);
  opacity: 0; transform: translateY(10px); filter: blur(4px);
  transition: opacity .6s var(--ease), transform .6s var(--ease), filter .6s var(--ease);
}
.tj-msg.is-on span { opacity: 1; transform: none; filter: none; }
.tj-stage.is-final .tj-msg, .tj-stage.is-final .tj-hud, .tj-stage.is-final .tj-hint { opacity: 0; pointer-events: none; }
.tj-msg.is-small span { font-size: clamp(.95rem, .8rem + .6vw, 1.25rem); font-weight: 500; color: var(--gold-l); }
.tj-hint {
  position: absolute; left: 50%; bottom: 18px; z-index: 3; transform: translate(-50%, 8px);
  padding: 9px 16px; border-radius: 999px; font-size: .88rem; white-space: nowrap;
  background: rgba(10, 12, 40, .55); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
  opacity: 0; transition: opacity .5s, transform .5s var(--ease); pointer-events: none;
}
.tj-hint.is-on { opacity: 1; transform: translate(-50%, 0); }
.tj-hint kbd { display: inline-grid; place-items: center; min-width: 24px; height: 24px; margin: 0 2px; padding: 0 5px; border-radius: 6px; font: inherit; font-size: .8rem; background: rgba(255, 255, 255, .14); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .25); }
.tj-hint__touch { display: none; }
@media (pointer: coarse) { .tj-hint__keys { display: none; } .tj-hint__touch { display: inline; } }
.tj-stick { position: absolute; z-index: 3; width: 104px; height: 104px; margin: -52px 0 0 -52px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .35); opacity: 0; transition: opacity .2s; pointer-events: none; }
.tj-stick span { position: absolute; left: 50%; top: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%; background: rgba(255, 255, 255, .28); transform: translate(var(--dx, 0), var(--dy, 0)); }
.tj-stick.is-on { opacity: 1; }

/* écran final */
.tj-final {
  position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: 24px; text-align: center;
  background: radial-gradient(70% 70% at 50% 50%, rgba(5, 6, 26, .35), rgba(5, 6, 26, .82));
  animation: tj-in .9s var(--ease) both;
}
.tj-final__in { display: grid; justify-items: center; gap: 10px; max-width: 760px; }
.tj-final__msg { margin: 0; font-size: clamp(1rem, .8rem + .9vw, 1.45rem); color: rgba(255, 255, 255, .86); animation: tj-up .8s .1s var(--ease) both; }
.tj-final__title {
  margin: 0; font-size: clamp(2.2rem, 1.2rem + 5vw, 5rem); font-weight: 600; letter-spacing: -.045em; line-height: 1;
  background: linear-gradient(100deg, #fff 10%, var(--gold-l) 55%, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: tj-up .9s .25s var(--ease) both;
}
.tj-final__logo { color: #fff; margin-top: 10px; animation: tj-up .9s .45s var(--ease) both; }
.tj-yourlogo { width: clamp(200px, 30vw, 300px); height: auto; }
.tj-final__note { margin: 0; font-size: .8rem; color: rgba(255, 255, 255, .6); animation: tj-up .9s .55s var(--ease) both; }
.tj-final__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 12px; animation: tj-up .9s .65s var(--ease) both; }
.tj-btn-ghost { min-height: 52px; padding: 14px 26px; border-radius: 999px; border: 0; cursor: pointer; font: inherit; font-weight: 500; color: #fff; background: rgba(255, 255, 255, .08); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .4); transition: background .2s; }
.tj-btn-ghost:hover { background: rgba(255, 255, 255, .16); }
.tj-btn-ghost:focus-visible { outline: 3px solid var(--gold-l); outline-offset: 3px; }
@keyframes tj-in { from { opacity: 0; } }
@keyframes tj-up { from { opacity: 0; transform: translateY(14px); } }

/* états : chargement, erreur, contexte perdu, chute */
.tj-loading, .tj-error, .tj-lost { position: absolute; z-index: 7; margin: 0; display: none; }
.tj-loading { left: 50%; bottom: 18px; transform: translateX(-50%); align-items: center; gap: 10px; font-size: .86rem; color: rgba(255, 255, 255, .8); }
.tj-loading span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .25); border-top-color: var(--gold-l); animation: tj-spin .8s linear infinite; }
.tj-stage.is-loading .tj-loading { display: inline-flex; }
@keyframes tj-spin { to { transform: rotate(1turn); } }
.tj-error { inset: auto 20px 20px; padding: 14px 18px; border-radius: 14px; background: rgba(5, 6, 26, .78); font-size: .92rem; text-align: center; }
.tj-error p { margin: 0; }
.tj-stage.is-error .tj-error { display: block; }
.tj-stage.is-error .tj-start { display: none; }
.tj-lost { inset: 0; place-content: center; font-size: 1rem; background: rgba(5, 6, 26, .7); }
.tj-stage.is-lost .tj-lost { display: grid; }
.tj-fade { position: absolute; inset: 0; z-index: 2; background: #05061A; opacity: 0; pointer-events: none; transition: opacity .3s; }
.tj-stage.is-falling .tj-fade { opacity: .75; }

/* plein écran */
.tj-stage:fullscreen, .tj-stage.is-pseudo-fs { max-height: none; aspect-ratio: auto; border-radius: 0; }
.tj-stage.is-pseudo-fs { position: fixed; inset: 0; z-index: 200; width: 100%; height: 100%; height: 100dvh; }
html.tj-lock, html.tj-lock body { overflow: hidden; }

.tj-under { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px 24px; margin-top: 20px; }
.tj-transcript { flex: 1 1 320px; font-size: .95rem; color: var(--ink-2); }
.tj-transcript summary { cursor: pointer; font-weight: 500; color: var(--navy); padding: 12px 0; list-style: none; display: inline-flex; align-items: center; gap: 10px; }
.tj-transcript summary::-webkit-details-marker { display: none; }
.tj-transcript summary::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--grad); transition: transform .3s; }
.tj-transcript[open] summary::before { transform: rotate(45deg); }
.tj-transcript ol { margin: 4px 0 0; padding-left: 1.3em; display: grid; gap: 4px; }

/* ---------- principe ---------- */
.tj-principle__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 24px clamp(28px, 6vw, 88px); align-items: start; }
.tj-principle__text p:last-child { color: var(--ink-2); }
.tj-chain { grid-column: 1 / -1; list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 8px; counter-reset: c; }
.tj-chain li { position: relative; padding: 22px 22px 24px; border-radius: var(--radius); background: var(--off); box-shadow: inset 0 0 0 1px var(--line); display: grid; gap: 6px; }
.tj-chain li:not(:last-child)::after { content: "→"; position: absolute; right: -14px; top: 50%; transform: translate(50%, -50%); z-index: 1; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: #fff; box-shadow: var(--shadow); color: var(--violet); font-weight: 600; }
.tj-chain__k { font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; color: var(--violet); font-weight: 500; }
.tj-chain strong { font-weight: 550; line-height: 1.35; }
.tj-chain li:last-child { background: var(--navy); color: #fff; box-shadow: none; }
.tj-chain li:last-child .tj-chain__k { color: var(--gold-l); }

/* ---------- galerie des mécaniques ---------- */
.tj-gallery__how { margin: -8px 0 24px; color: var(--muted); font-size: .92rem; }
.tj-gallery__how .tj-hint__keys, .tj-gallery__how .tj-hint__touch { margin-right: 4px; }
.tj-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(14px, 1.6vw, 22px); }
.tj-card { display: flex; flex-direction: column; border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); overflow: hidden; transition: transform .4s var(--ease), box-shadow .4s var(--ease); }
.tj-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.tj-card__media { position: relative; aspect-ratio: 4 / 3; background: radial-gradient(120% 90% at 50% 100%, #1d2463, #05061A); overflow: hidden; }
.tj-card__media canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tj-card__media canvas.tj-live { z-index: 2; }
.tj-card__ph { position: absolute; inset: 0; display: grid; place-items: center; }
.tj-card__ph span { font-size: 2.4rem; font-weight: 600; color: rgba(255, 255, 255, .14); letter-spacing: -.04em; }
.tj-card.has-poster .tj-card__ph { display: none; }
.tj-card__play {
  position: absolute; left: 50%; top: 50%; z-index: 3; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; color: var(--navy); background: rgba(255, 255, 255, .9); box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .5);
  transition: opacity .3s, transform .3s var(--ease);
}
.tj-card__play svg { width: 22px; height: 22px; fill: currentColor; margin-left: 3px; }
.tj-card__play:focus-visible { outline: 3px solid var(--gold-l); outline-offset: 3px; }
.tj-card.is-playing .tj-card__play { opacity: 0; transform: scale(.85); }
.tj-card.is-playing .tj-card__play:focus-visible { opacity: 1; }
@media (hover: hover) and (pointer: fine) {
  .tj-card__play { opacity: 0; }
  .tj-card__media:hover .tj-card__play, .tj-card__play:focus-visible { opacity: .92; }
  .tj-card.is-playing .tj-card__media:hover .tj-card__play { opacity: 0; }
}
.tj-card__zoom { position: absolute; right: 10px; top: 10px; z-index: 3; width: 36px; height: 36px; border-radius: 10px; border: 0; cursor: pointer; display: grid; place-items: center; color: #fff; background: rgba(10, 12, 40, .5); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.tj-card__zoom svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.tj-card__zoom:focus-visible { outline: 2px solid var(--gold-l); outline-offset: 2px; }
html:not(.tj-previews) .tj-card__play, html:not(.tj-previews) .tj-card__zoom { display: none; }
.tj-card__body { display: flex; flex-direction: column; gap: 6px; padding: 18px 18px 18px; flex: 1; }
.tj-card__cat { margin: 0; font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--violet); font-weight: 500; }
.tj-card__title { font-size: 1.18rem; letter-spacing: -.015em; line-height: 1.2; }
.tj-card__msg { margin: 0; font-weight: 500; color: var(--navy); line-height: 1.4; }
.tj-card__desc { margin: 0; font-size: .88rem; color: var(--muted); line-height: 1.5; }
.tj-cta-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px 22px; margin-top: clamp(28px, 4vw, 44px); }

.tj-library { margin-top: clamp(48px, 6vw, 80px); }
.tj-library__title { font-size: clamp(1.5rem, 1rem + 1.6vw, 2.3rem); letter-spacing: -.03em; margin-bottom: 22px; }
.tj-library__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; align-items: start; }
.tj-family { border-radius: var(--radius-sm); background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.tj-family summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 12px; padding: 14px 16px; font-weight: 550; }
.tj-family summary::-webkit-details-marker { display: none; }
.tj-family summary::after { content: "+"; margin-left: auto; font-size: 1.3rem; line-height: 1; color: var(--violet); transition: transform .3s; }
.tj-family[open] summary::after { transform: rotate(45deg); }
.tj-family__id { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: .82rem; color: #fff; background: var(--grad); flex: none; }
.tj-family ul { list-style: none; padding: 0 16px 14px; display: grid; gap: 8px; }
.tj-family li { display: grid; gap: 1px; padding-top: 8px; border-top: 1px solid var(--line); }
.tj-family__a { font-weight: 500; font-size: .95rem; }
.tj-family__m { font-size: .9rem; color: var(--muted); }

.tj-dialog { width: min(1100px, 94vw); padding: 0; border: 0; border-radius: 22px; background: #05061A; color: #fff; box-shadow: 0 40px 80px -20px rgba(0, 0, 0, .6); overflow: hidden; }
.tj-dialog::backdrop { background: rgba(5, 6, 26, .78); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.tj-dialog__stage { position: relative; aspect-ratio: 16 / 9; }
.tj-dialog__stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.tj-dialog__text { padding: 16px 22px 20px; }
.tj-dialog__text h3 { font-size: 1.2rem; }
.tj-dialog__text p { margin: 6px 0 0; color: rgba(255, 255, 255, .82); }
.tj-dialog__close { position: absolute; right: 12px; top: 12px; min-height: 40px; padding: 8px 16px; border-radius: 999px; border: 0; cursor: pointer; font: inherit; font-weight: 500; background: rgba(255, 255, 255, .92); color: var(--navy); }

/* ---------- studio de personnalisation ---------- */
.tj-studio { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: clamp(16px, 2.4vw, 32px); align-items: start; }
.tj-studio__stage { position: relative; aspect-ratio: 16 / 10; border-radius: var(--radius); overflow: hidden; background: radial-gradient(120% 90% at 50% 100%, #1d2463, #05061A); box-shadow: var(--shadow-lg); }
.tj-studio__stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tj-studio__play { position: absolute; right: 14px; bottom: 14px; z-index: 3; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; color: var(--navy); background: rgba(255, 255, 255, .9); }
.tj-studio__play svg { width: 18px; height: 18px; fill: currentColor; margin-left: 2px; }
.tj-studio.is-playing .tj-studio__play { opacity: .55; }
.tj-studio__badge { position: absolute; left: 14px; top: 14px; z-index: 3; padding: 6px 12px; border-radius: 999px; font-size: .76rem; font-weight: 500; letter-spacing: .04em; color: #fff; background: rgba(10, 12, 40, .5); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
html:not(.tj-previews) .tj-studio__play, html:not(.tj-previews) .tj-studio__badge { display: none; }
.tj-studio__panel { display: grid; gap: 18px; }
.tj-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.tj-opts__t { flex-basis: 100%; margin: 0 0 2px; font-weight: 600; font-size: .95rem; }
.tj-opts__note { flex-basis: 100%; margin: 2px 0 0; font-size: .8rem; color: var(--muted); }
.tj-opt, .tj-listen {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 0; cursor: pointer;
  font: inherit; font-size: .9rem; color: var(--ink-2); background: #fff; box-shadow: inset 0 0 0 1.5px var(--line-2); transition: box-shadow .2s, color .2s, background .2s;
}
.tj-opt:hover, .tj-listen:hover { box-shadow: inset 0 0 0 1.5px var(--violet); color: var(--violet); }
.tj-opt[aria-pressed="true"] { color: #fff; background: var(--navy); box-shadow: none; }
.tj-sw { width: 30px; height: 16px; border-radius: 5px; background: linear-gradient(90deg, var(--c1) 0 40%, var(--c2) 40% 75%, var(--c3) 75%); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
.tj-listen svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.tj-listen svg path:first-child { fill: currentColor; stroke: none; }
.tj-listen .on { display: none; }
.tj-listen[aria-pressed="true"] { color: var(--violet); box-shadow: inset 0 0 0 1.5px var(--violet); }
.tj-listen[aria-pressed="true"] .on { display: inline; }
.tj-listen[aria-pressed="true"] .off { display: none; }
.tj-perso__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 2vw, 24px); margin-top: clamp(32px, 4vw, 52px); }
.tj-perso__item { padding: 24px; border-radius: var(--radius); background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.tj-perso__item h3 { font-size: 1.12rem; margin-bottom: 10px; }
.tj-perso__item p { margin: 0; color: var(--ink-2); font-size: .95rem; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) { .tj-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 960px) {
  .tj-hero__head, .tj-principle__grid, .tj-studio { grid-template-columns: 1fr; }
  .tj-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tj-perso__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tj-library__grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .tj-stage { aspect-ratio: 4 / 5; max-height: 78svh; width: auto; margin-inline: calc(-1 * var(--pad) + 8px); --r: 20px; }
  .tj-chain { grid-template-columns: 1fr; }
  .tj-chain li:not(:last-child)::after { right: 50%; top: auto; bottom: -14px; transform: translate(50%, 50%) rotate(90deg); }
  .tj-hud { padding: 10px; }
  .tj-tool { width: 38px; height: 38px; }
  .tj-play { min-height: 58px; font-size: 1.1rem; }
}
@media (max-width: 560px) {
  .tj-cards, .tj-perso__grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .tj-msg span, .tj-final, .tj-final * { transition: none !important; animation: none !important; }
}

/* ENVOL : autres idées de vol, en simple liste (pas d'accordéon pour une seule famille) */
.tj-ideas { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 10px 28px; }
.tj-ideas li { display: grid; gap: 2px; padding: 12px 0; border-bottom: 1px solid var(--line, rgba(16, 19, 68, .1)); }

/* « Votre logo » en bas à droite de la démo jouable : la place de la marque du client, pendant toute l'expérience */
.tj-brand {
  position: absolute; right: 14px; bottom: 12px; z-index: 4; pointer-events: none;
  width: clamp(116px, 15vw, 176px); padding: 5px 7px; border-radius: 14px; color: #fff;
  background: rgba(5, 6, 26, .32); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: opacity .4s;
}
.tj-brand .tj-yourlogo { display: block; width: 100%; height: auto; }
.tj-stage.is-final .tj-brand, .tj-stage:not(.is-ready) .tj-brand { opacity: 0; }
@media (max-width: 600px) { .tj-brand { width: 104px; right: 10px; bottom: 10px; } }

/* PARTICULES : plateau d'ingrédients et jauge d'agitation (dans le cadre de jeu) */
.tj--particules .tj-hint, .tj--particules .tj-stick { display: none; }   /* la matière suit le pointeur : pas de manette */
.pt-tray, .pt-gauge {
  position: absolute; left: 50%; bottom: 16px; z-index: 4; transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  transition: opacity .45s ease, transform .45s var(--ease);
  display: grid; justify-items: center; gap: 8px; width: min(92%, 760px); text-align: center;
}
.tj-stage.is-playing.pt-picking .pt-tray, .tj-stage.is-playing.pt-shaking .pt-gauge { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.pt-tray__t { margin: 0; font-size: .86rem; color: rgba(255, 255, 255, .82); text-shadow: 0 1px 8px rgba(0, 0, 0, .5); }
.pt-tray__n { margin-left: 8px; padding: 2px 9px; border-radius: 999px; background: rgba(255, 255, 255, .12); font-variant-numeric: tabular-nums; }
.pt-tray__list { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.pt-ingr {
  --c: #fff;
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 15px 8px 10px; border: 0; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: .9rem; font-weight: 500; color: #fff;
  background: rgba(10, 12, 40, .55); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: transform .25s var(--ease), background .25s, box-shadow .25s, opacity .25s;
}
.pt-ingr:hover:not(:disabled) { transform: translateY(-2px); box-shadow: inset 0 0 0 1.5px var(--c), 0 8px 24px -10px var(--c); }
.pt-ingr:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.pt-ingr__drop { width: 16px; height: 16px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: radial-gradient(circle at 35% 35%, #fff 0 18%, var(--c) 46%); box-shadow: 0 0 12px var(--c); }
.pt-ingr[aria-pressed="true"] { background: color-mix(in srgb, var(--c) 32%, rgba(10, 12, 40, .6)); box-shadow: inset 0 0 0 1.5px var(--c); }
.pt-ingr:disabled:not([aria-pressed="true"]) { opacity: .45; cursor: default; }
.pt-gauge__t { margin: 0; font-size: clamp(1.05rem, .9rem + .6vw, 1.4rem); font-weight: 600; color: #fff; text-shadow: 0 2px 14px rgba(0, 0, 0, .55); animation: pt-wiggle .5s ease-in-out infinite alternate; }
.pt-gauge__bar { position: relative; width: min(320px, 70vw); height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .16); overflow: hidden; }
.pt-gauge__bar span { position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--g, 0)); border-radius: inherit; background: linear-gradient(90deg, var(--violet, #7424DF), var(--gold-l)); }
.pt-gauge__how { margin: 0; font-size: .8rem; color: rgba(255, 255, 255, .7); }
@keyframes pt-wiggle { from { transform: rotate(-2deg); } to { transform: rotate(2deg); } }
@media (max-width: 700px) { .tj-stage.pt-picking .tj-brand, .tj-stage.pt-shaking .tj-brand { opacity: 0; } .pt-ingr { min-height: 40px; padding: 6px 12px 6px 8px; font-size: .82rem; } }
@media (prefers-reduced-motion: reduce) { .pt-gauge__t { animation: none; } }

/* LUMIÈRE : jauge de révélation (la lumière suit le pointeur : pas de manette ni de consigne flottante) */
.tj--lumiere .tj-hint, .tj--lumiere .tj-stick { display: none; }
.tj--lumiere .tj-stage.is-playing .tj-canvas { cursor: crosshair; }
.lu-gauge {
  position: absolute; left: 50%; bottom: 18px; z-index: 4; transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  transition: opacity .45s ease, transform .45s var(--ease);
  display: grid; justify-items: center; gap: 7px; width: min(92%, 520px); text-align: center;
}
.tj-stage.is-playing.lu-on .lu-gauge { opacity: 1; transform: translate(-50%, 0); }
.lu-gauge__t { margin: 0; font-size: clamp(.95rem, .85rem + .4vw, 1.15rem); font-weight: 600; color: #fff; text-shadow: 0 2px 14px rgba(0, 0, 0, .6); }
@media (max-width: 700px) { .tj-stage.lu-on .tj-brand { opacity: 0; } }
/* final : l'année embrasée reste visible en haut, l'écran final se pose dessous */
.tj--lumiere .tj-final { align-items: end; padding-bottom: clamp(18px, 4.5%, 44px); background: linear-gradient(180deg, transparent 44%, rgba(0, 0, 0, .5) 62%, rgba(0, 0, 0, .86) 86%); animation-duration: 1.4s; }
.tj--lumiere .tj-final__in { gap: 6px; }
.tj--lumiere .tj-final__title { font-size: clamp(1.9rem, 1.1rem + 3.2vw, 3.5rem); }
.tj--lumiere .tj-final__logo { margin-top: 4px; }
.tj--lumiere .tj-final .tj-yourlogo { width: clamp(170px, 22vw, 240px); }
@media (max-width: 600px) {   /* petit cadre : l'écran final se resserre sous l'année */
  .tj--lumiere .tj-final { padding: 12px 12px 14px; background: linear-gradient(180deg, transparent 34%, rgba(0, 0, 0, .55) 50%, rgba(0, 0, 0, .9) 72%); }
  .tj--lumiere .tj-final__note { display: none; }
  .tj--lumiere .tj-final__msg { font-size: .88rem; line-height: 1.35; }
  .tj--lumiere .tj-final__title { font-size: 1.65rem; }
  .tj--lumiere .tj-final .tj-yourlogo { width: 140px; }
  .tj--lumiere .tj-final__actions { gap: 8px; margin-top: 6px; }
  .tj--lumiere .tj-btn-ghost { min-height: 44px; padding: 9px 18px; font-size: .9rem; }
  .tj--lumiere .tj-final__actions .btn { min-height: 44px; padding: 10px 18px; font-size: .9rem; }
}

/* ==========================================================================
   EMPREINTE : peinture au pendule — interface discrète, l'œuvre au centre
   ========================================================================== */
.tj--empreinte .tj-hint, .tj--empreinte .tj-stick { display: none; }
.tj--empreinte .tj-stage.is-playing .tj-canvas { cursor: default; }
.tj--empreinte .tj-stage.is-playing.is-over-can .tj-canvas { cursor: grab; }
.tj--empreinte .tj-stage.is-grabbing .tj-canvas, .tj--empreinte .tj-stage.is-turning .tj-canvas { cursor: grabbing; }
/* le badge « Votre logo » passe à gauche (à droite : le bouton des vœux) ; masqué en jeu sur petit écran */
.tj--empreinte .tj-brand { left: 14px; right: auto; }
.tj--empreinte .tj-stage.em-revealing .tj-brand { opacity: 0; }
@media (max-width: 900px) { .tj--empreinte .tj-stage.is-playing .tj-brand { opacity: 0; } }
.em-start__q { margin: 0; max-width: 18ch; font-size: clamp(1.6rem, 1rem + 2.6vw, 3rem); font-weight: 600; letter-spacing: -.035em; line-height: 1.05; text-wrap: balance; text-shadow: 0 2px 24px rgba(5, 6, 26, .8); }

/* introduction (avant le premier lancer) : la question en haut, la consigne en bas */
.em-intro { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.em-intro__q, .em-intro__how { position: absolute; left: 0; right: 0; margin: 0; padding: 0 6%; text-align: center; opacity: 0; transform: translateY(10px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.em-intro__q { top: clamp(58px, 9%, 84px); font-size: clamp(1.25rem, .8rem + 2.1vw, 2.4rem); font-weight: 600; letter-spacing: -.025em; line-height: 1.12; text-wrap: balance; text-shadow: 0 2px 18px rgba(5, 6, 26, .85); }
.em-intro__how { bottom: 82px; display: grid; justify-items: center; gap: 4px; }
.em-intro__how > span { display: inline-block; padding: 9px 18px; border-radius: 999px; font-size: clamp(.9rem, .85rem + .2vw, 1rem); font-weight: 500; color: var(--gold-l); background: rgba(10, 12, 40, .55); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: inset 0 0 0 1px rgba(255, 196, 102, .35); }
.em-intro__how small { font-size: .8rem; color: rgba(255, 255, 255, .72); text-shadow: 0 1px 8px rgba(0, 0, 0, .6); }
.tj-stage.is-playing.em-waiting .em-intro__q, .tj-stage.is-playing.em-waiting .em-intro__how { opacity: 1; transform: none; }
.tj-stage.em-waiting .tj-msg { opacity: 0; }

/* outils : couleurs, rotation de la toile, relance */
.em-tools {
  position: absolute; left: 50%; bottom: 16px; z-index: 4; display: flex; align-items: center; gap: 8px; padding: 7px 9px;
  border-radius: 999px; background: rgba(10, 12, 40, .5); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
  transform: translate(-50%, 14px); opacity: 0; visibility: hidden; transition: opacity .45s, transform .45s var(--ease), visibility 0s .45s;
}
.tj-stage.is-playing .em-tools { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition: opacity .45s, transform .45s var(--ease); }
.tj-stage.em-revealing .em-tools, .tj-stage.em-revealed .em-tools, .tj-stage.is-final .em-tools { opacity: 0; visibility: hidden; transform: translate(-50%, 14px); }
.em-colours { display: flex; gap: 6px; }
.em-colour {
  width: 28px; height: 28px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  background: radial-gradient(circle at 34% 30%, rgba(255, 255, 255, .55), transparent 42%), var(--c);
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, .3), 0 0 0 1px rgba(255, 255, 255, .18);
  transition: transform .25s var(--ease), box-shadow .25s;
}
.em-colour:hover { transform: translateY(-2px) scale(1.06); }
.em-colour[aria-pressed="true"] { box-shadow: inset 0 -2px 4px rgba(0, 0, 0, .3), 0 0 0 2px #05061A, 0 0 0 4px var(--c), 0 0 16px var(--c); transform: scale(1.08); }
.em-colour:focus-visible, .em-tool:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.em-tools__sep { width: 1px; height: 22px; background: rgba(255, 255, 255, .18); margin: 0 2px; }
.em-tool { position: relative; display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; cursor: pointer; color: #fff; background: transparent; transition: background .2s, color .2s; }
.em-tool:hover { background: rgba(255, 255, 255, .1); }
.em-tool[aria-pressed="true"] { color: var(--navy); background: var(--gold-l); }
.em-tool svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.em-tool__l { position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translate(-50%, 4px); padding: 5px 10px; border-radius: 8px; font-size: .76rem; white-space: nowrap; color: #fff; background: rgba(5, 6, 26, .85); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.em-tool:hover .em-tool__l, .em-tool:focus-visible .em-tool__l { opacity: 1; transform: translate(-50%, 0); }
@media (pointer: coarse) { .em-tool__l { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); opacity: 0; } }

/* « Découvrir vos vœux » : apparaît discrètement quand la composition est assez riche */
.em-reveal {
  position: absolute; right: 16px; bottom: 16px; z-index: 5; display: inline-flex; align-items: center; gap: 10px; cursor: pointer;
  min-height: 46px; padding: 10px 20px; border: 0; border-radius: 999px; font: inherit; font-weight: 600; font-size: .95rem; color: var(--navy);
  background: linear-gradient(120deg, #FFE0A3, var(--gold-l) 45%, var(--gold));
  box-shadow: 0 14px 32px -12px rgba(232, 160, 42, .85), inset 0 0 0 1px rgba(255, 255, 255, .5);
  opacity: 0; visibility: hidden; transform: translateY(10px); transition: opacity .8s var(--ease), transform .8s var(--ease), visibility 0s .8s;
}
.em-reveal__px { width: 8px; height: 8px; border-radius: 2px; background: var(--navy); animation: em-px 1.6s ease-in-out infinite; }
@keyframes em-px { 50% { transform: translateY(-3px) rotate(45deg); opacity: .6; } }
.tj-stage.is-playing.em-ready .em-reveal { opacity: 1; visibility: visible; transform: none; transition: opacity .8s var(--ease), transform .8s var(--ease); }
.em-reveal:hover { box-shadow: 0 18px 40px -12px rgba(232, 160, 42, 1), inset 0 0 0 1px rgba(255, 255, 255, .6); }
.em-reveal:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
@media (max-width: 900px) {
  .em-tools { bottom: 12px; gap: 5px; padding: 6px 7px; }
  .em-colours { gap: 4px; }
  .em-colour { width: 24px; height: 24px; }
  .em-tool { width: 32px; height: 32px; }
  .tj-stage.em-ready .em-tools { transform: translate(-50%, 0); }
  .em-reveal { left: 50%; right: auto; bottom: 62px; transform: translate(-50%, 10px); min-height: 42px; font-size: .9rem; }
  .tj-stage.is-playing.em-ready .em-reveal { transform: translate(-50%, 0); }
  .em-intro__how { bottom: 64px; }
}

/* écran final : l'œuvre reste visible (à gauche, ou au-dessus en portrait), les vœux à côté */
.tj--empreinte .tj-final { background: none; padding: clamp(16px, 3vw, 40px); }
.tj--empreinte .tj-stage.em-side .tj-final { justify-items: end; background: linear-gradient(90deg, transparent 38%, rgba(5, 6, 26, .55) 62%, rgba(5, 6, 26, .78)); }
.tj--empreinte .tj-stage.em-side .tj-final__in { width: 44%; max-width: 560px; }
.tj--empreinte .tj-stage.em-below .tj-final { align-items: end; background: linear-gradient(180deg, transparent 44%, rgba(5, 6, 26, .7) 62%, rgba(5, 6, 26, .9)); }
.tj--empreinte .tj-stage.em-below .tj-final__in { gap: 6px; }
.tj--empreinte .tj-final__title { text-transform: uppercase; letter-spacing: .02em; font-size: clamp(1.9rem, .9rem + 3.6vw, 4.2rem); line-height: 1.02; text-wrap: balance; }
.tj--empreinte .tj-final__msg { text-wrap: balance; }
.tj--empreinte .tj-stage.em-below .tj-yourlogo { width: clamp(170px, 46vw, 240px); }
.tj--empreinte .tj-stage.em-below .tj-final__note { display: none; }
.tj--empreinte .tj-final__actions { align-items: center; }
.em-dl { position: relative; }
.em-dl summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; }
.em-dl summary::-webkit-details-marker { display: none; }
.em-dl summary svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.em-dl__menu { position: absolute; left: 50%; bottom: calc(100% + 8px); z-index: 2; transform: translateX(-50%); display: grid; gap: 4px; min-width: 250px; padding: 6px; border-radius: 16px; background: rgba(10, 12, 40, .92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: 0 18px 40px -14px rgba(0, 0, 0, .7), inset 0 0 0 1px rgba(255, 255, 255, .12); }
.em-dl__menu button { display: grid; gap: 2px; text-align: left; padding: 10px 14px; border: 0; border-radius: 11px; cursor: pointer; font: inherit; font-weight: 500; color: #fff; background: transparent; }
.em-dl__menu button:hover, .em-dl__menu button:focus-visible { background: rgba(255, 255, 255, .1); outline: none; }
.em-dl__menu button[aria-busy="true"] { opacity: .6; cursor: progress; }
.em-dl__menu small { font-size: .74rem; font-weight: 400; color: rgba(255, 255, 255, .62); }
.em-credit { margin: 14px 0 0; font-size: .8rem; color: var(--muted); }
.em-credit a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.em-credit a:hover { color: var(--violet); }
.em-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 960px) { .em-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .em-cards { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .em-reveal__px { animation: none; } }
/* EMPREINTE, portrait : l'œuvre en haut, les vœux et les boutons serrés en bas */
.tj--empreinte .tj-stage.em-below .tj-final { padding: 12px 14px 14px; }
.tj--empreinte .tj-stage.em-below .tj-final__msg { font-size: .92rem; }
.tj--empreinte .tj-stage.em-below .tj-final__title { font-size: clamp(1.55rem, 1rem + 3vw, 2.4rem); }
.tj--empreinte .tj-stage.em-below .tj-final__logo { margin-top: 2px; }
.tj--empreinte .tj-stage.em-below .tj-yourlogo { width: clamp(150px, 40vw, 210px); }
.tj--empreinte .tj-stage.em-below .tj-final__actions { gap: 8px; margin-top: 6px; }
.tj--empreinte .tj-stage.em-below .tj-btn-ghost { min-height: 42px; padding: 9px 16px; font-size: .9rem; }
.tj--empreinte .tj-stage.em-below .tj-final__actions .btn { min-height: 44px; padding: 10px 18px; font-size: .9rem; flex-basis: 100%; justify-content: center; }

/* ---------- lien et mode « démo plein écran » (/modeles/<slug>/?plein-ecran) ---------- */
.tj-under__actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.tj-demo-link svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
html.tj-demo, html.tj-demo body { height: 100%; overflow: hidden; overscroll-behavior: none; }
html.tj-demo body > *:not(main):not(script):not(dialog) { display: none !important; }
html.tj-demo main > *:not(#jouer) { display: none !important; }
html.tj-demo .tj-stage { position: fixed; inset: 0; z-index: 200; width: 100%; height: 100%; height: 100dvh; max-height: none; aspect-ratio: auto; border-radius: 0; box-shadow: none; }
html.tj-demo [data-tj-fs] { display: none !important; }
