/* TILTY kit — styles structurels.
   Les défauts visuels sont en :where() (spécificité 0) : un skin les surcharge sans effort. */

.tg-viewport { position: relative; overflow: hidden; flex: none; }
.tg-stage {
  position: absolute; left: 0; top: 0; transform-origin: 0 0; overflow: hidden;
  user-select: none; -webkit-user-select: none; isolation: isolate; touch-action: manipulation;
}
.tg-stage[data-orient="landscape"] { width: 1600px; height: 900px; }
.tg-stage[data-orient="portrait"] { width: 900px; height: 1600px; }
.tg-stage *, .tg-stage *::before, .tg-stage *::after { box-sizing: border-box; }
.tg-stage button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; -webkit-tap-highlight-color: transparent; }
.tg-stage button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

/* échelle des z-index : 0–30 scène · 40 particules · 50 HUD au-dessus des particules · 60 pop-ins · 70 vols · 80 particules au-dessus de tout · 90 flash */
.tg-shake { position: absolute; inset: 0; }
.tg-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; }
.tg-fxtop { z-index: 80; }
/* calques VFX GPU (kit/vfx.js) : 41 au-dessus de la scène, 81 au-dessus de tout, « under » dans la grille sous les symboles */
.tg-vfx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 41; }
.tg-vfx-top { z-index: 81; }
.tg-vfx-under { inset: -40px; width: calc(100% + 80px); height: calc(100% + 80px); z-index: 0; }
.tg-vfx-host { z-index: auto; }
.tg-vfx-scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.tg-fly { position: absolute; inset: 0; pointer-events: none; z-index: 70; }
.tg-flash { position: absolute; inset: 0; pointer-events: none; z-index: 90; opacity: 0; }

/* grille */
:where(.tg-stage [data-grid]) { position: absolute; }
.tg-colhls, .tg-reels, .tg-labels { position: absolute; inset: 0; }
.tg-colhls { z-index: 0; pointer-events: none; }
.tg-reels { z-index: 1; clip-path: inset(var(--tg-clip-y, -6px) var(--tg-clip-x, -140px)); }
.tg-labels { z-index: 2; pointer-events: none; }
.tg-colhl { position: absolute; top: 0; bottom: 0; }
:where(.tg-colhl) { opacity: 0; transition: opacity .25s; background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, .14)); }
:where(.tg-colhl[data-on="1"], .tg-colhl[data-on="2"]) { opacity: 1; }
.tg-sym { position: absolute; will-change: transform; }
.tg-ghost { position: absolute; margin: 0; }
:where(.tg-sym-in) { position: absolute; inset: var(--tg-sym-pad, 5%); display: grid; place-items: center; transform-origin: 50% 85%; }
:where(.tg-sym-in > svg) { width: 100%; height: 100%; overflow: visible; display: block; }
:where(.tg-sym-in > img.tg-art, [data-art] > img.tg-art) { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; user-select: none; -webkit-user-drag: none; }
:where(.tg-art-val) { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-weight: 800; line-height: 1; white-space: nowrap; pointer-events: none; }

/* animations par défaut des symboles (à surcharger par skin) */
:where(.tg-sym.is-landing .tg-sym-in) { animation: tg-land .3s cubic-bezier(.3, 1.4, .5, 1); }
:where(.tg-sym.is-win .tg-sym-in) { animation: tg-win .5s ease-in-out infinite alternate; }
:where(.tg-sym.is-dim) { opacity: .42; transition: opacity .2s; }
:where(.tg-sym.is-pop .tg-sym-in) { animation: tg-pop .34s ease-in forwards; }
:where(.tg-sym.is-fizzle .tg-sym-in) { animation: tg-fizzle .6s ease-in forwards; }
:where(.tg-sym.is-teasing .tg-sym-in) { animation: tg-tease .5s ease-in-out infinite alternate; }
:where(.tg-sym.is-trigger .tg-sym-in) { animation: tg-trigger .6s ease-in-out infinite alternate; }
:where(.tg-pay) {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap; font-weight: 800; font-size: 34px; color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .6), 0 0 14px rgba(0, 0, 0, .55); animation: tg-pay-in .35s cubic-bezier(.2, 1.6, .4, 1) both;
}
:where(.tg-pay.is-out) { animation: tg-pay-out .35s ease-in forwards; }

/* pop-ins : fermés par défaut, ouverts avec [data-open="true"], en sortie avec [data-open="closing"] */
:where(.tg-stage [data-popup]) {
  position: absolute; inset: 0; z-index: 60; display: grid; place-items: center;
  visibility: hidden; opacity: 0; pointer-events: none; transition: opacity .3s, visibility 0s .3s;
}
:where(.tg-stage [data-popup][data-open]) { visibility: visible; opacity: 1; pointer-events: auto; transition: opacity .3s; }
:where(.tg-stage [data-popup][data-open="closing"]) { opacity: 0; pointer-events: none; }

@keyframes tg-land { 0% { transform: scale(1.12, .84); } 55% { transform: scale(.96, 1.05); } 100% { transform: none; } }
@keyframes tg-win { from { transform: scale(1); } to { transform: scale(1.12); } }
@keyframes tg-pop { 40% { transform: scale(1.3); opacity: 1; } 100% { transform: scale(.2); opacity: 0; } }
@keyframes tg-fizzle { 30% { transform: scale(1.08) rotate(-4deg); } 100% { transform: scale(.7) translateY(12%); opacity: .25; filter: grayscale(1); } }
@keyframes tg-tease { from { transform: scale(1); } to { transform: scale(1.1); } }
@keyframes tg-trigger { from { transform: scale(1) rotate(-5deg); } to { transform: scale(1.22) rotate(5deg); } }
@keyframes tg-pay-in { from { transform: translate(-50%, -20%) scale(.4); opacity: 0; } }
@keyframes tg-pay-out { to { transform: translate(-50%, -140%); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .tg-stage *, .tg-stage *::before, .tg-stage *::after { animation-iteration-count: 1 !important; }
}
