/* =========================================================
   LMDB World — la carte-monde
   ========================================================= */
body[data-layout="world"] { overflow: hidden; }
body[data-layout="world"].world-trail { overflow-x: hidden; overflow-y: auto; }

.world {
  position: fixed; inset: 0;
  overflow: hidden;
  background:
    radial-gradient(70% 60% at 50% 42%, #10241F 0%, #0B1716 45%, var(--sea-0) 100%);
  touch-action: none;
  user-select: none; -webkit-user-select: none;
}
.world[data-mode="trail"] { position: relative; inset: auto; min-height: 100svh; overflow: visible; touch-action: pan-y pinch-zoom; background: none; isolation: isolate; display: flex; flex-direction: column; }
.world[data-mode="trail"] .world-head { order: -1; }
.world[data-mode="trail"] .world-guest { order: 2; }
.world[data-mode="trail"]::before { content: ''; position: fixed; inset: 0; z-index: -1; background: radial-gradient(90% 60% at 50% 30%, #10241F 0%, #0B1716 45%, var(--sea-0) 100%); }

.world-sea, .world-fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.world-sea { z-index: 0; }
.world-fx { z-index: 3; }
.world-viewport { position: absolute; inset: 0; z-index: 2; cursor: grab; }
.world.is-dragging .world-viewport { cursor: grabbing; }
.has-cursor .world-viewport { cursor: none; }
.world[data-mode="trail"] .world-viewport { position: relative; inset: auto; cursor: auto; }
.world-stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; --inv: 1; }
.world[data-mode="trail"] .world-stage { position: relative; }
.world-deco { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.world-isles { position: absolute; inset: 0; }
.world-vignette { position: fixed; inset: 0; z-index: 4; pointer-events: none; background: radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(4, 7, 7, 0.75) 100%), linear-gradient(to bottom, rgba(12, 10, 9, 0.7), transparent 22%); }
.world[data-mode="trail"] .world-vignette { background: linear-gradient(to bottom, rgba(12, 10, 9, 0.85), transparent 18%); }

/* ---------- décor ---------- */
.wd-grid path { stroke: rgba(169, 227, 211, 0.06); stroke-width: 1; stroke-dasharray: 2 10; }
.wd-labels text { fill: rgba(169, 227, 211, 0.28); font-family: var(--f-mono); font-size: 13px; text-anchor: middle; }
.wd-route { fill: none; stroke: rgba(236, 234, 227, 0.32); stroke-width: 2.4; stroke-dasharray: 2 12; stroke-linecap: round; animation: route-flow 2.4s linear infinite; }
.wd-route.is-soon { stroke: rgba(155, 140, 255, 0.28); stroke-dasharray: 1 16; animation-duration: 4s; }
.wd-route--trail { stroke: rgba(236, 234, 227, 0.3); stroke-width: 3; }
@keyframes route-flow { to { stroke-dashoffset: -28; } }
.wd-islet-foam { fill: none; stroke: rgba(236, 234, 227, 0.16); stroke-width: 1.2; stroke-dasharray: 2 6; }
.wd-beam { fill: rgba(255, 210, 122, 0.06); transform-box: fill-box; transform-origin: 100% 53%; animation: beam 7s ease-in-out infinite; }
@keyframes beam { 0%, 100% { transform: rotate(-12deg); opacity: .5; } 50% { transform: rotate(16deg); opacity: 1; } }
.wd-lamp { fill: #FFD27A; animation: lamp 2.4s ease-in-out infinite; }
@keyframes lamp { 50% { fill: #FFF3D6; filter: drop-shadow(0 0 8px #FFD27A); } }
.wd-serpent { animation: serpent 9s ease-in-out infinite; opacity: .8; }
@keyframes serpent { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-30px, 6px); } }
.wd-rose-ring { fill: rgba(12, 10, 9, 0.45); stroke: rgba(236, 234, 227, 0.22); stroke-width: 1.2; }
.wd-rose-ring2 { fill: none; stroke: rgba(236, 234, 227, 0.12); stroke-width: 1; stroke-dasharray: 2 4; }
.wd-rose-n { fill: var(--accent); font-family: var(--f-mono); font-size: 14px; text-anchor: middle; }
.wd-cartouche rect { fill: rgba(12, 10, 9, 0.62); stroke: rgba(236, 234, 227, 0.25); stroke-width: 1; }
.wd-cartouche .wd-cartouche-in { fill: none; stroke: rgba(242, 116, 23, 0.4); stroke-dasharray: 3 4; }
.wd-cartouche-t { fill: var(--paper); font-family: var(--f-display); font-weight: 600; font-size: 15px; text-anchor: middle; letter-spacing: -0.01em; }
.wd-cartouche-s { fill: var(--muted); font-family: var(--f-mono); font-size: 10px; text-anchor: middle; text-transform: uppercase; }
.wd-start-dot { fill: var(--accent); stroke: var(--ink); stroke-width: 3; }
.wd-start text { fill: var(--paper); font-family: var(--f-mono); font-size: 11px; text-anchor: middle; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- îles ---------- */
.isle-wrap {
  position: absolute; left: 0; top: 0;
  width: var(--isle-w, 340px);
  translate: -50% -58%;
  display: flex; flex-direction: column; align-items: center;
  pointer-events: none;
  z-index: 1;
}
.isle {
  position: relative; display: block; width: 100%; aspect-ratio: 400 / 300;
  pointer-events: none; border-radius: 40%;
}
.isle-art { position: absolute; inset: 0; display: block; pointer-events: none; transition: transform .6s var(--ease), filter .6s var(--ease); }
.isle-art svg { width: 100%; height: 100%; overflow: visible; }
/* zone cliquable : la surface de l'île (pas le halo) */
.isle::before { content: ''; position: absolute; left: 10%; right: 10%; top: 6%; bottom: 8%; border-radius: 50%; pointer-events: auto; }
.isle:hover .isle-art, .isle:focus-visible .isle-art, .isle.is-selected .isle-art { transform: translateY(-8px) scale(1.02); }
.isle:hover .isl-glow, .isle:focus-visible .isl-glow, .isle.is-selected .isl-glow { opacity: 1; }
.isle:focus-visible { outline: none; }
.isle:focus-visible::after { content: ''; position: absolute; left: 6%; right: 6%; top: 10%; bottom: 4%; border-radius: 50%; outline: 2px dashed var(--accent-isle, var(--accent)); outline-offset: 6px; }
.isle.is-soon .isle-art { filter: saturate(.55) brightness(.82); }
.isle.is-soon:hover .isle-art { filter: saturate(.7) brightness(.95); }
.isle-perch { position: absolute; left: 34%; right: 34%; top: 47%; height: 2px; pointer-events: none; }

.isle-plate {
  margin-top: -4%;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 12px 7px 10px; border-radius: 100px;
  background: rgba(12, 10, 9, 0.86); border: 1px solid var(--line-2);
  transform: scale(clamp(0.9, var(--inv, 1), 1.6)); transform-origin: 50% 0;
  white-space: nowrap;
  transition: border-color .4s, background-color .4s;
}
.isle-plate b { font-family: var(--f-display); font-weight: 600; font-size: 17px; letter-spacing: -0.02em; }
.isle-num { color: var(--accent-isle, var(--accent)); font-size: 11px; }
.isle-plate .chip { padding: 4px 8px; font-size: 10px; }
.isle-wrap:has(.isle:hover) .isle-plate, .isle-wrap:has(.isle:focus-visible) .isle-plate, .isle-wrap:has(.is-selected) .isle-plate { border-color: var(--accent-isle, var(--accent)); background: rgba(20, 17, 16, 0.92); }
.world[data-mode="trail"] .isle-plate { transform: none; }

/* animations des îles */
.isl-glow { opacity: .78; transition: opacity .6s; }
@keyframes isl-glow { 50% { transform: scale(1.05); } }
.isl-foam { animation: foam 3.2s linear infinite; }
@keyframes foam { to { stroke-dashoffset: -48; } }
.isl-ripple { transform-box: fill-box; transform-origin: center; animation: ripple 4s ease-out infinite; }
@keyframes ripple { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(1.14); opacity: 0; } }
.isl-flag { transform-box: fill-box; transform-origin: 0 50%; animation: flag 1.6s ease-in-out infinite; }
@keyframes flag { 50% { transform: scaleX(.82) skewY(-6deg); } }
.isl-pulse { transform-box: fill-box; transform-origin: center; animation: wp-pulse 2.2s ease-out infinite; }
@keyframes wp-pulse { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }
.isl-portal-glow { transform-box: fill-box; transform-origin: center; animation: portal 3.4s ease-in-out infinite; }
@keyframes portal { 50% { transform: scale(1.12); opacity: .7; } }
.isl-glyph { font-family: var(--f-display); font-weight: 800; font-size: 26px; animation: glyph 3.4s ease-in-out infinite; }
@keyframes glyph { 50% { opacity: .55; } }
.isl-crystal { animation: crystal 4s ease-in-out infinite; }
@keyframes crystal { 50% { opacity: .75; } }
.isl-smoke circle { transform-box: fill-box; transform-origin: center; animation: smoke 5s ease-in-out infinite; }
.isl-smoke circle:nth-child(2) { animation-delay: -1.6s; }
.isl-smoke circle:nth-child(3) { animation-delay: -3.2s; }
@keyframes smoke { 0% { transform: translateY(8px) scale(.7); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(-14px) scale(1.3); opacity: 0; } }
.isl-lava { animation: lava 1.8s ease-in-out infinite; }
@keyframes lava { 50% { opacity: .65; } }
.isl-blink { animation: win-blink 3.6s steps(1) infinite; }
@keyframes win-blink { 40% { opacity: .15; } 60% { opacity: 1; } }
.isl-beacon { animation: lamp 1.4s ease-in-out infinite; }
.isl-water { animation: water 3s ease-in-out infinite; }
@keyframes water { 50% { transform: translateX(14px); opacity: .4; } }
.isl-fog { transform-box: fill-box; transform-origin: center; animation: fog 9s ease-in-out infinite alternate; }
.isl-fog--1 { animation-duration: 12s; animation-delay: -4s; }
.isl-fog--2 { animation-duration: 15s; animation-delay: -8s; }
@keyframes fog { from { transform: translateX(-22px) scale(1); } to { transform: translateX(26px) scale(1.12); } }
.isl-lock { animation: lock 3s ease-in-out infinite; }
@keyframes lock { 50% { transform: translate(200px, 74px); } }
.isle .isl-lock { transform-box: view-box; }

/* ---------- en-tête de la carte ---------- */
.world-head {
  position: absolute; z-index: 6; left: var(--gutter); top: calc(var(--nav-h) + var(--banners-h, 0px) + clamp(12px, 2.4vh, 28px));
  max-width: min(520px, 60vw); pointer-events: none;
  display: flex; flex-direction: column; gap: 6px;
  text-shadow: 0 2px 24px rgba(7, 16, 18, 0.9);
}
.world-title { font-family: var(--f-display); font-weight: 700; font-size: clamp(2.4rem, 4.6vw, 4.4rem); line-height: .9; letter-spacing: -0.05em; outline: none; }
.world-lead { color: var(--paper-dim); font-family: var(--f-display); font-weight: 500; font-size: clamp(1rem, 1.25vw, 1.2rem); letter-spacing: -0.01em; max-width: 32ch; }
.world[data-mode="trail"] .world-head { position: relative; left: auto; top: auto; max-width: none; padding: calc(var(--nav-h) + var(--banners-h, 0px) + 18px) var(--gutter) 0; }

/* ---------- HUD ---------- */
.world-hud { position: absolute; z-index: 6; left: var(--gutter); right: var(--gutter); bottom: 22px; display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; pointer-events: none; }
.world-hud > * { pointer-events: auto; }
.world-cartouche { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(12, 10, 9, 0.66); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: var(--muted); font-size: 10.5px; min-width: 220px; }
.world-cartouche b { color: var(--paper); font-family: var(--f-display); font-weight: 600; font-size: 15px; text-transform: none; letter-spacing: -0.01em; }
.world-controls { display: flex; gap: 8px; align-items: center; }
.world-controls-sep { width: 1px; height: 26px; background: var(--line-2); margin: 0 4px; }
.world[data-mode="trail"] .world-hud { position: fixed; bottom: 14px; left: auto; right: 14px; }
.world[data-mode="trail"] .world-cartouche, .world[data-mode="trail"] [data-zoom] { display: none; }
.world[data-mode="trail"] .world-controls-sep { display: none; }
.world-hint { position: absolute; z-index: 6; left: 50%; bottom: 30px; translate: -50% 0; color: var(--muted); font-size: 10.5px; pointer-events: none; white-space: nowrap; animation: hint-fade 1s 4s var(--ease) forwards; }
@keyframes hint-fade { to { opacity: 0; } }
.world[data-mode="trail"] .world-hint { display: none; }
@media (max-width: 1100px) { .world-hint { display: none; } }

.world-status { position: absolute; z-index: 7; left: 50%; top: 50%; translate: -50% -50%; width: min(460px, calc(100% - 32px)); text-align: center; }
.world-status .alert { text-align: left; align-items: center; }
.world-loading { color: var(--muted); animation: blink-dot 1.6s ease-in-out infinite; }

/* invité */
.world-guest { position: absolute; z-index: 6; left: 50%; bottom: 22px; translate: -50% 0; width: min(600px, calc(100% - 820px)); min-width: 500px; }
.world.has-sheet .world-guest, .world.has-sheet .world-hint { display: none; }
body.sheet-open .rail { opacity: 0; pointer-events: none; }
.world-guest-box { display: grid; grid-template-columns: 1fr auto; gap: 2px 18px; align-items: center; padding: 12px 14px 12px 18px; border-radius: 16px; border: 1px solid var(--line-2); background: rgba(12, 10, 9, 0.8); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.9); }
.world-guest-k { color: var(--accent); font-size: 10.5px; }
.world-guest-box p { grid-column: 1; font-size: 13.5px; line-height: 1.4; color: var(--paper-dim); }
.world-guest-cta { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 8px; }
.world:not([data-mode="trail"]) .world-guest-cta .btn-ghost { display: none; }
@media (max-width: 1359px) { .world:not([data-mode="trail"]) .world-guest { display: none; } }
body[data-layout="world"] .foxy-static { bottom: 150px; }
body[data-layout="world"].world-trail .foxy-static { bottom: 16px; }
.world[data-mode="trail"] .world-guest { display: block; position: relative; left: auto; bottom: auto; translate: none; width: auto; min-width: 0; margin: 0 var(--gutter) 110px; }
.world[data-mode="trail"] .world-guest-box { grid-template-columns: 1fr; }
.world[data-mode="trail"] .world-guest-cta { grid-column: 1; grid-row: auto; margin-top: 10px; flex-wrap: wrap; }

/* ---------- fiche de jeu ---------- */
.sheet {
  --game: var(--accent);
  position: fixed; z-index: 96; top: calc(var(--nav-h) + var(--banners-h, 0px) + 8px); right: 12px; bottom: 12px;
  width: min(460px, 40vw);
  border-radius: 20px; border: 1px solid var(--line-2);
  background: rgba(16, 14, 13, 0.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 40px 120px -30px rgba(0, 0, 0, 0.95);
  display: flex; flex-direction: column;
  user-select: text; -webkit-user-select: text;
  touch-action: auto;
}
.sheet::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; border-radius: 20px 20px 0 0; background: linear-gradient(90deg, var(--game), transparent 75%); z-index: 2; }
.sheet-close { position: absolute; top: 12px; right: 12px; z-index: 3; }
.sheet-scroll { overflow-y: auto; overscroll-behavior: contain; border-radius: inherit; flex: 1; }
.sheet-hero { position: relative; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 20px 20px 0 0; background: radial-gradient(80% 90% at 50% 70%, color-mix(in srgb, var(--game) 22%, #0B1716), #071012 75%); border-bottom: 1px solid var(--line); }
.sheet-hero-art { position: absolute; left: 8%; right: 8%; top: 8%; bottom: -2%; }
.sheet-hero-art svg { width: 100%; height: 100%; overflow: visible; }
.sheet-cover { position: absolute; right: 14px; bottom: 14px; width: 34%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; border: 1px solid var(--line-2); box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.9); }
.sheet-perch { position: absolute; left: 6%; right: 50%; top: 0; height: 2px; }
.sheet-body { padding: 22px 24px 28px; display: flex; flex-direction: column; gap: 14px; }
.sheet-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: 11px; }
.sheet-title { font-family: var(--f-display); font-weight: 700; font-size: clamp(2.4rem, 4vw, 3.6rem); line-height: .92; letter-spacing: -0.045em; outline: none; }
.sheet-tagline { font-family: var(--f-display); font-weight: 500; font-size: 1.3rem; line-height: 1.2; letter-spacing: -0.02em; color: var(--game); }
.sheet-desc { color: var(--paper-dim); }
.sheet-kind { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.sheet-kind svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.sheet-tags .chip { font-size: 10px; }
.sheet-cta { display: flex; flex-direction: column; gap: 10px; padding: 16px 0 4px; border-top: 1px solid var(--line); margin-top: 4px; }
.sheet-cta .btn { align-self: stretch; height: 56px; font-size: 16px; }
.sheet-note { color: var(--muted); font-size: 13px; }
.sheet-passport { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 14px; border: 1px dashed var(--line-2); background: rgba(236, 234, 227, 0.02); }
.sheet-passport h3 { color: var(--muted); font-size: 11px; font-weight: 400; }
.stamp-row { display: flex; align-items: center; gap: 16px; }
.stamp-row p { font-size: 14px; }
.sheet-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.sheet-stats div { padding: 10px 12px; border-radius: 10px; background: rgba(236, 234, 227, 0.04); }
.sheet-stats dt { font-family: var(--f-mono); font-size: 10px; text-transform: uppercase; color: var(--muted); }
.sheet-stats dd { font-family: var(--f-display); font-weight: 600; font-size: 1.25rem; letter-spacing: -0.02em; }

@media (max-width: 900px) {
  .sheet { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: min(calc(100svh - var(--nav-h) - var(--banners-h, 0px) - 10px), 760px); border-radius: 22px 22px 0 0; border-bottom: 0; }
  .sheet::before { border-radius: 22px 22px 0 0; }
  .sheet-hero { aspect-ratio: 16 / 8; border-radius: 22px 22px 0 0; }
  .sheet-body { padding: 18px 18px 28px; }
}

/* tampon du passeport */
.stamp {
  --c: var(--game, var(--accent));
  position: relative; flex-shrink: 0;
  width: 86px; aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center; text-align: center;
  border: 2px solid var(--c); color: var(--c);
  transform: rotate(-9deg);
  box-shadow: inset 0 0 0 4px rgba(12, 10, 9, 0.9), inset 0 0 0 5px var(--c);
  font-family: var(--f-mono); font-size: 8.5px; line-height: 1.25; text-transform: uppercase; letter-spacing: .04em;
  padding: 10px;
}
.stamp b { display: block; font-family: var(--f-display); font-size: 13px; letter-spacing: -0.01em; text-transform: none; line-height: 1; margin: 2px 0; word-break: break-word; }
.stamp.is-empty { --c: var(--line-3); border-style: dashed; color: var(--muted); box-shadow: none; }
.stamp.is-soon { --c: rgba(155, 140, 255, 0.55); border-style: dotted; color: #A99CFF; box-shadow: none; }

/* ---------- liste des jeux ---------- */
.world-list { position: fixed; inset: 0; z-index: 97; display: grid; place-items: center; padding: calc(var(--nav-h) + 12px) var(--gutter) 24px; background: rgba(7, 12, 12, 0.72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); user-select: text; -webkit-user-select: text; touch-action: auto; }
.wl-box { width: min(760px, 100%); max-height: 100%; display: flex; flex-direction: column; border-radius: 20px; border: 1px solid var(--line-2); background: var(--ink-2); box-shadow: 0 40px 120px -30px rgba(0, 0, 0, 0.95); overflow: hidden; }
.wl-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px 16px 22px; border-bottom: 1px solid var(--line); }
.wl-head h2 { font-family: var(--f-display); font-weight: 600; font-size: 1.6rem; letter-spacing: -0.03em; outline: none; }
.wl-list { overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.wl-item { display: grid; grid-template-columns: 120px 1fr auto; gap: 16px; align-items: center; padding: 10px 14px 10px 6px; border-radius: 14px; border: 1px solid var(--line); background: rgba(236, 234, 227, 0.02); transition: border-color .3s; }
.wl-item:hover { border-color: color-mix(in srgb, var(--game) 50%, transparent); }
.wl-art { display: block; aspect-ratio: 400 / 300; }
.wl-art svg { width: 100%; height: 100%; overflow: visible; }
.wl-text { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; min-width: 0; }
.wl-text h3 { font-family: var(--f-display); font-weight: 600; font-size: 1.35rem; letter-spacing: -0.02em; }
.wl-text p { color: var(--muted); font-size: 14px; }
.wl-text .mono { font-size: 10px; }
@media (max-width: 560px) { .wl-item { grid-template-columns: 84px 1fr; } .wl-actions { grid-column: 1 / -1; } .wl-actions .btn { width: 100%; } }

/* ---------- parcours (mobile) ---------- */
.world[data-mode="trail"] .isle::before { left: 6%; right: 6%; }
.world[data-mode="trail"] .isle-wrap { translate: -50% -50%; }

@media (prefers-reduced-motion: reduce) {
  .wd-route, .isl-foam, .isl-ripple, .isl-flag, .isl-pulse, .isl-fog, .isl-smoke circle, .wd-beam, .wd-serpent, .isl-glow { animation: none !important; }
}
