@font-face { font-family: Bagel; src: url(../assets/fonts/bagel.woff2) format('woff2'); font-display: block; }
@font-face { font-family: Familjen; src: url(../assets/fonts/familjen.woff2) format('woff2'); font-weight: 400 700; font-display: swap; }
@font-face { font-family: Sedgwick; src: url(../assets/fonts/sedgwick.woff2) format('woff2'); font-display: block; }
:root {
  --rose: #ee9193; --encre: #4a0a1b; --encre2: #6b1027; --jaune: #ffc223; --jaune-b: #c67d00; --tomate: #e2231a; --papier: #f5f2ee;
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px); --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px);
  --clavier: 0px; --sort: cubic-bezier(.23, 1, .32, 1); color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; background: var(--rose); color: var(--encre); font: 500 17px/1.35 Familjen, sans-serif; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { position: fixed; inset: 0; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
button, input { font: inherit; color: inherit; } button { border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; }
[hidden] { display: none !important; }
svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; }
.lu { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--encre); outline-offset: 3px; border-radius: 8px; }
#monde, #defile, #atelier, #sortie, #ouvert, #eclair, #voile { position: fixed; inset: 0; }
#monde { z-index: 0; } #toile { width: 100%; height: 100%; display: block; }
#defile { z-index: 1; overflow: hidden auto; overscroll-behavior: contain; touch-action: pan-y; scrollbar-width: none; outline: none; } #defile::-webkit-scrollbar { display: none; }
#cale { width: 100%; pointer-events: none; }
#table-vide { visibility: hidden; pointer-events: none; position: fixed; z-index: 1; inset: 0 auto auto 0; display: grid; place-items: center; width: clamp(146px, 14vw, 208px); aspect-ratio: 7.2 / 8.9; margin: 0; padding: 18px; border: 1.5px dashed #561627a6; border-radius: 2px; background: #ffe4c96b; text-align: center; text-wrap: balance; font: clamp(1.5rem, 2.5vw, 2rem)/1.15 Sedgwick, sans-serif; color: #390715; }
body[data-etat='table'] #table-vide.dans-le-cadre { visibility: visible; }
body.galerie-active .compte-bar a { box-shadow: inset 0 0 0 1px var(--encre); }
body:not([data-etat='table']) #defile { overflow: hidden; pointer-events: none; }

/* touches : de vraies touches, en plastique */
.touche { min-height: 60px; padding: 0 30px 3px; border-radius: 30px; background: var(--jaune); color: var(--encre); font-weight: 700; font-size: 20px; letter-spacing: -.01em;
  box-shadow: inset 0 2px 1px #fff3c2, inset 0 -5px 0 #f0a400, 0 6px 0 var(--jaune-b), 0 8px 3px rgba(74, 10, 27, .25), 7px 18px 22px rgba(74, 10, 27, .32); transform: translateY(0); transition: transform .12s var(--sort), box-shadow .12s var(--sort); }
.touche:active { transform: translateY(5px); box-shadow: inset 0 2px 1px #fff3c2, inset 0 -3px 0 #f0a400, 0 1px 0 var(--jaune-b), 0 2px 2px rgba(74, 10, 27, .3), 3px 6px 8px rgba(74, 10, 27, .3); }
.lien { min-height: 52px; padding: 0 18px; font-weight: 700; font-size: 18px; } .lien:active { opacity: .6; }
.rond { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; } .rond:active { transform: scale(.92); }

#accueil { position: fixed; z-index: 2; left: 0; right: 0; bottom: calc(20px + var(--sb)); display: grid; justify-items: center; pointer-events: none; transition: opacity .25s, transform .35s var(--sort); }
#accueil .touche { pointer-events: auto; }
body:not([data-etat='table']) #accueil { opacity: 0; transform: translateY(40px); visibility: hidden; transition: opacity .2s, transform .3s var(--sort), visibility 0s .3s; }

/* ---------- atelier */
#atelier { z-index: 3; padding: var(--st) 0 var(--sb); pointer-events: none; }
#atelier > * { pointer-events: auto; }
#atelier .haut { position: absolute; left: calc(6px + var(--sl)); right: calc(148px + var(--sr)); top: calc(2px + var(--st)); display: flex; align-items: center; gap: 4px; transition: opacity .3s; }
#atelier .haut button { flex: none; }
#atelier .haut #source-atelier { flex: 0 1 auto; min-width: 0; min-height: 44px; padding: 2px 8px; border-radius: 12px; background: #fff0dd; font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
@media (max-width: 480px) {
  #atelier .haut:has(#rafale:not([hidden])) { right: calc(132px + var(--sr)); }
  #atelier .haut:has(#rafale:not([hidden])) .source-detail { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}
#bouton-son[aria-pressed='true'] .muet, #bouton-son[aria-pressed='false'] .onde { display: none; }
#depoli { position: absolute; opacity: 0; transition: opacity .16s; pointer-events: none; }
[data-etat='atelier'] #depoli { opacity: 1; pointer-events: auto; }
body:not([data-etat='atelier']) #atelier .haut, body:not([data-etat='atelier']) #atelier .surface { opacity: 0; pointer-events: none; }
#vitre { position: absolute; inset: 0; overflow: hidden; border-radius: var(--r, 30px); background: #191517; touch-action: none; isolation: isolate; cursor: default; }
#photo, #video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; } #video { transform: scaleX(-1); }
#calque { position: absolute; inset: 0; }
.pose { position: absolute; left: 0; top: 0; will-change: transform; pointer-events: none; -webkit-user-drag: none; max-width: none; }
.pose:focus-visible { outline: 2px dashed #fff; outline-offset: 2px; }
.pose.choisi { animation: cerne .9s; } .pose.partant { opacity: .45; }
@keyframes cerne { 0% { filter: brightness(1.16); } 100% { filter: brightness(1); } }
.reflet { position: absolute; inset: 0; pointer-events: none; z-index: 9000; border-radius: inherit; box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, .55), inset 0 10px 22px rgba(0, 0, 0, .28), inset 0 0 40px rgba(20, 4, 8, .18); background: linear-gradient(116deg, rgba(255, 255, 255, .13) 0 17%, rgba(255, 255, 255, .03) 17.3% 24%, transparent 24.4%); }
.coins { position: absolute; inset: 22%; pointer-events: none; z-index: 9001; opacity: 0; transform: scale(1.14); transition: opacity .12s, transform .18s var(--sort); --c: #fff;
  background: linear-gradient(var(--c), var(--c)) 0 0/26px 3px, linear-gradient(var(--c), var(--c)) 0 0/3px 26px, linear-gradient(var(--c), var(--c)) 100% 0/26px 3px, linear-gradient(var(--c), var(--c)) 100% 0/3px 26px, linear-gradient(var(--c), var(--c)) 0 100%/26px 3px, linear-gradient(var(--c), var(--c)) 0 100%/3px 26px, linear-gradient(var(--c), var(--c)) 100% 100%/26px 3px, linear-gradient(var(--c), var(--c)) 100% 100%/3px 26px; background-repeat: no-repeat; }
.vise .coins { opacity: 1; transform: none; }
#pince { position: absolute; left: 0; top: 0; width: 44px; height: 44px; touch-action: none; display: grid; place-items: center; cursor: nwse-resize; }
#pince::before { content: ''; width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 5px solid var(--tomate); box-shadow: 0 2px 6px rgba(0, 0, 0, .45); }
.surface { position: absolute; border-radius: 50%; display: grid; place-items: center; color: #f5ece8; touch-action: none; transition: opacity .25s; }
.surface svg { width: 24px; height: 24px; } #ranger:disabled svg { opacity: .32; } #declencher { cursor: pointer; }
.i-acc, .bac-photos .i-photos { display: none; } .bac-photos .i-acc { display: block; }

#plateau { position: absolute; transition: opacity .3s .05s, transform .5s var(--sort) .05s; }
body:not([data-etat='atelier']) #plateau { opacity: 0; transform: translateY(50px); pointer-events: none; }
.bac { display: flex; gap: 14px; height: 100%; align-items: center; overflow: auto hidden; padding: 0 20px; touch-action: pan-x; scrollbar-width: none; overscroll-behavior-x: contain; animation: arrive .3s var(--sort); } .bac::-webkit-scrollbar { display: none; }
@keyframes arrive { from { opacity: 0; transform: translateX(24px); } }
.acc { flex: 0 0 var(--acc, 84px); height: var(--acc, 84px); display: grid; grid-template: 100% / 100%; place-items: center; transform: rotate(var(--a)); touch-action: pan-x; cursor: grab; }
.acc img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; -webkit-user-drag: none; filter: drop-shadow(5px 7px 4px rgba(74, 10, 27, .22)); }
.mini { flex: 0 0 66px; height: 80px; background: var(--papier); padding: 4px 4px 13px; transform: rotate(var(--a)); box-shadow: 1px 1px 1px rgba(74, 10, 27, .3), 6px 9px 10px rgba(74, 10, 27, .32); transition: transform .2s var(--sort); }
.mini img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; } .mini[aria-pressed='true'] { transform: rotate(0) translateY(-7px) scale(1.06); }
.op { flex: 0 0 auto; min-width: 76px; height: 80px; display: grid; place-items: center; align-content: center; gap: 4px; font-size: 15px; font-weight: 600; white-space: nowrap; color: var(--encre); } .op svg { width: 32px; height: 32px; }
/* deux rangs, en vrac : un accessoire sur deux descend un peu */
.deux-rangs .bac { display: grid; grid-auto-flow: column; grid-template-rows: auto auto; grid-auto-columns: max-content; align-content: center; justify-content: start; gap: 10px 18px; padding: 0 22px; }
.deux-rangs .acc { width: var(--acc); } .deux-rangs .acc:nth-child(4n+3), .deux-rangs .acc:nth-child(4n) { translate: 12px 5px; }
.deux-rangs .mini { width: 84px; height: 102px; padding: 5px 5px 16px; } .deux-rangs .op { height: 102px; min-width: 92px; }
.range #plateau { transform: translateY(-4px); }

/* ---------- sortie du papier */
#sortie, #ouvert { z-index: 4; touch-action: none; padding: var(--st) 0 var(--sb); }
#sortie > *, #ouvert > * { position: absolute; }
#sortie .bas, #legender, #consigne, #tire { opacity: 0; pointer-events: none; transition: opacity .3s, transform .4s var(--sort); transform: translateY(14px); }
#tire { transform: none; transition: none; min-width: 44px; min-height: 44px; cursor: grab; }
#tire span { position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translateX(-50%); color: var(--encre); background: var(--papier); border-radius: 22px; padding: 7px 13px; font-size: 16px; font-weight: 600; white-space: nowrap; }
.tirable #tire { opacity: 1; pointer-events: auto; } .tirable #tire:focus-visible { outline-color: #fff; }
.traction #tire span { visibility: hidden; }
.tenue #sortie .bas, .tenue #legender { opacity: 1; pointer-events: auto; transform: none; transition-delay: .35s; }
.tenue #consigne { opacity: 1; transform: none; transition-delay: .6s; }
#consigne { left: 0; right: 0; top: calc(18px + var(--st)); margin: 0; text-align: center; font: 27px/1 Sedgwick, cursive; color: #fff; pointer-events: none; }
@media (max-width: 500px) { #consigne { top: calc(60px + var(--st)); } }
#legender { left: 24px; right: 24px; bottom: calc(96px + var(--sb) + var(--clavier) * .8); display: grid; justify-items: center; }
#legender input, #repondre input { width: 100%; max-width: 340px; height: 50px; border: 0; border-radius: 0; background: none; text-align: center; font: 28px/1 Sedgwick, cursive; color: #fff; border-bottom: 2px solid rgba(255, 255, 255, .75); outline: none; -webkit-user-select: text; user-select: text; }
#legender input::placeholder, #repondre input::placeholder { color: rgba(255, 255, 255, .82); }
#sortie .bas { left: 14px; right: 14px; bottom: calc(22px + var(--sb)); display: flex; justify-content: center; align-items: center; gap: 4px; color: #fff; }
#sortie .bas .touche { flex: 0 1 auto; padding-inline: 24px; }

/* ---------- tirage ouvert */
#ouvert { color: #fff; } #ouvert > * { animation: monte .4s var(--sort) .12s backwards; }
@keyframes monte { from { opacity: 0; transform: translateY(16px); } }
#indice { left: 0; right: 0; top: calc(20px + var(--st)); margin: 0; text-align: center; font: 27px/1 Sedgwick, cursive; color: #fff; pointer-events: none; visibility: hidden; } .a-frotter:not(.au-dos) #indice { visibility: visible; animation-delay: 1.1s; }
#fermer { right: calc(8px + var(--sr)); top: calc(6px + var(--st)); color: #fff; }
#ouvert .actions { left: 0; right: 0; bottom: calc(14px + var(--sb)); display: flex; justify-content: center; gap: 6px; }
#partager { text-decoration:none; }
#gif-ouvert { position:absolute; transform:translate(-50%,-40%); pointer-events:none; height:auto; }
#rafale { min-height:44px; padding:0 10px; }
#rafale[aria-pressed=true] { background:#ffe363; color:#471222; border-radius:22px; }
@media(max-width:500px){#ouvert .act{min-width:0;padding-inline:5px}}
.act { min-width: 84px; min-height: 60px; padding: 4px 8px; display: grid; justify-items: center; align-content: center; gap: 3px; font-size: 15px; font-weight: 600; white-space: nowrap; } .act:active { opacity: .7; }
#aimer[aria-pressed='true'] svg { fill: #ff4436; stroke: #ff4436; }
#repondre { left: 24px; right: 24px; bottom: calc(84px + var(--sb) + var(--clavier) * .85); display: flex; justify-content: center; gap: 8px; } #repondre input { text-align: left; max-width: 300px; }
.rond.plein { background: var(--jaune); color: var(--encre); flex: none; }
.sur { color: #ffd0c8; }

#eclair { z-index: 20; background: radial-gradient(ellipse at var(--flash-x, 50%) var(--flash-y, 45%), #fffdf6e8 0%, #fff8ecc2 15%, #fff8ec61 35%, transparent 69%); opacity: 0; pointer-events: none; }
#voile { z-index: 30; background: var(--rose); display: grid; place-items: center; transition: opacity .6s var(--sort); pointer-events: none; } #voile b { font: 400 64px/1 Bagel, sans-serif; color: #7d1226; } #voile.parti { opacity: 0; }
#voile p { max-width: 20em; padding: 24px; font-size: 20px; text-align: center; }
.sansjs { position: fixed; inset: auto 20px 20px; z-index: 40; }

@media (min-aspect-ratio: 95/100) {
  #accueil { left: auto; right: 11vw; bottom: 7vh; justify-items: start; }

  #plateau .bac { flex-wrap: wrap; align-content: safe center; justify-content: center; gap: 22px 26px; overflow: hidden auto; touch-action: pan-y; padding: 20px; }
  .acc { flex-basis: 128px; height: 124px; touch-action: none; } .mini { flex-basis: 98px; height: 120px; padding: 6px 6px 19px; } .op { min-width: 98px; height: 104px; font-size: 17px; }
  #atelier .haut { left: 24px; right: auto; max-width: calc(100% - 160px); top: 16px; gap: 12px; } #ouvert .actions { gap: 22px; }
}
@media (hover: hover) and (pointer: fine) { .acc { transition: transform .2s var(--sort); } .acc:hover { transform: rotate(0) scale(1.08); } .mini:hover { transform: rotate(0) translateY(-4px); } .rond:hover, .act:hover, .lien:hover { opacity: .75; } .touche:hover { filter: brightness(1.04); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: opacity .2s !important; } }
