:root {
  color-scheme: dark;
  --background: #04140e;
  --surface: #082117;
  --ink: #ecf8f1;
  --muted: #a3c2b2;
  --green: #2ee099;
  --gold: #e59b2c;
  --line: #2b5643;
  font-family: 'Source Serif 4', Georgia, serif;
  color: var(--ink);
  background: var(--background);
  font-synthesis: none;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
html { scroll-padding-top: 88px; scrollbar-color: var(--line) var(--background); overscroll-behavior-y: none; }
button, a { touch-action: manipulation; }
button { font: inherit; cursor: pointer; }
a { color: inherit; text-underline-offset: 4px; }
button:focus-visible, a:focus-visible, [tabindex="-1"]:focus-visible { outline: 3px solid #ffcd7d; outline-offset: 5px; }
::selection { background: var(--gold); color: #04140e; }
[hidden] { display: none !important; }
.svg-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sr-only, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link:focus { position: fixed; top: 12px; left: 12px; z-index: 20; padding: 14px; background: var(--surface); }
.jungle-background {
  position: fixed;
  inset: 0 0 auto;
  height: 100lvh;
  pointer-events: none;
  background-color: var(--background);
  background-image: linear-gradient(90deg, #04140e20, #04140e99 32%, #04140eb3 50%, #04140e99 68%, #04140e20), url('assets/jungle-background.jpg');
  background-size: cover;
  background-position: center;
}
.page-shell { position: relative; width: min(780px, calc(100% - 40px)); margin: 0 auto; padding: calc(88px + env(safe-area-inset-top)) 0 max(24px, env(safe-area-inset-bottom)); }
.masthead { position: fixed; top: 0; left: 0; width: 100%; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; padding: max(10px, env(safe-area-inset-top)) max(20px, calc((100% - 780px) / 2)); background: #051a12f5; border-bottom: 1px solid #16422f; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; font-family: 'Libre Caslon Text', Georgia, serif; font-size: 20px; }
.brand img { object-fit: contain; }
.close-button { display: grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; border-radius: 8px; border: 1px solid var(--line); background: #092218; color: var(--gold); }
.expedition-banner { position: relative; overflow: hidden; padding: 20px; border: 1px solid #267151; border-radius: 8px; background: linear-gradient(135deg, #0c2f21, #092218 55%, #061911); box-shadow: 0 8px 24px #0006; }
.banner-compass { position: absolute; top: -28px; right: -28px; width: 150px; height: 150px; color: #e59b2c24; pointer-events: none; }
.sound-button, .progress-copy, .step-label, .dialog-label, .button, .resolve-button, .hint-status, .card-status, .revealed-hint h4, .text-button { font-family: 'Space Grotesk', sans-serif; }
.sound-button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 44px; padding: 8px; border: 1px solid #2b5643; border-radius: 5px; background: #072418; color: #c1ecd4; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.sound-button .icon { width: 17px; height: 17px; color: var(--gold); }
.header-sound { flex-shrink: 0; min-width: 44px; border-radius: 8px; }
h1, h2, h3 { font-family: 'Libre Caslon Text', Georgia, serif; font-weight: 700; text-wrap: balance; }
h1 { position: relative; margin: 0; max-width: 600px; font-size: clamp(24px, 4.5vw, 36px); line-height: 1.3; letter-spacing: -.02em; }
.expedition-description { position: relative; margin: 10px 0 18px; max-width: 55ch; color: #a5d0b9; font-style: italic; font-size: 15px; line-height: 1.6; }
.expedition-timer { position: relative; display: flex; justify-content: center; align-items: center; gap: 16px; margin: 22px 0; }
#timer-display { color: #ffdfab; font-family: 'Space Grotesk', sans-serif; font-size: clamp(24px, 5vw, 32px); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .04em; white-space: nowrap; }
#timer-display.is-overtime { color: #ffbd58; }
.timer-toggle { display: grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; padding: 0; border: 1px solid #a7772f; border-radius: 50%; background: #10291a; color: #ffcd7d; box-shadow: inset 0 1px 0 #ffdfab20; }
.timer-toggle[aria-pressed="true"] { background: #3b2e17; color: #ffdfab; }
.timer-toggle:active { opacity: .8; }
.progress-section { padding: 12px; border: 1px solid #215039; border-radius: 4px; background: #051811e6; }
.progress-copy { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 14px; font-size: 11px; font-weight: 600; }
.progress-copy > span { display: flex; align-items: center; gap: 5px; color: #ffc568; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.progress-copy .icon { width: 17px; height: 17px; }
.progress-copy p { margin: 0 0 0 auto; color: #a5d0b9; font-variant-numeric: tabular-nums; text-align: right; }
.progress-track { margin-top: 10px; height: 12px; overflow: hidden; border: 1px solid #173926; border-radius: 6px; background: #020e08; }
#progress-fill { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #10b981, #e59b2c, #fcd34d); }
.riddles-section { position: relative; padding-top: 24px; }
.trail-instructions { position: relative; padding-left: 34px; margin: 0 0 30px; color: #b8d7c5; font-size: 14px; line-height: 1.6; font-style: italic; }
.trail-instructions > .icon { position: absolute; left: 0; top: 5px; color: var(--gold); }
.trail { list-style: none; margin: 0; padding: 0 4px; }
.trail-step { position: relative; display: flex; padding-bottom: 32px; scroll-margin-top: 90px; }
.trail-step:nth-child(even) { justify-content: flex-end; }
.trail-step:last-child { padding-bottom: 0; }
.trail-segment { position: absolute; top: 50px; left: 32%; width: 36%; height: calc(100% + 10px); pointer-events: none; }
.trail-segment path { fill: none; stroke: #b99346; stroke-width: 2; stroke-dasharray: 5 8; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.trail-step:nth-child(even) .trail-segment { transform: scaleX(-1); }
.trail-step:last-child .trail-segment { display: none; }
.step-card { position: relative; z-index: 1; display: flex; align-items: center; gap: 14px; width: 85%; max-width: 510px; min-height: 106px; padding: 18px; border: 1px solid #285b43; border-radius: 8px; background: #082117; text-align: left; color: var(--ink); box-shadow: 0 6px 18px #0006; }
.step-copy { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.step-label { color: #a5d0b9; font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
.step-title { font-family: 'Libre Caslon Text', Georgia, serif; font-weight: 700; margin: 0; font-size: 20px; line-height: 1.4; }
.step-description { color: #a3c2b2; font-size: 13px; line-height: 1.4; }
.step-marker { display: grid; place-items: center; width: 48px; height: 48px; flex: 0 0 auto; border: 1px solid #347354; border-radius: 50%; background: #05160f; color: #a5d0b9; }
.step-marker .icon { width: 25px; height: 25px; }
.is-current .step-card { border-color: var(--gold); background: linear-gradient(110deg, #2a2412, #241a0b, #16291e); box-shadow: 0 8px 24px #0005; outline: 1px solid #e59b2c80; outline-offset: 3px; }
.is-current .step-label { color: #ffbd58; }
.is-current .step-title { color: #ffedbd; }
.is-current .step-marker { border-color: #ffda87; background: linear-gradient(45deg, #e59b2c, #fbbf24); color: #fff; }
.is-resolved .step-card { border-color: #329366; }
.is-resolved .step-marker { background: #145a3c; color: #93f2bc; }
.is-resolved .step-label { color: #93f2bc; }
.is-locked .step-card { background: #061b12; border-color: #173c2a; cursor: not-allowed; }
.is-locked .step-title, .is-locked .step-label, .is-locked .step-description { color: #92b1a0; }
.is-locked .step-marker { color: #739987; border-color: #28513a; }
.atmosphere { position: fixed; inset: 0 0 auto; height: 100lvh; overflow: hidden; pointer-events: none; }
.jungle-mist { position: absolute; top: 54lvh; left: -20%; width: 140%; height: 28lvh; background: radial-gradient(ellipse, #b8cfb619, transparent 65%); animation: mist-drift 24s cubic-bezier(0.77, 0, 0.175, 1) infinite alternate; }
.jungle-mist--far { top: 15lvh; height: 24lvh; opacity: .65; animation-duration: 37s; animation-delay: -12s; animation-direction: alternate-reverse; }
.rain { position: absolute; inset: 0; }
.rain-drop { position: absolute; top: 0; width: 1px; background: linear-gradient(transparent, #c2d7ca); animation: rainfall 4s linear infinite; }
.jungle-insect { position: absolute; top: 0; left: 0; width: 22px; height: 22px; opacity: 0; animation: insect-flight 37s cubic-bezier(0.77, 0, 0.175, 1) 6s infinite; }
.jungle-insect svg { display: block; width: 100%; height: 100%; }
.jungle-insect--second { left: -84vw; width: 17px; height: 17px; animation-duration: 29s; animation-delay: -11s; }
.insect-wings { transform-origin: 24px 23px; animation: insect-wingbeat 90ms linear infinite alternate; }
.jungle-parrot { position: absolute; top: 0; left: 0; width: 100px; height: 67px; opacity: 0; animation: parrot-flight 63s linear 12s infinite; }
.jungle-parrot--far { width: 72px; height: 48px; animation-name: parrot-return; animation-duration: 49s; animation-delay: -8s; }
.jungle-parrot--far .parrot-sprite { transform: scaleX(-1); }
.drifting-leaf { position: absolute; top: 0; left: 5vw; width: 14px; height: 21px; opacity: 0; animation: leaf-fall 23s linear -7s infinite; }
.drifting-leaf--second { left: 90vw; width: 10px; height: 15px; animation-duration: 31s; animation-delay: -20s; }
.parrot-sprite { width: 100%; height: 100%; background: url('assets/parrot-flight.png') 0 0 / 200% 200% no-repeat; animation: parrot-wingbeat 600ms steps(1, end) infinite; }
.ambient-paused .atmosphere *, .ambient-paused .insect-wings, body:has(dialog[open]) .atmosphere *, body:has(dialog[open]) .insect-wings { animation-play-state: paused; }
@keyframes mist-drift { from { transform: translate3d(-3vw, 0, 0); } to { transform: translate3d(3vw, -2lvh, 0); } }
@keyframes leaf-fall {
  0% { transform: translate3d(0, -30px, 0) rotate(-30deg); opacity: 0; }
  10% { opacity: .5; }
  80% { opacity: .5; }
  100% { transform: translate3d(5vw, 100lvh, 0) rotate(260deg); opacity: 0; }
}
@keyframes rainfall {
  from { transform: translate3d(0, -100px, 0); }
  to { transform: translate3d(-8vw, 100lvh, 0); }
}
@keyframes insect-wingbeat { to { transform: scaleY(.45); } }
@keyframes insect-flight {
  0%, 34%, 100% { transform: translate3d(102vw, 65lvh, 0) rotate(-20deg); opacity: 0; }
  3% { transform: translate3d(94vw, 60lvh, 0) rotate(-25deg); opacity: .7; }
  10% { transform: translate3d(88vw, 40lvh, 0) rotate(10deg); opacity: .7; }
  18% { transform: translate3d(92vw, 24lvh, 0) rotate(-15deg); opacity: .7; }
  26% { transform: translate3d(84vw, 31lvh, 0) rotate(18deg); opacity: .7; }
  32% { transform: translate3d(102vw, 18lvh, 0) rotate(25deg); opacity: 0; }
}
@keyframes parrot-flight {
  0% { transform: translate3d(-120px, 28lvh, 0) rotate(-8deg); opacity: 0; }
  2% { opacity: .8; }
  10% { transform: translate3d(45vw, 17lvh, 0) rotate(2deg); opacity: .8; }
  20% { transform: translate3d(calc(100vw + 120px), 24lvh, 0) rotate(6deg); opacity: 0; }
  100% { transform: translate3d(calc(100vw + 120px), 24lvh, 0); opacity: 0; }
}
@keyframes parrot-wingbeat {
  0%, 100% { background-position: 0 0; }
  25% { background-position: 100% 0; }
  50% { background-position: 100% 100%; }
  75% { background-position: 0 100%; }
}
@keyframes parrot-return {
  0% { transform: translate3d(calc(100vw + 100px), 42lvh, 0) rotate(4deg); opacity: 0; }
  3% { opacity: .65; }
  12% { transform: translate3d(48vw, 34lvh, 0) rotate(-3deg); opacity: .65; }
  24% { transform: translate3d(-100px, 38lvh, 0); opacity: 0; }
  100% { transform: translate3d(-100px, 38lvh, 0); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .atmosphere { display: none; } .insect-wings { animation: none; } }
.trail-end { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 38px 0 28px; color: var(--gold); text-align: center; }
.trail-end p { margin: 0; color: var(--muted); font-size: 14px; font-style: italic; }
.footer { padding: 20px 0; border-top: 1px solid #173c2a; color: var(--muted); text-align: center; }
.footer > p { margin: 0; font-size: 13px; line-height: 1.6; }
.text-button { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 5px; padding: 8px 0; border: 0; background: transparent; color: #b8d7c5; font-size: 11px; text-decoration: underline; text-underline-offset: 4px; }
.text-button .icon { width: 15px; height: 15px; }
.puzzle-dialog { width: min(520px, calc(100% - 32px)); max-height: calc(100dvh - 40px); margin: auto; padding: 24px; border: 1px solid #a7772f; border-radius: 8px; background: linear-gradient(#133626, #091f16); color: var(--ink); text-align: center; box-shadow: 0 12px 36px #0009; overscroll-behavior: contain; }
.puzzle-dialog::backdrop { background: #000c; backdrop-filter: blur(5px); }
.confirmation-dialog { max-width: 400px; padding: 28px; }
.confirmation-dialog .confirmation-icon { display: block; width: 32px; height: 32px; margin-inline: auto; color: var(--gold); }
.confirmation-dialog h2 { margin-top: 16px; }
.confirmation-dialog > p { margin: 0 0 24px; color: #c1ecd4; font-size: 16px; line-height: 1.65; }
.confirmation-dialog::backdrop { background: #0009; backdrop-filter: blur(3px); }
body:has(.puzzle-dialog[open]) { overflow: hidden; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dialog-label { display: flex; align-items: center; gap: 6px; color: #ffbd58; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; }
.close-button { color: #a5d0b9; }
.puzzle-dialog h2 { margin: 8px 0 16px; font-size: 24px; line-height: 1.4; }
.dialog-illustration { position: relative; height: 154px; overflow: hidden; margin: 0 0 20px; border-radius: 5px; background: #071d14; }
.dialog-illustration[aria-busy="true"]::before { content: 'Chargement de l’illustration…'; position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.dialog-illustration img { width: 100%; height: 100%; object-fit: cover; object-position: center 42%; }
.dialog-illustration figcaption { position: absolute; right: 6px; bottom: 6px; left: 6px; width: fit-content; padding: 4px 6px; border-radius: 3px; background: #04140ee6; color: #ffdfab; font-size: 11px; font-style: italic; }
.card-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card-heading h3 { margin: 0; font-size: 20px; }
.card-status { display: inline-flex; align-items: center; gap: 4px; color: #a5d0b9; font-size: 11px; }
.card-status .icon { width: 15px; height: 15px; }
.hint-status { margin: 8px 0 20px; color: #a3c2b2; font-size: 11px; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 10px; min-height: 48px; padding: 12px 15px; border: 1px solid #438366; border-radius: 5px; background: #12633f; color: #fff; font-size: 12px; font-weight: 600; line-height: 1.5; }
.reveal-button, .solution-button { width: 100%; justify-content: space-between; }
.solution-button { background: #694719; border-color: #a7772f; color: #ffdfab; }
.button-danger { background: #8a3029; border-color: #bd6456; }
.resolve-button { display: flex; justify-content: center; align-items: center; gap: 8px; width: 100%; min-height: 48px; margin-top: 16px; padding: 12px 0 0; border: 0; border-top: 1px solid var(--line); background: transparent; color: #b8d7c5; font-size: 12px; }
.resolve-button[aria-pressed="true"] { color: #93f2bc; }
.revealed-hint { margin-bottom: 14px; padding: 15px; border: 1px solid #326047; border-radius: 5px; background: #082117; }
.revealed-hint h4 { margin: 0 0 8px; color: #ffbd58; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.revealed-hint p { margin: 0; white-space: pre-line; overflow-wrap: anywhere; font-size: 16px; line-height: 1.65; }
.revealed-solution { background: #f1e5cb; border-color: #c3a670; color: #3c3021; }
.revealed-solution h4 { color: #75420c; }
.confirmation-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.confirmation-actions .button { flex: 1; }
.no-script { padding: 20px; background: var(--surface); }
@media (hover: hover) and (pointer: fine) {
  .timer-toggle:hover { background: #22432e; border-color: #ffcd7d; }
  .step-card:not(:disabled):hover { border-color: #e59b2c; background: #113b2a; }
  .is-current .step-card:hover { background: #322a15; }
  .button:hover { filter: brightness(1.15); }
  .sound-button:hover, .close-button:hover { border-color: #e59b2c; }
  .text-button:hover, .resolve-button:hover { color: #ffcd7d; }
}
@media (max-width: 480px) {
  .jungle-background { background-image: linear-gradient(#04140e66, #04140e99), url('assets/jungle-background.jpg'); background-position: 25% center; }
  .page-shell { padding-top: calc(82px + env(safe-area-inset-top)); }
  .brand { font-size: 18px; }
  .brand img { width: 32px; height: 32px; }
  .expedition-banner { padding: 16px; }
  .sound-button { padding-inline: 6px; font-size: 11px; }
  .header-sound > span { display: none; }
  .expedition-description { font-size: 14px; }
  .progress-copy { font-size: 11px; gap: 8px; }
  .progress-copy p { max-width: 95px; }
  .trail-instructions { font-size: 13px; margin-bottom: 28px; }
  .step-card { padding: 14px 12px; gap: 10px; }
  .step-marker { width: 42px; height: 42px; }
  .step-title { font-size: 17px; }
  .step-description { font-size: 12px; }
  .step-label { font-size: 11px; }
  .trail-step { padding-bottom: 30px; }
  .puzzle-dialog { padding: 18px; }
  .puzzle-dialog h2 { font-size: 22px; }
  .confirmation-actions { flex-direction: column; }
}
@media (max-width: 350px) {
  .page-shell { width: calc(100% - 28px); }
  .masthead { padding-inline: 14px; }
  .brand { font-size: 16px; }
  .step-card { width: 92%; }
  .step-title { font-size: 16px; }
}
