:root {
  --yellow: #ffc907;
  --yellow-dark: #dba900;
  --ink: #171811;
  --navy: #0d5d6d;
  --blue: #1594a8;
  --water: #26a9bd;
  --cream: #f7f7f3;
  --paper: #ffffff;
  --earth: #75532f;
  --green: #4c7a3b;
  --red: #a62d23;
  --line: #d2c5ab;
  --shadow-sm: 0 4px 12px rgb(29 38 40 / 10%);
  --shadow-lg: 0 20px 60px rgb(21 25 24 / 22%);
  --header-height: 80px;
}

* { box-sizing: border-box; }

html { background: var(--ink); }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--cream);
  font-family: "Proxima Nova", "Avenir Next", Avenir, Montserrat, "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

button, a { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 10000;
  top: 10px;
  left: 10px;
  padding: 10px 16px;
  color: white;
  background: var(--ink);
  transform: translateY(-160%);
}
.skip-link:focus { transform: none; }

:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }

h1, h2, h3, strong, .wordmark {
  font-family: "Proxima Nova", "Avenir Next", Avenir, Montserrat, "Segoe UI", Arial, sans-serif;
}
.intro-content h1, .result-card h1 { font-family: "Proxima Nova", "Avenir Next", Avenir, Montserrat, "Segoe UI", Arial, sans-serif; font-weight: 700; }

.screen { min-height: 100vh; }

.primary-button, .ghost-button, .text-button {
  min-height: 50px;
  padding: 12px 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border-radius: 6px;
  font-weight: 800;
  letter-spacing: .02em;
  text-decoration: none;
}

.primary-button {
  border: 2px solid var(--yellow);
  color: var(--ink);
  background: var(--yellow);
  border-radius: 3px;
  box-shadow: none;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.primary-button:hover { background: #ffd43d; transform: translateY(-2px); box-shadow: 0 8px 22px rgb(0 0 0 / 18%); }
.primary-button:active { box-shadow: none; transform: translateY(0); }

.ghost-button { border: 2px solid currentColor; color: var(--ink); background: rgb(255 255 255 / 86%); }
.ghost-button:hover { color: white; background: var(--ink); }
.text-button { border: 0; color: var(--navy); background: transparent; text-decoration: underline; text-underline-offset: 4px; }

.round-button {
  width: 46px;
  height: 46px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid #cfc4ae;
  border-radius: 50%;
  color: var(--ink);
  background: white;
  font-weight: 900;
}
.round-button:hover { border-color: var(--ink); background: var(--yellow); }

.eyebrow, .panel-label, .brief-label {
  margin: 0 0 10px;
  color: #765a00;
  font-size: .74rem;
  font-weight: 900;
  letter-spacing: .15em;
  text-transform: uppercase;
}

/* ---------- Intro ---------- */

.intro-screen { display: grid; grid-template-rows: 80px 1fr auto; background: var(--cream); }

.intro-header {
  z-index: 5;
  padding: 0 clamp(20px, 5vw, 80px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-bottom: 1px solid #e5e5df;
}

.wordmark { display: inline-flex; align-items: center; gap: 10px; color: #191919; font-size: clamp(1.1rem, 1.7vw, 1.45rem); font-weight: 700; letter-spacing: .08em; text-decoration: none; white-space: nowrap; }
.intro-header .wordmark { order: 1; }
.wordmark span { color: var(--yellow-dark); }
.intro-nav { order: 2; display: flex; align-items: center; gap: clamp(20px, 4vw, 58px); margin-inline: auto; }
.intro-header .sound-button { order: 3; }
.intro-nav a { color: #111; font-size: .78rem; font-weight: 800; letter-spacing: .14em; text-decoration: none; text-transform: uppercase; }
.intro-nav a:hover { text-decoration: underline; text-decoration-color: var(--yellow); text-decoration-thickness: 3px; text-underline-offset: 7px; }

.intro-scene {
  position: relative;
  min-height: 690px;
  padding: clamp(48px, 8vh, 100px) clamp(20px, 6vw, 96px);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, .7fr);
  align-items: center;
  gap: clamp(40px, 7vw, 110px);
  overflow: hidden;
  background: url("assets/images/kumbala-savanna.png") center / cover;
}

.intro-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgb(5 112 128 / 95%) 0%, rgb(8 130 148 / 86%) 46%, rgb(8 130 148 / 31%) 73%, rgb(10 44 48 / 14%) 100%); }
.intro-content, .village-brief { position: relative; z-index: 1; }

.intro-content .eyebrow { color: var(--yellow); }
.intro-content h1 { max-width: 760px; margin: 0; color: white; font-size: clamp(2.6rem, 4.2vw, 4.7rem); line-height: 1.05; letter-spacing: -.035em; text-shadow: 0 2px 18px rgb(0 0 0 / 12%); }
.intro-content h1 span { color: white; }
.intro-story { max-width: 650px; margin: 28px 0 32px; color: rgb(255 255 255 / 92%); font-size: clamp(1.02rem, 1.6vw, 1.25rem); }
.intro-actions { display: flex; flex-wrap: wrap; gap: 20px; }

.village-brief {
  max-width: 500px;
  justify-self: end;
  padding: clamp(28px, 4vw, 48px);
  border: 1px solid rgb(210 197 171 / 85%);
  border-radius: 3px;
  background: rgb(255 255 255 / 96%);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
}
.village-brief h2 { margin: 0 0 28px; color: #141414; font-size: clamp(1.65rem, 2.5vw, 2.45rem); font-weight: 700; line-height: 1.16; }
.village-brief dl { margin: 0; }
.village-brief dl div { padding: 12px 0; display: flex; justify-content: space-between; gap: 20px; border-bottom: 1px solid #e2d9c7; }
.village-brief dl div:last-child { border-bottom: 0; }
.village-brief dt { color: #67645a; }
.village-brief dd { margin: 0; color: var(--red); font-weight: 900; text-align: right; }

.difficulty-picker { margin-top: 24px; padding-top: 20px; border-top: 1px solid #e2d9c7; }
.difficulty-options { display: grid; gap: 9px; }
.difficulty-option { padding: 10px 14px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; border: 2px solid var(--line); border-radius: 10px; background: white; text-align: left; color: var(--ink); }
.difficulty-option strong { font-size: .92rem; }
.difficulty-option span { color: #6c6a62; font-size: .74rem; }
.difficulty-option:hover { border-color: var(--ink); }
.difficulty-option.is-selected { border-color: var(--yellow-dark); background: #fff4c7; }

.intro-footer { min-height: 72px; padding: 14px clamp(20px, 5vw, 80px); display: flex; justify-content: space-between; align-items: center; gap: 16px; border-top: 5px solid var(--yellow); color: #555; background: var(--paper); font-size: .77rem; }
.intro-footer p { margin: 0; }
.intro-footer a { color: var(--navy); font-weight: 800; }
.footer-about { display: grid; gap: 2px; }
.charity-links { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 20px; }
.charity-links a { padding: 7px 0; color: #111; letter-spacing: .08em; text-decoration-color: var(--yellow-dark); text-decoration-thickness: 2px; text-underline-offset: 4px; text-transform: uppercase; }
.charity-links a:hover { color: #765a00; }

/* ---------- Game HUD ---------- */

.game-screen { height: 100dvh; min-height: 620px; overflow: hidden; color: var(--ink); background: #191d1a; }

.game-hud {
  position: relative;
  z-index: 100;
  height: var(--header-height);
  padding: 0 24px;
  display: grid;
  grid-template-columns: auto minmax(270px, .8fr) minmax(320px, 1fr) auto;
  align-items: center;
  gap: 26px;
  border-bottom: 1px solid #bdb4a5;
  background: rgb(255 254 250 / 97%);
  box-shadow: var(--shadow-sm);
}
.hud-brand { display: flex; align-items: center; gap: 10px; color: #755b00; white-space: nowrap; }
.hud-brand strong { font-size: 1.25rem; }
.hud-difficulty { padding: 3px 9px; border-radius: 999px; color: white; background: var(--navy); font-size: .63rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.hud-vitals { display: flex; gap: 16px; }
.hud-meter { display: grid; grid-template-columns: 22px minmax(60px, 110px) 30px; align-items: center; gap: 7px; color: #a62d23; font-size: .8rem; }
.hud-meter > div { height: 9px; overflow: hidden; border-radius: 999px; background: #ddd8cf; }
.hud-meter i { display: block; width: 100%; height: 100%; border-radius: inherit; background: #bc3f32; transition: width .3s; }
.energy-meter { color: #926e00; }
.energy-meter i { background: var(--yellow-dark); }
.timer-meter { color: #19647c; }
.timer-meter i { background: var(--blue); transition: width .3s linear; }
.timer-meter.is-low { color: var(--red); }
.timer-meter.is-low i { background: var(--red); }
.hud-impact { display: flex; justify-content: center; gap: clamp(18px, 4vw, 52px); }
.hud-impact div { min-width: 70px; }
.hud-impact span, .hud-impact strong { display: block; }
.hud-impact span { color: #6c6a62; font-size: .63rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.hud-impact strong { font-size: 1.1rem; }
.hud-actions { display: flex; gap: 9px; }

/* ---------- World ---------- */

.game-layout { height: calc(100dvh - var(--header-height)); min-height: 540px; display: grid; grid-template-columns: 1fr 340px; }

.world-viewport { position: relative; overflow: hidden; background: #997049; isolation: isolate; touch-action: none; }
.world-viewport:focus-visible { outline: 4px solid var(--yellow); outline-offset: -4px; }

.game-world {
  position: absolute;
  top: 0;
  left: 0;
  width: 1600px;
  height: 900px;
  overflow: hidden;
  transform-origin: top left;
  will-change: transform;
}
.world-background { position: absolute; inset: 0; width: 1600px; height: 900px; user-select: none; pointer-events: none; transition: filter 2.5s ease; }
.game-world.is-dry .world-background { filter: saturate(.68) sepia(.18) brightness(.9); }
.game-world.is-recovering .world-background { filter: saturate(.9) brightness(.98); }
.game-world.is-restored .world-background { filter: saturate(1.12) brightness(1.06); }

.restoration-layer { position: absolute; inset: 0; opacity: 0; transition: opacity 2.5s ease; pointer-events: none; }
.game-world.is-recovering .restoration-layer { opacity: .24; }
.game-world.is-restored .restoration-layer { opacity: 1; }
.flowing-river { position: absolute; left: -30px; right: -30px; bottom: -5px; height: 245px; border-radius: 50% 38% 0 0; background: linear-gradient(175deg, transparent 0 12%, rgb(80 167 190 / 82%) 13% 70%, rgb(46 127 171 / 85%) 72%); clip-path: polygon(0 36%, 15% 8%, 32% 36%, 48% 7%, 67% 37%, 82% 12%, 100% 28%, 100% 100%, 0 100%); animation: water-shimmer 2.5s ease-in-out infinite alternate; }
.green-patch { position: absolute; width: 330px; height: 130px; border-radius: 50%; background: radial-gradient(ellipse, rgb(83 124 54 / 78%), rgb(83 124 54 / 0) 68%); }
.patch-one { left: 800px; top: 390px; }.patch-two { left: 1100px; top: 470px; }.patch-three { left: 180px; top: 470px; }
.returning-birds { position: absolute; top: 100px; left: 800px; color: #272a24; font-size: 28px; letter-spacing: 30px; animation: birds-fly 9s linear infinite; }
.nature-layer { position: absolute; inset: 0; z-index: 3; overflow: hidden; pointer-events: none; }
.nature-layer i { position: absolute; width: 10px; height: 6px; border-radius: 100% 0 100% 0; background: #e6c84d; opacity: .55; animation: leaf-drift 12s linear infinite; }
.nature-layer i:nth-child(1) { left: 9%; top: 18%; animation-delay: -2s; }.nature-layer i:nth-child(2) { left: 28%; top: 68%; animation-delay: -8s; }.nature-layer i:nth-child(3) { left: 47%; top: 35%; animation-delay: -5s; }.nature-layer i:nth-child(4) { left: 66%; top: 14%; animation-delay: -10s; }.nature-layer i:nth-child(5) { left: 81%; top: 58%; animation-delay: -4s; }.nature-layer i:nth-child(6) { left: 93%; top: 31%; animation-delay: -7s; }
.game-world.is-recovering .nature-layer i, .game-world.is-restored .nature-layer i { background: #8fc95f; opacity: .85; }

.world-object {
  position: absolute;
  z-index: 5;
  min-width: 84px;
  min-height: 84px;
  padding: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: end;
  gap: 5px;
  border: 0;
  color: var(--ink);
  background: transparent;
  transform: translate(-50%, -50%);
}
.world-object .object-visual { width: 68px; height: 68px; display: grid; place-items: center; border: 2px solid rgb(23 24 17 / 75%); border-radius: 50%; background: rgb(255 254 250 / 91%); box-shadow: 0 8px 15px rgb(25 22 16 / 28%); font-family: "Arial Black", sans-serif; font-size: 34px; }
.world-object .object-name { padding: 4px 9px; border-radius: 999px; color: white; background: rgb(23 24 17 / 88%); box-shadow: var(--shadow-sm); font-size: .68rem; font-weight: 800; white-space: nowrap; opacity: 0; transform: translateY(4px); transition: .18s ease; }
.world-object:hover .object-name, .world-object:focus-visible .object-name, .world-object.is-near .object-name { opacity: 1; transform: none; }
.world-object.is-near .object-visual { outline: 5px solid rgb(255 201 7 / 58%); animation: marker-pulse 1.4s ease-in-out infinite; }
.world-object.is-target::before { content: ""; position: absolute; top: -24px; width: 20px; height: 20px; border: 5px solid var(--yellow); border-radius: 50%; box-shadow: 0 0 0 8px rgb(255 201 7 / 20%); animation: target-bob 1.2s ease-in-out infinite alternate; }
.world-object.is-target .object-name { opacity: 1; transform: none; background: #463800; }
.world-object.is-complete { pointer-events: none; }
.world-object.is-complete .object-visual { opacity: .6; filter: grayscale(.55); }

/* Realistic generated sprites share one 4 × 2 asset sheet. */
.spring-object .object-visual,
.kit-object .object-visual,
.pump-object .object-visual,
.tank-object .object-visual,
.wildlife-object .object-visual,
.volunteer-object .person-figure,
.villager-object .person-figure {
  width: 108px;
  height: 144px;
  border: 0 !important;
  border-radius: 0;
  color: transparent;
  background-color: transparent !important;
  background-image: url("assets/images/realistic-sprites.png") !important;
  background-repeat: no-repeat;
  background-size: 400% 200%;
  box-shadow: none !important;
  font-size: 0;
  filter: drop-shadow(0 8px 5px rgb(25 22 16 / 36%));
}
.spring-object .object-visual { background: transparent url("assets/images/realistic-sprites.png") 100% 100% / 400% 200% no-repeat !important; }
.kit-object .object-visual { background: transparent url("assets/images/realistic-sprites.png") 33.333% 100% / 400% 200% no-repeat !important; }
.pump-object .object-visual { background: transparent url("assets/images/realistic-sprites.png") 0 100% / 400% 200% no-repeat !important; }
.tank-object .object-visual { background: transparent url("assets/images/realistic-sprites.png") 66.667% 100% / 400% 200% no-repeat !important; }
.wildlife-object .object-visual { width: 150px; height: 140px; background: transparent url("assets/images/realistic-sprites.png") 100% 0 / 400% 200% no-repeat !important; transform: none; }
.volunteer-object .person-figure { background: transparent url("assets/images/realistic-sprites.png") 33.333% 0 / 400% 200% no-repeat !important; }
.villager-object .person-figure { background: transparent url("assets/images/realistic-sprites.png") 66.667% 0 / 400% 200% no-repeat !important; transform: none; }
.spring-object .object-visual::before,
.spring-object .object-visual i,
.pump-object .object-visual i,
.volunteer-object .person-figure i,
.villager-object .person-figure i { display: none; }
.pump-object.is-repaired .object-visual { border: 0; background: transparent url("assets/images/realistic-sprites.png") 0 100% / 400% 200% no-repeat !important; }

.spring-object { left: 1320px; top: 680px; }
.spring-object .object-visual { overflow: hidden; border-color: #19647c; background: #bde9f2; }
.spring-object .object-visual::before { content: ""; width: 25px; height: 38px; border-radius: 50% 50% 52% 48% / 62% 60% 40% 38%; background: #2e9ec0; transform: rotate(45deg); box-shadow: inset 7px 7px rgb(255 255 255 / 32%); }
.spring-object .object-visual i { position: absolute; width: 84px; height: 24px; border-radius: 50%; border-bottom: 6px solid #2e9ec0; }

.kit-object { left: 730px; top: 390px; }
.kit-object .object-visual { border-radius: 12px; color: #423200; background: var(--yellow); }

.pump-object { left: 1035px; top: 525px; }
.pump-object .object-visual { position: relative; border-radius: 12px; background: #d9c8a7; }
.pump-handle { position: absolute; top: 18px; left: 18px; width: 45px; height: 9px; border-radius: 3px; background: #55371f; transform: rotate(-11deg); }
.pump-body { position: absolute; top: 25px; left: 28px; width: 22px; height: 35px; border-radius: 4px 4px 9px 9px; background: #734729; }
.pump-body::after { content: ""; position: absolute; top: 7px; right: -18px; width: 22px; height: 7px; background: #734729; }
.pump-object.is-repaired .object-visual { border-color: #335f3b; background: #dbe9d2; }
.pump-object.is-repaired .object-name { background: #315f3d; }

.tank-object { left: 1190px; top: 430px; }
.tank-object .object-visual { border-radius: 13px; color: #67501f; background: #ead79b; }
.sign-object { left: 460px; top: 495px; }
.sign-object .object-visual { border-radius: 6px; color: #f7e6bd; background: #6a492c; transform: rotate(-3deg); }

.volunteer-object { left: 930px; top: 430px; }
.villager-object { left: 1160px; top: 570px; }
.person-figure { position: relative; width: 58px; height: 74px; display: block; filter: drop-shadow(0 7px 4px rgb(25 22 16 / 30%)); }
.person-head { position: absolute; z-index: 2; top: 2px; left: 18px; width: 25px; height: 27px; border-radius: 50%; background: #71482f; box-shadow: inset 0 6px #29211c; }
.person-body { position: absolute; top: 24px; left: 10px; width: 42px; height: 46px; border-radius: 16px 16px 8px 8px; background: #c79d31; clip-path: polygon(18% 0, 82% 0, 100% 100%, 0 100%); }
.villager-object .person-body { background: #6a8e82; }
.small-person { transform: scale(.9); }

.wildlife-object { left: 560px; top: 300px; }
.wildlife-object .object-visual { border: 0; color: #5c432d; background: transparent; box-shadow: none; font-size: 55px; transform: scaleX(-1); }
.game-world.is-restored .wildlife-object { animation: gazelle-return 4s ease-in-out infinite alternate; }

.points-popup { position: absolute; z-index: 45; transform: translate(-50%, -100%); color: #fff4c7; text-shadow: 0 2px 6px rgb(0 0 0 / 65%); font-family: "Hanken Grotesk", "Arial Black", Arial, sans-serif; font-size: 1.15rem; font-weight: 900; pointer-events: none; animation: points-float 1.1s ease-out forwards; }

.player {
  position: absolute;
  z-index: 20;
  width: 58px;
  height: 84px;
  transform: translate(-50%, -72%);
  filter: drop-shadow(0 8px 5px rgb(18 17 13 / 34%));
  will-change: left, top;
}
.player::before { content: ""; position: absolute; inset: -24px -12px -10px; background: url("assets/images/realistic-sprites.png") 0 0 / 400% 200% no-repeat; filter: drop-shadow(0 8px 5px rgb(18 17 13 / 38%)); }
.player > span { opacity: 0; }
.player-shadow { position: absolute; left: 8px; bottom: -4px; width: 50px; height: 14px; border-radius: 50%; background: rgb(26 20 13 / 28%); }
.player-head { position: absolute; z-index: 4; top: 0; left: 18px; width: 27px; height: 29px; border-radius: 50%; background: #754b31; box-shadow: inset 0 7px #25201b; }
.player-body { position: absolute; z-index: 3; top: 25px; left: 13px; width: 38px; height: 41px; border-radius: 11px 11px 5px 5px; background: #dfb426; box-shadow: inset 0 -8px #b07e16; }
.player-pack { position: absolute; z-index: 2; top: 31px; left: 4px; width: 20px; height: 30px; border-radius: 7px; background: var(--navy); }
.player-leg { position: absolute; z-index: 2; top: 61px; width: 10px; height: 23px; border-radius: 4px; background: #41352b; transform-origin: top; }
.left-leg { left: 16px; }.right-leg { left: 37px; }
.player.is-moving .left-leg { animation: walk-leg .25s ease-in-out infinite alternate; }
.player.is-moving .right-leg { animation: walk-leg .25s ease-in-out infinite alternate-reverse; }
.player.is-facing-left { transform: translate(-50%, -72%) scaleX(-1); }

.interaction-prompt { position: absolute; z-index: 40; left: 50%; bottom: 26px; padding: 9px 16px 9px 9px; display: flex; align-items: center; gap: 11px; border-radius: 999px; color: white; background: rgb(20 24 21 / 91%); box-shadow: var(--shadow-lg); transform: translateX(-50%); font-weight: 800; }
.interaction-prompt kbd { width: 34px; height: 34px; display: grid; place-items: center; border: 2px solid var(--yellow); border-radius: 50%; color: var(--ink); background: var(--yellow); font: 900 .85rem Inter, sans-serif; }
.mission-compass { position: absolute; z-index: 40; top: 22px; left: 50%; min-width: 190px; padding: 9px 14px 9px 10px; display: flex; align-items: center; gap: 10px; border: 1px solid rgb(255 255 255 / 55%); border-radius: 999px; color: white; background: rgb(23 24 17 / 82%); box-shadow: var(--shadow-sm); backdrop-filter: blur(8px); transform: translateX(-50%); pointer-events: none; }
.compass-arrow { width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; color: var(--ink); background: var(--yellow); font-size: 1.25rem; font-weight: 900; transition: transform .25s ease; }
.mission-compass small, .mission-compass strong { display: block; line-height: 1.15; }
.mission-compass small { margin-bottom: 3px; color: #ddd7c9; font-size: .61rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.mission-compass strong { font-size: .78rem; }
.trail-guide { position: absolute; z-index: 44; left: 24px; bottom: 24px; max-width: 370px; padding: 14px; display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 12px; border: 1px solid rgb(255 255 255 / 55%); border-radius: 10px; color: white; background: rgb(13 66 75 / 92%); box-shadow: var(--shadow-lg); backdrop-filter: blur(8px); transition: opacity .25s, transform .25s; }
.trail-guide.is-hidden { opacity: 0; transform: translateY(12px); pointer-events: none; }
.trail-guide > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: #302700; background: var(--yellow); }
.trail-guide p, .trail-guide strong, .trail-guide small { margin: 0; display: block; }
.trail-guide small { margin-top: 2px; color: rgb(255 255 255 / 78%); font-size: .7rem; }
.trail-guide button { padding: 7px 9px; border: 0; border-radius: 4px; color: #302700; background: var(--yellow); font-size: .68rem; font-weight: 800; }

.fact-toast, .feedback-toast { position: absolute; z-index: 42; top: 24px; left: 24px; width: min(420px, calc(100% - 48px)); padding: 15px 18px; display: flex; align-items: center; gap: 14px; border-left: 6px solid var(--yellow); border-radius: 6px; background: rgb(255 254 250 / 96%); box-shadow: var(--shadow-lg); animation: toast-in .25s ease-out; }
.fact-toast > span, .feedback-toast > span { flex: 0 0 auto; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: #453500; background: var(--yellow); font-weight: 900; }
.fact-toast p, .feedback-toast p { margin: 0; }
.fact-toast strong, .fact-toast p span, .feedback-toast strong, .feedback-toast p span { display: block; }
.fact-toast strong, .feedback-toast strong { color: var(--navy); font-size: .73rem; letter-spacing: .08em; text-transform: uppercase; }
.fact-toast p span, .feedback-toast p span { font-size: .88rem; }
.feedback-toast { left: 50%; border-left: 0; transform: translateX(-50%); }
.feedback-toast > span { color: white; background: var(--green); }

/* ---------- Mission panel ---------- */

.mission-panel { z-index: 30; padding: 24px; overflow-y: auto; border-left: 1px solid #c8bfaf; background: rgb(252 249 242 / 98%); box-shadow: -9px 0 24px rgb(30 25 18 / 12%); }
.mission-now { position: relative; padding: 22px 18px; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: var(--shadow-sm); }
.mission-number { position: absolute; top: 10px; right: 14px; color: #ded5c5; font: 900 2.5rem "Arial Black", sans-serif; }
.mission-now h2 { position: relative; margin: 0 0 8px; color: #503d0d; font-size: 1.45rem; line-height: 1.13; }
#mission-description { margin: 0; color: #5d5e55; font-size: .86rem; }
.mission-now .mission-progress-label { margin: 14px 0 6px; color: #756c60; font-size: .68rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.journey-track { height: 7px; overflow: hidden; border-radius: 999px; background: #ddd5c6; }
.journey-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--yellow); transition: width .45s ease; }

.hope-section { margin: 24px 0; }
.hope-heading { margin-bottom: 8px; display: flex; justify-content: space-between; align-items: end; color: #493800; font-weight: 800; }
.hope-heading strong { font-size: 1.55rem; }
.hope-track { height: 16px; overflow: hidden; border: 2px solid #423a2b; border-radius: 999px; background: #ddd7cd; }
.hope-track i { display: block; width: 18%; height: 100%; border-radius: inherit; background: #a2743f; transition: width 1s ease, background 1s ease; }
.hope-track.recovering i { background: var(--blue); }
.hope-track.thriving i { background: var(--yellow); }
.hope-labels { display: flex; justify-content: space-between; color: #746f64; font-size: .58rem; font-weight: 800; text-transform: uppercase; }

.impact-list { margin: 0; padding: 0; }
.impact-list div { padding: 10px 0; display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid #ded7ca; }
.impact-list dt { color: #64645c; font-size: .78rem; }
.impact-list dd { margin: 0; color: var(--ink); font-size: .82rem; font-weight: 900; text-align: right; }

.inventory { margin-top: 22px; }
.inventory-slots { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inventory-slots div { min-height: 68px; padding: 8px; display: grid; place-items: center; border: 1px dashed #aaa194; border-radius: 8px; color: #8b877e; background: #eeeae3; }
.inventory-slots div.is-filled { border: 2px solid #7a5b00; color: #3e3000; background: #ffec9c; box-shadow: var(--shadow-sm); }
.inventory-slots span, .inventory-slots small { display: block; }
.inventory-slots span { font-size: 1.35rem; }
.inventory-slots small { font-weight: 800; }
.discoveries { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.badge-row { display: flex; flex-wrap: wrap; gap: 7px; }
.explorer-badge { padding: 6px 9px; border-radius: 999px; color: white; background: var(--navy); font-size: .67rem; font-weight: 800; animation: toast-in .25s ease-out; }
.empty-badges { color: #756c60; font-size: .72rem; }

.mission-drawer { position: fixed; z-index: 500; top: var(--header-height); right: 0; bottom: 0; width: min(390px, 100%); padding: 24px; overflow-y: auto; border-left: 1px solid var(--line); background: var(--paper); box-shadow: -20px 0 50px rgb(0 0 0 / 25%); }
.drawer-heading { display: flex; align-items: center; justify-content: space-between; }
.drawer-heading h2 { color: #755b00; }
.drawer-heading button { width: 44px; height: 44px; border: 0; border-radius: 50%; background: #eeeae3; font-size: 1.5rem; }
.mission-drawer ol { padding-left: 0; list-style: none; }
.mission-drawer li { margin: 10px 0; padding: 14px; display: grid; grid-template-columns: 30px 1fr; gap: 10px; border: 1px solid #ded7ca; border-radius: 8px; }
.mission-drawer li.is-complete { color: #42643a; background: #edf4e8; }
.mission-drawer li.is-current { border-color: var(--yellow-dark); background: #fff4c7; }
.mission-drawer li span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: #eeeae3; font-weight: 900; }
.mission-drawer li.is-complete span { color: white; background: var(--green); }
.mission-drawer li strong, .mission-drawer li small { display: block; }

/* ---------- Mobile controls ---------- */

.mobile-controls { position: absolute; z-index: 50; right: 18px; bottom: 18px; width: 166px; height: 166px; display: none; }
.move-button, .interact-button { position: absolute; width: 54px; height: 54px; border: 1px solid rgb(255 255 255 / 65%); border-radius: 50%; color: white; background: rgb(20 24 21 / 76%); box-shadow: var(--shadow-sm); font-weight: 900; touch-action: none; }
.move-button.is-pressed { color: var(--ink); background: var(--yellow); }
.move-up { top: 0; left: 56px; }.move-left { top: 56px; left: 0; }.move-down { top: 112px; left: 56px; }.move-right { top: 56px; left: 112px; }
.interact-button { top: 53px; left: 53px; width: 60px; height: 60px; color: var(--ink); background: var(--yellow); font-size: .68rem; }

/* ---------- Dialogs ---------- */

.how-dialog, .pause-dialog { width: min(850px, calc(100% - 32px)); padding: clamp(28px, 5vw, 56px); border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: var(--paper); box-shadow: var(--shadow-lg); }
.how-dialog::backdrop, .pause-dialog::backdrop { background: rgb(13 18 16 / 70%); backdrop-filter: blur(5px); }
.how-dialog h2, .pause-dialog h2 { margin: 0 0 12px; color: #755b00; font-size: clamp(2rem, 5vw, 3.5rem); line-height: 1; }
.dialog-close { position: absolute; top: 15px; right: 15px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: #ede9df; font-size: 1.6rem; }
.how-grid { margin: 30px 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.how-grid article { padding: 20px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.how-grid article > span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 8px; color: #4a3900; background: var(--yellow); font-weight: 900; }
.how-grid h3 { margin: 16px 0 5px; }
.how-grid p { margin: 0; color: #5b5a52; font-size: .88rem; }
.pause-dialog { max-width: 470px; text-align: center; }
.pause-dialog .primary-button, .pause-dialog .ghost-button, .pause-dialog .text-button { width: 100%; margin-top: 12px; }

/* ---------- Results ---------- */

.result-screen { position: relative; min-height: 100vh; padding: 60px 20px; display: grid; place-items: center; overflow: hidden; }
.result-backdrop { position: absolute; inset: 0; background: linear-gradient(rgb(36 29 19 / 52%), rgb(36 29 19 / 62%)), url("assets/images/kumbala-savanna.png") center / cover; filter: saturate(.7); transform: scale(1.03); }
.result-backdrop.is-restored { background: linear-gradient(rgb(20 56 43 / 22%), rgb(26 49 32 / 34%)), url("assets/images/kumbala-savanna.png") center / cover; filter: saturate(1.25) brightness(1.08); }
.result-card { position: relative; z-index: 2; width: min(1050px, 100%); padding: clamp(32px, 6vw, 72px); border: 1px solid var(--line); border-radius: 18px; background: rgb(255 254 250 / 96%); box-shadow: var(--shadow-lg); text-align: center; }
.result-symbol { width: 100px; height: 100px; margin: 0 auto 24px; display: grid; place-items: center; border: 13px solid #e1f2f4; border-radius: 50%; color: #4a3900; background: var(--yellow); box-shadow: var(--shadow-sm); font-size: 2.5rem; }
.quiet-symbol { color: var(--navy); background: white; }
.result-card h1 { margin: 0; color: #755b00; font-size: clamp(2.8rem, 7vw, 5rem); line-height: 1; }
.result-lead { font-size: 1.25rem; }
.result-score { margin: 10px 0 0; color: #5d5e55; font-size: .92rem; font-weight: 700; }
.result-score.is-champion { color: #2f6d33; }
.result-impact { margin: 32px 0; display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.result-impact div { padding: 22px; border-right: 1px solid var(--line); background: white; }
.result-impact div:last-child { border: 0; }
.result-impact strong, .result-impact span { display: block; }
.result-impact strong { color: #755b00; font-size: 2rem; }
.result-impact span { color: #64645c; font-size: .78rem; font-weight: 800; text-transform: uppercase; }
.result-card blockquote { margin: 22px auto 32px; padding: 20px; max-width: 720px; border-left: 5px solid var(--yellow); color: var(--navy); background: #eff6f7; font-size: 1.2rem; font-style: italic; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.split-card { display: grid; grid-template-columns: .8fr 1.2fr; gap: 55px; text-align: left; }
.split-card .result-symbol { margin-left: 0; }
.split-card h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
.vertical-actions { align-items: stretch; flex-direction: column; }
.celebration { position: fixed; z-index: 5; inset: 0; overflow: hidden; pointer-events: none; }
.celebration-piece { position: absolute; top: -30px; width: 11px; height: 20px; animation: celebrate-fall 3s linear forwards; }

/* ---------- Animation ---------- */

@keyframes marker-pulse { 50% { transform: scale(1.08); } }
@keyframes walk-leg { to { transform: rotate(24deg); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }
@keyframes water-shimmer { to { filter: brightness(1.18); transform: translateY(4px); } }
@keyframes birds-fly { from { transform: translateX(-250px); } to { transform: translateX(700px); } }
@keyframes leaf-drift { 0% { transform: translate(-30px, -20px) rotate(0); } 50% { transform: translate(55px, 45px) rotate(190deg); } 100% { transform: translate(120px, 110px) rotate(380deg); } }
@keyframes target-bob { from { transform: translateY(0) scale(.9); } to { transform: translateY(-8px) scale(1.06); } }
@keyframes gazelle-return { to { transform: translate(-50%, -50%) translateX(40px); } }
@keyframes celebrate-fall { to { transform: translateY(110vh) rotate(720deg); } }
@keyframes points-float { from { opacity: 0; transform: translate(-50%, -100%) translateY(0); } 18% { opacity: 1; } to { opacity: 0; transform: translate(-50%, -100%) translateY(-64px); } }

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  :root { --header-height: 72px; }
  .game-hud { padding: 0 14px; grid-template-columns: auto 1fr auto; gap: 14px; }
  .hud-vitals { display: none; }
  .hud-impact { justify-content: end; gap: 18px; }
  .game-layout { grid-template-columns: 1fr 290px; }
  .mission-panel { padding: 16px; }
  .intro-scene { grid-template-columns: 1fr .75fr; }
}

@media (max-width: 768px) {
  :root { --header-height: 64px; }
  .intro-screen { grid-template-rows: 64px 1fr auto; }
  .intro-header { padding: 0 16px; }
  .intro-nav { display: none; }
  .wordmark { font-size: 1.2rem; }
  .intro-scene { min-height: 820px; padding: 48px 16px 70px; grid-template-columns: 1fr; align-content: center; gap: 30px; }
  .intro-shade { background: linear-gradient(rgb(5 112 128 / 94%), rgb(8 130 148 / 86%)); }
  .intro-content { text-align: center; }
  .intro-content h1 { font-size: clamp(2.35rem, 9vw, 3.3rem); }
  .intro-story { margin-inline: auto; }
  .intro-actions { flex-direction: column; }
  .village-brief { width: 100%; max-width: 560px; justify-self: center; padding: 24px; }
  .intro-footer { flex-direction: column; justify-content: center; text-align: center; }
  .charity-links { justify-content: center; }

  .game-screen { min-height: 500px; }
  .game-hud { grid-template-columns: 1fr auto; }
  .hud-brand strong { font-size: 1rem; }
  .hud-impact { position: absolute; top: 64px; left: 0; right: 0; height: 48px; padding: 6px 14px; justify-content: space-around; border-bottom: 1px solid rgb(255 255 255 / 25%); color: white; background: rgb(20 24 21 / 82%); backdrop-filter: blur(4px); }
  .hud-impact span { color: #dedfd8; }
  .hud-actions { justify-content: end; }
  .game-layout { height: calc(100dvh - var(--header-height)); display: block; }
  .world-viewport { width: 100%; height: 100%; padding-top: 48px; }
  .mission-panel { position: absolute; z-index: 35; top: 124px; left: 12px; width: min(270px, calc(100% - 24px)); max-height: 190px; padding: 12px; overflow: hidden; border: 0; border-radius: 10px; background: rgb(252 249 242 / 91%); box-shadow: var(--shadow-lg); pointer-events: none; }
  .mission-now { padding: 10px 12px; border: 0; background: transparent; box-shadow: none; }
  .mission-now .panel-label { margin-bottom: 2px; font-size: .6rem; }
  .mission-now h2 { margin: 0 0 3px; font-size: 1rem; }
  #mission-description { font-size: .72rem; }
  .mission-number { font-size: 1.6rem; }
  .hope-section { margin: 7px 12px 0; }
  .hope-heading { margin: 0; font-size: .68rem; }
  .hope-heading strong { font-size: .85rem; }
  .hope-track { height: 10px; }
  .hope-labels, .impact-list, .inventory, .discoveries { display: none; }
  .mobile-controls { display: block; }
  .interaction-prompt { bottom: 196px; }
  .mission-compass { top: 322px; bottom: auto; min-width: 170px; }
  .mission-compass small { display: none; }
  .trail-guide { right: 14px; bottom: 200px; left: 14px; max-width: none; grid-template-columns: 32px 1fr auto; }
  .fact-toast, .feedback-toast { top: auto; bottom: 200px; left: 14px; width: calc(100% - 28px); }
  .feedback-toast { transform: none; }
  .how-grid { grid-template-columns: 1fr; }
  .split-card { grid-template-columns: 1fr; gap: 28px; text-align: center; }
  .split-card .result-symbol { margin-inline: auto; }
}

@media (max-width: 480px) {
  .hud-brand strong { display: none; }
  .hud-impact div { min-width: 55px; }
  .hud-actions .round-button { width: 42px; height: 42px; }
  .mission-panel { top: 118px; }
  .result-screen { padding: 24px 12px; }
  .result-card { padding: 28px 18px; }
  .result-impact { grid-template-columns: 1fr; }
  .result-impact div { padding: 13px; border-right: 0; border-bottom: 1px solid var(--line); }
  .result-actions { flex-direction: column; }
  .how-dialog { padding: 44px 20px 24px; }
}

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