/* ===== Les plans de Garreth (js/garreth.js) =====
   Couches : scène (un seul canvas WebGL), étoffe épinglée avec les plans et carte, bulles, bouton « Passer ». Carte crème unie, arrondie, sans contour. */
dialog#garreth-dialog { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; box-sizing: border-box;
  border: 0; background: #04061a; color: #3a2412; overflow: hidden; cursor: default; }
dialog#garreth-dialog::backdrop { background: rgba(2, 3, 14, .85); }
#garreth-dialog.ga-load > * { visibility: hidden; }
#garreth-dialog canvas { pointer-events: none; }
.ga-gl { position: absolute; left: 0; top: 0; }
.ga-stage { position: absolute; z-index: 2; left: 0; top: 0; bottom: 0; width: var(--ga-stage, 62vw); box-sizing: border-box; padding: 60px 28px 24px;
  display: flex; flex-direction: column; align-items: center; justify-content: safe center; gap: 22px; pointer-events: none; }
.ga-plan { position: relative; width: min(clamp(560px, 50vw, 960px), 100% - 24px); flex: none; opacity: 0; }
.ga-plan.on { opacity: 1; }
.ga-sheet { position: relative; box-sizing: border-box; padding: 40px 44px 44px; display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 10px 18px; transform-origin: 50% 0; filter: drop-shadow(0 16px 22px rgba(0, 0, 0, .6)); }
.ga-cloth { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.ga-cell { position: relative; min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center; }
.ga-pic { position: relative; width: 100%; height: clamp(90px, 18vh, 200px); display: flex; align-items: center; justify-content: center; }
.ga-pic::before { content: ""; position: absolute; left: 50%; top: 50%; height: 108%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 214, 120, .5), rgba(255, 190, 90, .16) 55%, transparent); opacity: 0; transition: opacity .4s; }
.ga-cell.on .ga-pic::before { opacity: 1; }
.ga-pic img { position: relative; width: 90%; height: 90%; object-fit: contain; opacity: 0; }
.ga-cell b { margin-top: 6px; font: normal 20px/1.12 var(--font-title); color: #ffe6ae; text-shadow: 0 2px 3px rgba(0, 0, 20, .8); opacity: 0; transition: opacity .3s; }
.ga-cell small { margin-top: 2px; font-size: 16px; line-height: 1.25; color: #c9cdf4; opacity: 0; transition: opacity .3s; }
.ga-cell.on b, .ga-cell.on small { opacity: 1; }
.ga-knife { position: absolute; z-index: 2; width: 60px; height: 150px; top: -118px; opacity: 0; transform-origin: 50% 98.5%; filter: drop-shadow(0 6px 5px rgba(0, 0, 0, .55)); }
.ga-knife-l { left: -2px; } .ga-knife-r { right: -2px; }
.ga-card { width: min(640px, 100%); flex: none; box-sizing: border-box; padding: 18px 24px; border-radius: 20px; background: #fbf0d8; box-shadow: 0 18px 40px rgba(0, 0, 0, .6); font-size: 16px; line-height: 1.4;
  opacity: 0; visibility: hidden; transform: translateY(18px); transition: opacity .35s, transform .45s cubic-bezier(.2, .9, .3, 1.2); }
.ga-card.on { opacity: 1; visibility: visible; transform: none; pointer-events: auto; }
.ga-card h2 { display: flex; align-items: center; gap: 12px; margin: 0 0 8px; font: normal 25px/1.15 var(--font-title); color: #343a8c; }
.ga-face { height: 52px; width: auto; object-fit: contain; flex: none; }
.ga-body p { margin: 0 0 6px; }
.ga-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.ga-bubble { position: absolute; z-index: 3; left: -999px; top: 0; width: max-content; max-width: min(400px, 34vw); box-sizing: border-box; padding: 15px 22px; border-radius: 18px; background: #fdf3e6; color: #1c1c40; font: normal 23px/1.3 var(--font-title); pointer-events: none;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .55), inset 0 -3px 0 rgba(60, 66, 150, .25); opacity: 0; transform: scale(.5); transform-origin: 0 50%; transition: opacity .18s, transform .32s cubic-bezier(.2, .9, .3, 1.5); }
.ga-bubble.on { opacity: 1; transform: none; }
.ga-bubble::after { content: ""; position: absolute; left: -13px; top: 50%; margin-top: -10px; border: 10px solid transparent; border-left: 0; border-right: 14px solid #fdf3e6; }
.ga-bubble[data-side="b"] { transform-origin: var(--tx, 50%) 100%; }
.ga-bubble[data-side="b"]::after { left: var(--tx, 50%); top: auto; bottom: -13px; margin: 0 0 0 -10px; border: 10px solid transparent; border-bottom: 0; border-top: 14px solid #fdf3e6; }
.ga-hidden { color: transparent; }
.ga-skip { position: absolute; z-index: 4; right: 24px; top: 20px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
.ga-skip[hidden] { display: none; }
#garreth-dialog.ga-done .ga-stage { overflow: hidden auto; pointer-events: auto; }

/* Téléphone et fenêtres hautes : Garreth en buste en haut, étoffe et carte en bas */
.ga-portrait .ga-stage { width: 100%; justify-content: safe flex-end; padding: 16px 14px 16px; gap: 14px; }
.ga-portrait .ga-plan { width: min(620px, 100% - 12px); }
.ga-portrait .ga-sheet { padding: 28px 24px 30px; gap: 6px 10px; }
.ga-portrait .ga-pic { height: clamp(58px, 10vh, 130px); }
.ga-portrait .ga-cell b { margin-top: 3px; font-size: 16px; line-height: 1.06; }
.ga-portrait .ga-knife { width: 40px; height: 100px; top: -80px; }
.ga-portrait .ga-knife-l { left: 8px; } .ga-portrait .ga-knife-r { right: 8px; }
.ga-portrait .ga-card { padding: 14px 16px; }
.ga-portrait .ga-card h2 { font-size: 22px; }
.ga-portrait .ga-face { display: none; }
.ga-portrait .ga-foot .btn { flex: 1 1 auto; }
.ga-portrait .ga-bubble { max-width: calc(100vw - 24px); font-size: 20px; }
.ga-portrait .ga-bubble[data-side="b"]:first-of-type::after { display: none; }
.ga-portrait .ga-skip { right: 12px; top: 12px; }

/* Sans animation (WebGL ou images absents) : l'étoffe et la carte seules */
#garreth-dialog.ga-still { background: radial-gradient(circle at 50% 20%, #3a4786, #14204f 45%, #04061a); }
#garreth-dialog.ga-still > :not(.ga-stage) { display: none; }
#garreth-dialog.ga-still .ga-stage { width: 100%; justify-content: safe center; }
#garreth-dialog.ga-still .ga-pic img { opacity: 1; }
@media (max-height: 860px) {
  .ga-stage { gap: 16px; padding: 48px 24px 14px; }
  .ga-sheet { padding: 28px 38px 34px; gap: 4px 14px; }
  .ga-pic { height: 15.5vh; }
  .ga-cell b { font-size: 18px; margin-top: 3px; }
  .ga-card { padding: 13px 20px; }
  .ga-face { height: 42px; }
  .ga-knife { width: 44px; height: 110px; top: -88px; }
}
@media (max-width: 1500px) { .ga-card { width: min(580px, 100%); } }
@media (prefers-reduced-motion: reduce) { #garreth-dialog .ga-bubble, #garreth-dialog .ga-card, #garreth-dialog .ga-cell b, #garreth-dialog .ga-cell small, #garreth-dialog .ga-pic::before { transition: none !important; } }
html.dark-win #garreth-dialog .ga-card { background: var(--dw-bg); color: var(--dw-ink); color-scheme: dark; }
html.dark-win #garreth-dialog .ga-card h2 { color: #aab2ff; }
html.dark-win #garreth-dialog .ga-bubble { background: var(--dw-bg); color: var(--dw-ink); }
html.dark-win #garreth-dialog .ga-bubble::after { border-right-color: var(--dw-bg); }
html.dark-win #garreth-dialog .ga-bubble[data-side="b"]::after { border-right-color: transparent; border-top-color: var(--dw-bg); }
