:root {
  color-scheme: dark;
  --night: #192c68;
  --blue: #263f86;
  --sky: #90baf1;
  --pink: #f3a6d4;
  --lilac: #d5c5ff;
  --ink: #f8eaff;
  --muted: rgba(241, 229, 255, .75);
  --line: rgba(230, 220, 255, .32);
  --sans: "Manrope", "DM Sans", system-ui, sans-serif;
  --header-h: 66px;
  --footer-h: 64px;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; height: 100dvh; margin: 0; overflow: hidden; }
body { position: relative; color: var(--ink); background: var(--night); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--pink); outline-offset: 4px; }
::selection { color: #142759; background: var(--pink); }

.sky { position: fixed; z-index: -2; inset: 0; background: linear-gradient(115deg, rgba(25, 44, 104, .74), rgba(69, 94, 174, .44) 48%, rgba(91, 62, 141, .5)), url("images/pays-imaginaire.jpg") center 45% / cover no-repeat; transform: scale(1.02); }
.sky::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 76% 18%, rgba(246, 172, 220, .2), transparent 35%), linear-gradient(180deg, rgba(15, 31, 79, .2), rgba(30, 50, 116, .46)); }

.topbar { position: fixed; z-index: 20; inset: 0 0 auto; height: var(--header-h); display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(17px, 4vw, 56px); background: linear-gradient(180deg, rgba(20, 37, 91, .5), rgba(20, 37, 91, .12)); border-bottom: 1px solid rgba(229, 220, 255, .16); backdrop-filter: blur(16px); }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-size: 12px; font-weight: 800; letter-spacing: .11em; white-space: nowrap; text-decoration: none; }
.brand i { color: var(--pink); font-style: normal; font-weight: 500; letter-spacing: 0; }
.brand-star { color: #f6c5ef; font-size: 20px; text-shadow: 0 0 20px rgba(255, 198, 244, .85); }
.top-nav { position: absolute; left: 50%; top: 50%; display: flex; align-items: center; gap: clamp(16px, 3vw, 43px); transform: translate(-50%, -50%); white-space: nowrap; }
.top-nav button, .top-next { border: 0; background: transparent; color: rgba(247, 237, 255, .79); cursor: pointer; font-size: 11px; font-weight: 600; transition: color .2s ease; }
.top-nav button:hover, .top-next:hover { color: var(--pink); }
.top-nav button span { margin-left: 4px; color: var(--pink); font-size: 10px; }
.top-next { padding: 9px 13px; border: 1px solid rgba(240, 224, 255, .32); border-radius: 99px; }
.top-next span { margin-left: 8px; color: var(--pink); }

.story-rail { position: relative; z-index: 1; display: flex; align-items: stretch; gap: clamp(12px, 1.35vw, 20px); width: 100%; height: calc(100dvh - var(--header-h) - var(--footer-h)); margin-top: var(--header-h); padding: 10px 6vw 12px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scroll-behavior: smooth; scroll-snap-type: x mandatory; scroll-padding-inline: 6vw; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.story-rail::-webkit-scrollbar { display: none; }
.memories-track, .future-track { display: contents; }
.story-slide { position: relative; flex: 0 0 min(84vw, 1190px); height: 100%; overflow: hidden; scroll-snap-align: center; scroll-snap-stop: always; border: 1px solid rgba(237, 225, 255, .24); border-radius: clamp(18px, 2.2vw, 30px); box-shadow: 0 20px 70px rgba(14, 28, 75, .24); }
.welcome-slide { display: flex; align-items: center; background: linear-gradient(100deg, rgba(24, 43, 105, .68), rgba(55, 70, 145, .2) 72%, rgba(91, 57, 130, .3)), url("images/pays-imaginaire.jpg") center 48% / cover no-repeat; }
.welcome-slide::after, .ending-slide::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(0deg, rgba(22, 38, 94, .55), transparent 35%); }
.welcome-copy { position: relative; z-index: 2; width: min(740px, 75%); padding: 0 clamp(30px, 8vw, 110px); margin-top: -2vh; text-shadow: 0 3px 30px rgba(23, 38, 92, .35); }
.overline { margin: 0 0 16px; color: rgba(250, 238, 255, .88); font-size: clamp(9px, 1vw, 12px); font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.sparkle { margin-right: 8px; color: var(--pink); text-shadow: 0 0 18px var(--pink); }
.welcome-copy h1, .ending-copy h2 { margin: 0; color: #fff0fb; font-size: clamp(46px, 8.2vw, 108px); font-weight: 700; line-height: .99; letter-spacing: -.075em; text-wrap: balance; }
.welcome-copy h1 em, .ending-copy h2 em { display: inline-block; padding-right: .08em; color: #efb3e5; font-style: normal; font-weight: 500; }
.begin-button { display: inline-flex; align-items: center; gap: 20px; margin-top: clamp(22px, 5vh, 42px); padding: 12px 19px; border: 1px solid rgba(250, 234, 255, .48); border-radius: 99px; background: rgba(40, 61, 135, .43); color: #fff2ff; cursor: pointer; font-size: 12px; font-weight: 700; backdrop-filter: blur(10px); transition: background .2s, border-color .2s, transform .2s; }
.begin-button:hover { border-color: var(--pink); background: rgba(176, 111, 185, .34); transform: translateY(-2px); }
.begin-button span { color: #f3b0df; font-size: 17px; line-height: .6; }
.welcome-foot { position: absolute; z-index: 2; right: clamp(24px, 4vw, 55px); bottom: 25px; left: clamp(24px, 4vw, 55px); display: flex; justify-content: space-between; color: rgba(248, 237, 255, .77); font-size: 9px; font-weight: 700; letter-spacing: .15em; }
.welcome-foot b { margin-left: 9px; color: var(--pink); font-size: 13px; }
.floating-heart { position: absolute; z-index: 1; color: rgba(255, 216, 247, .82); text-shadow: 0 0 25px rgba(255, 200, 242, .82); animation: drift 5.5s ease-in-out infinite alternate; }
.heart-one { right: 20%; top: 23%; font-size: clamp(32px, 5vw, 66px); transform: rotate(10deg); }
.heart-two { right: 13%; top: 41%; color: #ffdbf6; font-size: 36px; animation-delay: -2s; }
@keyframes drift { to { translate: 0 -12px; } }

.memory-slide { flex: 0 0 min(76vw, 1100px); background: #304d9c; }
.photo-backdrop { position: absolute; inset: -4%; background-position: center; background-size: cover; filter: blur(24px) saturate(.8); opacity: .62; transform: scale(1.06); }
.memory-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: center; background: rgba(44, 67, 133, .22); }
.memory-vignette { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(19, 38, 91, .15), transparent 34%, rgba(25, 37, 95, .06) 53%, rgba(24, 37, 91, .85) 100%), linear-gradient(90deg, rgba(30, 52, 121, .13), transparent 70%); }
.memory-caption { position: absolute; z-index: 2; right: clamp(24px, 5vw, 65px); bottom: clamp(31px, 6vh, 60px); left: clamp(24px, 5vw, 65px); display: flex; align-items: end; justify-content: space-between; gap: 22px; }
.memory-date { display: block; margin-bottom: 9px; color: #f5b9e5; font-size: clamp(9px, .95vw, 11px); font-weight: 800; letter-spacing: .17em; }
.memory-title { max-width: 760px; margin: 0; color: #fff4ff; font-size: clamp(26px, 4.3vw, 56px); font-weight: 700; line-height: 1.05; letter-spacing: -.06em; text-shadow: 0 3px 20px rgba(12, 27, 77, .34); }
.photo-zoom { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 9px; margin-bottom: 3px; padding: 11px 14px; border: 1px solid rgba(255, 238, 255, .5); border-radius: 99px; background: rgba(48, 65, 137, .58); color: #fff2ff; cursor: pointer; font-size: 9px; font-weight: 800; letter-spacing: .08em; backdrop-filter: blur(8px); transition: background .2s, border-color .2s; }
.photo-zoom:hover { border-color: var(--pink); background: rgba(175, 108, 179, .55); }
.photo-zoom svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.photo-zoom-puzzle { color: #ffe5f8; }
.memory-index { position: absolute; z-index: 2; top: 21px; left: 25px; color: rgba(255, 246, 255, .8); font-size: 10px; font-weight: 700; letter-spacing: .16em; text-shadow: 0 1px 12px rgba(24, 34, 80, .55); }
.memory-slide.missing-photo { background: linear-gradient(135deg, #536fc0, #8c75bc 52%, #d293c5); }
.missing-photo-label { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255, 239, 255, .73); font-size: 13px; font-weight: 700; letter-spacing: .16em; }

.future-slide { flex: 0 0 min(68vw, 850px); display: flex; align-items: center; justify-content: center; text-align: center; background: linear-gradient(120deg, rgba(30, 52, 125, .79), rgba(95, 74, 155, .58)), url("images/pays-imaginaire.jpg") center / cover no-repeat; }
.future-slide::before { content: ""; position: absolute; inset: 8% 10%; border: 1px solid rgba(245, 217, 255, .24); border-radius: 50%; transform: rotate(-22deg) scaleY(.48); box-shadow: 0 0 0 23px rgba(245, 217, 255, .035), 0 0 0 48px rgba(245, 217, 255, .025); }
.future-slide::after { content: ""; position: absolute; width: 250px; height: 250px; top: 13%; left: 14%; border: 1px solid rgba(248, 218, 255, .15); border-radius: 50%; box-shadow: 0 0 0 17px rgba(240, 214, 255, .025); }
.future-content { position: relative; z-index: 2; width: min(580px, 78%); padding: 35px 20px; }
.future-lock { display: grid; place-items: center; width: 46px; height: 46px; margin: 0 auto 24px; border: 1px solid rgba(255, 233, 255, .4); border-radius: 50%; color: #f2b7e5; background: rgba(52, 67, 143, .4); box-shadow: 0 0 35px rgba(228, 165, 224, .17); }
.future-lock svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.future-tag { margin: 0 0 12px; color: #f0bfec; font-size: 10px; font-weight: 800; letter-spacing: .19em; }
.future-title { margin: 0; color: #fff2ff; font-size: clamp(30px, 5.5vw, 68px); font-weight: 700; line-height: 1.02; letter-spacing: -.065em; }
.future-note { margin: 18px 0 0; color: rgba(249, 238, 255, .72); font-size: 12px; font-weight: 600; letter-spacing: .035em; }
.future-star { position: absolute; z-index: 1; color: rgba(255, 215, 246, .85); text-shadow: 0 0 22px rgba(255, 199, 242, .7); }
.future-star.one { top: 23%; right: 20%; font-size: 24px; }
.future-star.two { bottom: 24%; left: 17%; font-size: 15px; }

.ending-slide { flex-basis: min(84vw, 1190px); display: flex; align-items: center; background: linear-gradient(100deg, rgba(24, 43, 105, .64), rgba(55, 70, 145, .19) 72%, rgba(91, 57, 130, .34)), url("images/pays-imaginaire.jpg") center / cover no-repeat; }
.ending-copy { position: relative; z-index: 2; padding: 0 clamp(28px, 8vw, 108px); }
.ending-copy .overline { margin-bottom: 18px; }
.ending-love { margin: 21px 0 0; color: rgba(255, 240, 255, .88); font-size: clamp(13px, 1.5vw, 17px); font-weight: 600; }
.ending-love span { color: #ffc2ed; }
.ending-star { position: absolute; z-index: 1; right: 15%; top: 24%; color: #ffd8f2; font-size: clamp(60px, 12vw, 145px); text-shadow: 0 0 40px rgba(250, 184, 236, .72); animation: twinkle 3s ease-in-out infinite alternate; }
@keyframes twinkle { to { opacity: .65; transform: rotate(15deg) scale(.94); } }

.controls { position: fixed; z-index: 20; inset: auto 0 0; display: flex; align-items: center; justify-content: center; gap: clamp(14px, 2.4vw, 34px); height: var(--footer-h); padding: 0 clamp(18px, 4vw, 56px); background: linear-gradient(0deg, rgba(20, 37, 91, .55), rgba(20, 37, 91, .14)); border-top: 1px solid rgba(229, 220, 255, .13); backdrop-filter: blur(14px); }
.arrow-button { display: grid; place-items: center; flex: 0 0 auto; width: 36px; height: 36px; border: 1px solid rgba(240, 225, 255, .37); border-radius: 50%; background: rgba(77, 93, 165, .18); color: #fff0ff; cursor: pointer; font-size: 17px; transition: background .2s, border-color .2s; }
.arrow-button:hover { border-color: var(--pink); background: rgba(189, 127, 191, .3); }
.progress-wrap { display: flex; align-items: center; gap: 15px; width: min(340px, 45vw); }
.story-position { min-width: 48px; color: rgba(248, 235, 255, .85); font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.progress-track { height: 2px; flex: 1; overflow: hidden; border-radius: 2px; background: rgba(237, 225, 255, .26); }
.progress-fill { width: 0; height: 100%; border-radius: 2px; background: linear-gradient(90deg, #9dc8ff, #f4a9dd); transition: width .22s ease; }
.swipe-note { color: rgba(248, 235, 255, .65); font-size: 8px; font-weight: 800; letter-spacing: .15em; }
.swipe-note b { margin-left: 6px; color: var(--pink); font-size: 11px; }

dialog { color: var(--ink); }
.photo-viewer, .puzzle-dialog { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(18, 33, 84, .97); }
.photo-viewer::backdrop, .puzzle-dialog::backdrop { background: rgba(12, 25, 68, .78); backdrop-filter: blur(14px); }
.photo-viewer[open], .puzzle-dialog[open] { display: flex; align-items: center; justify-content: center; }
.photo-viewer img { display: block; width: 100%; height: 100%; object-fit: contain; padding: 35px 24px 76px; }
.dialog-close { position: absolute; z-index: 5; top: max(17px, env(safe-area-inset-top)); right: max(17px, env(safe-area-inset-right)); display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 1px solid rgba(244, 232, 255, .43); border-radius: 50%; background: rgba(46, 64, 132, .72); color: #fff0ff; cursor: pointer; font-size: 27px; line-height: 1; }
.dialog-close:hover { border-color: var(--pink); color: var(--pink); }
.viewer-caption { position: absolute; right: 25px; bottom: max(22px, env(safe-area-inset-bottom)); left: 25px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; text-shadow: 0 2px 14px #172b67; }
.viewer-caption span { color: #f1b6e4; font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.viewer-caption strong { font-size: 17px; }

.puzzle-dialog { overflow: auto; background: rgba(24, 42, 99, .98); }
.puzzle-window { position: relative; width: min(94vw, 470px); max-height: min(94dvh, 850px); overflow-y: auto; padding: clamp(25px, 6vw, 42px); border: 1px solid rgba(241, 224, 255, .26); border-radius: 25px; background: linear-gradient(150deg, rgba(75, 96, 171, .96), rgba(44, 59, 131, .98) 58%, rgba(95, 65, 137, .96)); box-shadow: 0 28px 110px rgba(8, 19, 58, .55); }
.puzzle-kicker { margin: 0 42px 10px 0; color: #f3b8e4; font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.puzzle-kicker span { margin-right: 7px; }
.puzzle-window h2 { max-width: 330px; margin: 0 30px 20px 0; color: #fff2ff; font-size: clamp(25px, 5vw, 36px); font-weight: 700; line-height: 1.05; letter-spacing: -.055em; }
.puzzle-board { display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); gap: 4px; width: min(72vw, 310px); aspect-ratio: 1; margin: 0 auto; padding: 5px; border: 1px solid rgba(240, 226, 255, .28); border-radius: 12px; background: rgba(22, 40, 94, .74); }
.puzzle-tile, .puzzle-empty { display: block; min-width: 0; min-height: 0; border: 0; border-radius: 5px; }
.puzzle-tile { padding: 0; background-color: #7a91d5; background-image: var(--puzzle-image); background-repeat: no-repeat; background-size: 300% 300%; background-position: var(--tile-position); cursor: default; transition: filter .15s, box-shadow .15s; }
.puzzle-tile-movable { cursor: pointer; }
.puzzle-tile-movable:hover { filter: brightness(1.15); box-shadow: inset 0 0 0 2px rgba(255, 232, 255, .8); }
.puzzle-tile:focus-visible { outline: 2px solid var(--pink); outline-offset: -3px; }
.puzzle-empty { background: rgba(18, 33, 82, .82); box-shadow: inset 0 0 0 1px rgba(230, 217, 255, .12); }
.puzzle-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: min(72vw, 310px); margin: 12px auto 0; }
.puzzle-controls p { margin: 0; color: rgba(247, 233, 255, .75); font-size: 10px; line-height: 1.4; }
.puzzle-controls button, .hint-button { padding: 8px 11px; border: 1px solid rgba(238, 221, 255, .36); border-radius: 99px; background: rgba(67, 85, 156, .56); color: #fff1ff; cursor: pointer; font-size: 10px; white-space: nowrap; }
.puzzle-controls button:hover, .hint-button:hover { border-color: var(--pink); }
.code-stage, .clue-stage { width: min(360px, 100%); margin: 26px auto 2px; text-align: center; }
.stage-label { margin: 0; color: #f4b8e4; font-size: 9px; font-weight: 800; letter-spacing: .15em; }
.cipher-code { margin: 18px 0 9px; color: #ffe1f6; font-size: clamp(33px, 8vw, 48px); font-weight: 800; letter-spacing: .2em; text-shadow: 0 0 24px rgba(241, 169, 221, .42); }
.cipher-copy { margin: 0 auto 14px; color: rgba(250, 239, 255, .83); font-size: 12px; }
.puzzle-hint { margin: 12px 0 2px; color: #f4c9ed; font-size: 12px; line-height: 1.5; }
.answer-form { margin-top: 17px; text-align: left; }
.answer-form label { display: block; margin-bottom: 6px; color: rgba(247, 231, 255, .74); font-size: 9px; font-weight: 800; letter-spacing: .1em; }
.answer-row { display: flex; gap: 7px; }
.answer-row input { width: 0; min-width: 0; flex: 1; padding: 11px 12px; border: 1px solid rgba(241, 222, 255, .38); border-radius: 9px; background: rgba(23, 40, 94, .72); color: #fff1ff; font-size: 12px; letter-spacing: .08em; }
.answer-row input::placeholder { color: rgba(229, 214, 246, .55); font-size: 9px; }
.answer-row button { padding: 0 14px; border: 0; border-radius: 9px; background: #eda9dd; color: #263667; cursor: pointer; font-size: 11px; font-weight: 800; white-space: nowrap; }
.answer-row button:hover { background: #ffd2f0; }
.answer-row button span { margin-left: 5px; }
.puzzle-feedback { min-height: 16px; margin: 7px 0 0; color: #ffd4ed; font-size: 11px; }
.clue-stage blockquote { margin: 24px 0 15px; color: #fff2ff; font-size: clamp(24px, 5vw, 35px); font-weight: 700; line-height: 1.18; letter-spacing: -.045em; }
.clue-signoff { margin: 0; color: #f4b9e6; font-size: 12px; font-weight: 600; }
[hidden] { display: none !important; }

@media (max-width: 700px) {
  :root { --header-h: 58px; --footer-h: 60px; }
  .topbar { padding: 0 14px; }
  .brand { gap: 6px; font-size: 10px; }
  .brand-star { font-size: 17px; }
  .top-nav { gap: 12px; }
  .top-nav button { font-size: 9px; }
  .top-nav button[data-jump="debut"] { display: none; }
  .top-next { padding: 7px 9px; font-size: 9px; }
  .story-rail { gap: 10px; padding: 8px 4vw 10px; scroll-padding-inline: 4vw; }
  .story-slide { flex-basis: 91vw; border-radius: 19px; }
  .memory-slide { flex-basis: 88vw; }
  .future-slide { flex-basis: 84vw; }
  .welcome-copy { width: 100%; padding: 0 25px; margin-top: -4vh; }
  .welcome-copy h1, .ending-copy h2 { font-size: clamp(44px, 12vw, 70px); }
  .welcome-foot { right: 16px; bottom: 18px; left: 16px; font-size: 7px; letter-spacing: .1em; }
  .heart-one { right: 13%; top: 19%; }
  .heart-two { right: 9%; top: 37%; }
  .memory-caption { right: 17px; bottom: 22px; left: 17px; align-items: end; gap: 10px; }
  .memory-title { font-size: clamp(24px, 7.2vw, 37px); }
  .memory-date { margin-bottom: 7px; font-size: 8px; }
  .photo-zoom { gap: 6px; padding: 10px 11px; font-size: 8px; }
  .photo-zoom svg { width: 13px; }
  .memory-index { top: 15px; left: 16px; font-size: 9px; }
  .future-content { width: 88%; }
  .future-title { font-size: clamp(29px, 8vw, 43px); }
  .controls { gap: 12px; padding: 0 14px; }
  .arrow-button { width: 33px; height: 33px; }
  .progress-wrap { width: min(52vw, 260px); gap: 9px; }
  .story-position { min-width: 43px; font-size: 9px; }
  .swipe-note { font-size: 7px; }
  .swipe-note b { margin-left: 3px; }
  .ending-copy { padding: 0 24px; }
  .ending-star { right: 10%; top: 24%; }
}

@media (max-width: 380px) {
  .top-nav { gap: 8px; }
  .top-nav button { font-size: 8px; }
  .top-next { padding-inline: 7px; }
  .swipe-note { display: none; }
  .progress-wrap { width: min(60vw, 260px); }
  .photo-zoom span:not(.zoom-label) { display: none; }
}

@media (max-width: 440px) {
  .swipe-note { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
