:root {
  --game-ink: #102f38;
  --game-ink-soft: #31535b;
  --game-sky: #79d7f2;
  --game-sky-soft: #dff7fb;
  --game-jungle: #2f9f8f;
  --game-jungle-dark: #17776d;
  --game-laterite: #c7653c;
  --game-sun: #ffd45a;
  --game-paper: #fff9e9;
  --game-white: #fffef8;
  --game-danger: #d94d45;
  --game-shadow: 0 18px 50px rgba(9, 43, 50, .2);
  --game-radius: 28px;
}

*, *::before, *::after { box-sizing: border-box; }

html { min-height: 100%; background: var(--game-ink); }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--game-ink);
  background: var(--game-paper);
  font-family: "IBM Plex Sans Thai", system-ui, sans-serif;
  line-height: 1.5;
}

button, a, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
[hidden] { display: none !important; }

.game-skip {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 999;
  padding: 10px 16px;
  color: #fff;
  background: var(--game-ink);
  border-radius: 12px;
  transform: translateY(-150%);
}
.game-skip:focus { transform: translateY(0); }

:focus-visible {
  outline: 4px solid #fff;
  box-shadow: 0 0 0 7px var(--game-laterite);
}

.game-shell { min-height: 100vh; overflow: hidden; }

.game-hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  min-height: 72px;
  padding: max(10px, env(safe-area-inset-top)) clamp(14px, 3vw, 42px) 10px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  color: #fff;
  background: rgba(12, 47, 56, .94);
  border-bottom: 1px solid rgba(255,255,255,.16);
  backdrop-filter: blur(16px);
}

.game-brand {
  width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
}
.game-brand img { width: 42px; height: 42px; border-radius: 14px; }
.game-brand span { display: grid; }
.game-brand strong {
  font-family: "Mitr", sans-serif;
  font-size: 15px;
  line-height: 1.1;
  letter-spacing: .08em;
}
.game-brand small { margin-top: 3px; font-size: 10px; color: #b9dfe5; }

.hud-progress { display: flex; align-items: center; gap: 12px; }
.hud-progress > span {
  color: #b9dfe5;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
}
.hud-stamps { display: flex; gap: 7px; }
.hud-stamp {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: #668087;
  background: rgba(255,255,255,.08);
  border: 1px dashed rgba(255,255,255,.28);
  border-radius: 50%;
  font-size: 15px;
  transition: transform .3s ease, background .3s ease;
}
.hud-stamp.earned {
  color: var(--game-ink);
  background: var(--game-sun);
  border-color: #fff2ad;
  transform: rotate(-8deg) scale(1.06);
}

.hud-actions { justify-self: end; display: flex; gap: 8px; }
.hud-button {
  min-width: 50px;
  min-height: 44px;
  padding: 5px 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #fff;
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 14px;
  cursor: pointer;
}
.hud-button:hover { background: rgba(255,255,255,.17); }
.hud-button-label { font-size: 11px; }

.game-button {
  min-height: 50px;
  padding: 12px 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 17px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.game-button:hover { transform: translateY(-2px); }
.game-button:active { transform: translateY(1px); }
.game-button-primary {
  color: var(--game-ink);
  background: var(--game-sun);
  box-shadow: 0 5px 0 #d59c22;
}
.game-button-primary:hover { background: #ffe183; box-shadow: 0 7px 0 #d59c22; }
.game-button-quiet {
  color: var(--game-ink);
  background: rgba(255,255,255,.74);
  border: 1px solid rgba(16,47,56,.18);
}

/* Intro — the hero is the first playable story beat. */
.intro-screen {
  position: relative;
  min-height: 100vh;
  padding: 130px clamp(24px, 8vw, 120px) 70px;
  display: grid;
  grid-template-columns: minmax(0, 700px) 220px;
  align-items: center;
  gap: 8vw;
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(180deg, rgba(121,215,242,.8), rgba(223,247,251,.95) 48%, #b6dfc0 49%, #497b65 100%),
    url('../assets/images/phamo-topography-2026.webp') center/cover;
}
.intro-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -3;
  opacity: .2;
  background-image: url('../assets/images/phamo-topography-2026.webp');
  background-size: cover;
  mix-blend-mode: multiply;
}
.intro-sky { position: absolute; inset: 0; z-index: -2; overflow: hidden; }
.intro-sun {
  position: absolute;
  top: 16%;
  right: 14%;
  width: clamp(85px, 11vw, 155px);
  aspect-ratio: 1;
  background: var(--game-sun);
  border-radius: 50%;
  box-shadow: 0 0 0 20px rgba(255,212,90,.18), 0 0 0 44px rgba(255,212,90,.1);
}
.intro-ridge {
  position: absolute;
  left: -8%;
  right: -8%;
  bottom: -16%;
  height: 48%;
  background: #2d6658;
  clip-path: polygon(0 52%, 12% 28%, 22% 50%, 33% 10%, 47% 46%, 61% 20%, 74% 43%, 85% 18%, 100% 51%, 100% 100%, 0 100%);
}
.intro-ridge-back { bottom: 6%; opacity: .35; transform: scale(1.2); }
.intro-ridge-front { background: #174b43; }

.intro-copy { max-width: 680px; z-index: 1; }
.intro-kicker, .map-kicker, .journal-kicker, .final-kicker {
  display: inline-block;
  margin-bottom: 12px;
  color: #124f58;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.intro-copy h1, .map-heading h1, .final-passport h1 {
  margin: 0;
  font-family: "Mitr", sans-serif;
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -.035em;
}
.intro-copy h1 { max-width: 760px; font-size: clamp(48px, 7vw, 104px); }
.intro-copy h1 em, .final-passport h1 em { color: var(--game-laterite); font-style: normal; }
.intro-copy > p {
  max-width: 610px;
  margin: 24px 0;
  color: #173f47;
  font-size: clamp(17px, 2vw, 21px);
}
.intro-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.intro-copy > small { display: block; margin-top: 18px; color: #315e64; }

.intro-field-note {
  width: 210px;
  aspect-ratio: .76;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--game-ink);
  background: var(--game-paper);
  border: 2px solid #e0cda8;
  border-radius: 10px 24px 12px 20px;
  box-shadow: 16px 18px 0 rgba(16,47,56,.16), var(--game-shadow);
  transform: rotate(5deg);
}
.intro-field-note::before, .intro-field-note::after {
  content: "";
  width: 82%;
  border-top: 2px dashed #d2b87d;
  margin: 16px 0;
}
.intro-field-note span { font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.intro-field-note strong { font: 600 40px/1 "Mitr", sans-serif; color: var(--game-laterite); }
.intro-field-note i { font-style: normal; font-size: 13px; }
.intro-field-note b { font: 600 68px/1 "Mitr", sans-serif; color: var(--game-jungle); }

/* Journey map */
.map-screen {
  min-height: 100vh;
  padding: 118px clamp(16px, 4vw, 62px) 42px;
  background: #eaf5df;
}
.map-heading {
  max-width: 1480px;
  margin: 0 auto 24px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
}
.map-heading h1 { font-size: clamp(30px, 4vw, 58px); }
.map-heading > p { max-width: 340px; margin: 0 0 8px; color: var(--game-ink-soft); }
.map-layout {
  max-width: 1480px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 350px);
  gap: 20px;
}
.journey-map {
  position: relative;
  min-height: 570px;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(121,215,242,.68), rgba(255,249,233,.64) 42%, rgba(102,175,130,.48)),
    url('../assets/images/phamo-topography-2026.webp') center/cover;
  border: 8px solid var(--game-white);
  border-radius: 34px;
  box-shadow: var(--game-shadow);
  isolation: isolate;
}
.journey-map::after {
  content: "";
  position: absolute;
  inset: 12px;
  z-index: -1;
  pointer-events: none;
  border: 2px dashed rgba(16,47,56,.2);
  border-radius: 22px;
}
.map-texture {
  position: absolute;
  inset: 0;
  z-index: -2;
  opacity: .22;
  background: repeating-linear-gradient(15deg, transparent 0 18px, rgba(16,47,56,.1) 19px 20px);
}
.province-label {
  position: absolute;
  z-index: 1;
  color: rgba(16,47,56,.42);
  font-family: "Mitr", sans-serif;
  font-size: clamp(17px, 2vw, 28px);
  font-weight: 600;
  letter-spacing: .03em;
}
.province-one { left: 7%; top: 20%; transform: rotate(-6deg); }
.province-two { left: 41%; top: 59%; transform: rotate(5deg); }
.province-three { right: 6%; top: 12%; transform: rotate(-3deg); }
.map-compass {
  position: absolute;
  top: 22px;
  right: 28px;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: var(--game-ink);
  border: 1px solid rgba(16,47,56,.28);
  border-radius: 50%;
  font: 700 11px/1 monospace;
}
.map-compass i { position: absolute; bottom: 5px; border: 7px solid transparent; border-top: 14px solid var(--game-laterite); }
.map-scenery { position: absolute; z-index: 0; opacity: .62; font-size: 30px; filter: saturate(.8); }
.scenery-one { left: 31%; bottom: 8%; }
.scenery-two { left: 62%; top: 10%; font-size: 42px; }
.scenery-three { right: 5%; bottom: 13%; }
.map-river {
  position: absolute;
  right: -6%;
  bottom: 1%;
  width: 37%;
  height: 34%;
  border: 12px solid rgba(62,160,192,.32);
  border-left: 0;
  border-bottom: 0;
  border-radius: 70% 0 0 0;
  transform: rotate(-16deg);
}

.route-line { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.route-line path { fill: none; stroke-linecap: round; }
.route-shadow { stroke: rgba(16,47,56,.16); stroke-width: 13; }
.route-track { stroke: #fff9e9; stroke-width: 7; stroke-dasharray: 3 18; }
.route-complete {
  stroke: var(--game-laterite);
  stroke-width: 6;
  stroke-dasharray: 10 10;
  transition: stroke-dashoffset 1s ease;
}

.map-node {
  position: absolute;
  z-index: 5;
  width: 150px;
  min-height: 100px;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--game-ink);
  background: transparent;
  border: 0;
  cursor: pointer;
  transform: translate(-50%, -50%);
}
.node-one { left: 10.5%; top: 74.4%; }
.node-two { left: 47%; top: 33.2%; }
.node-three { left: 89%; top: 51.6%; }
.node-pin {
  position: relative;
  z-index: 2;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--game-laterite);
  border: 5px solid #fffdf5;
  border-radius: 50%;
  box-shadow: 0 7px 16px rgba(16,47,56,.24);
  font: 600 21px/1 "Mitr", sans-serif;
}
.map-node strong, .map-node small {
  position: relative;
  z-index: 2;
  padding: 2px 8px;
  background: rgba(255,249,233,.86);
  border-radius: 7px;
  backdrop-filter: blur(5px);
}
.map-node strong { margin-top: 7px; font-size: 14px; }
.map-node small { color: var(--game-ink-soft); font-size: 11px; }
.node-pulse {
  position: absolute;
  top: 4px;
  width: 52px;
  height: 52px;
  background: rgba(199,101,60,.25);
  border-radius: 50%;
  animation: nodePulse 2s ease-out infinite;
}
.map-node.locked { filter: grayscale(.8); opacity: .55; cursor: not-allowed; }
.map-node.locked .node-pin { background: #6d8586; }
.map-node.completed .node-pin { color: var(--game-ink); background: var(--game-sun); }
.map-node.selected .node-pin { box-shadow: 0 0 0 8px rgba(255,212,90,.35), 0 7px 16px rgba(16,47,56,.24); }
@keyframes nodePulse { to { transform: scale(1.8); opacity: 0; } }

.traveler {
  --traveler-x: 10.5%;
  --traveler-y: 74.4%;
  position: absolute;
  left: var(--traveler-x);
  top: var(--traveler-y);
  z-index: 8;
  width: 46px;
  height: 52px;
  filter: drop-shadow(0 6px 4px rgba(16,47,56,.25));
  transform: translate(-50%, -112%);
  transition: left 1.25s cubic-bezier(.3,.7,.25,1), top 1.25s cubic-bezier(.3,.7,.25,1);
  pointer-events: none;
}
.traveler-face {
  position: absolute;
  left: 6px;
  top: 14px;
  width: 36px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #54361d;
  background: #efb37b;
  border: 3px solid var(--game-ink);
  border-radius: 48% 48% 44% 44%;
  font: 700 12px/1 sans-serif;
}
.traveler-hat {
  position: absolute;
  left: 2px;
  top: 4px;
  z-index: 2;
  width: 43px;
  height: 16px;
  background: var(--game-sun);
  border: 3px solid var(--game-ink);
  border-radius: 50% 50% 20% 20%;
}
.traveler-hat::after { content: ""; position: absolute; left: -7px; right: -7px; bottom: -5px; border-top: 6px solid var(--game-ink); border-radius: 50%; }
.traveler-pack { position: absolute; right: -3px; bottom: 0; width: 15px; height: 25px; background: var(--game-laterite); border: 3px solid var(--game-ink); border-radius: 6px; }
.traveler.walking { animation: travelerBob .3s ease-in-out infinite alternate; }
@keyframes travelerBob { to { margin-top: -7px; transform: translate(-50%, -112%) rotate(2deg); } }

.route-card {
  overflow: hidden;
  color: var(--game-ink);
  background: var(--game-white);
  border: 2px solid #dfd3ac;
  border-radius: 28px 28px 13px 28px;
  box-shadow: var(--game-shadow);
}
.route-card-number {
  position: absolute;
  z-index: 2;
  margin: 16px;
  padding: 7px 11px;
  color: #fff;
  background: var(--game-ink);
  border-radius: 999px;
  font: 700 11px/1 monospace;
  letter-spacing: .08em;
}
.route-card-image { height: 180px; overflow: hidden; background: var(--game-sky-soft); }
.route-card-image img { width: 100%; height: 100%; object-fit: cover; }
.route-card-copy { padding: 20px; }
.route-card-copy > span { color: var(--game-laterite); font-size: 12px; font-weight: 700; }
.route-card-copy h2 { margin: 4px 0 8px; font: 600 25px/1.2 "Mitr", sans-serif; }
.route-card-copy p { min-height: 78px; margin: 0; color: var(--game-ink-soft); font-size: 14px; }
.route-card-reward {
  margin: 16px 0;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #fff2bd;
  border: 1px dashed #d2a92c;
  border-radius: 12px;
  font-size: 12px;
}
.route-card-reward span { color: #826411; }
.route-card .game-button { width: 100%; }
.route-card.is-complete .game-button { color: #fff; background: var(--game-jungle); box-shadow: 0 5px 0 var(--game-jungle-dark); }

/* Mission */
.mission-screen { min-height: 100vh; padding-top: 72px; background: var(--game-paper); }
.mission-scene {
  position: relative;
  min-height: clamp(270px, 42vh, 440px);
  padding: 38px clamp(18px, 5vw, 70px);
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  overflow: hidden;
  color: #fff;
  background-position: center;
  background-size: cover;
  isolation: isolate;
}
.mission-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(7,28,34,.14), rgba(7,28,34,.82));
}
.mission-back {
  position: absolute;
  top: 20px;
  left: clamp(18px, 5vw, 70px);
  min-height: 44px;
  padding: 8px 14px;
  color: #fff;
  background: rgba(16,47,56,.75);
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.mission-place span { color: var(--game-sun); font-size: 12px; font-weight: 800; letter-spacing: .1em; }
.mission-place h1 { margin: 4px 0 0; font: 600 clamp(34px, 5vw, 68px)/1 "Mitr", sans-serif; }
.mission-counter {
  min-width: 105px;
  padding: 13px 16px;
  display: grid;
  text-align: center;
  background: rgba(16,47,56,.82);
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 18px;
  backdrop-filter: blur(9px);
}
.mission-counter span { color: #bce7e9; font-size: 11px; }
.mission-counter strong { color: var(--game-sun); font: 600 24px/1.2 "Mitr", sans-serif; }
.mission-workbench { max-width: 1180px; margin: -20px auto 0; padding: 0 20px 60px; position: relative; z-index: 2; }
.owl-briefing {
  padding: 18px 20px;
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: center;
  gap: 15px;
  background: var(--game-white);
  border: 2px solid #ded2ad;
  border-radius: 24px 24px 9px 24px;
  box-shadow: 0 10px 28px rgba(16,47,56,.14);
}
.owl-avatar { width: 54px; height: 54px; display: grid; place-items: center; background: var(--game-sun); border-radius: 18px; font-size: 29px; transform: rotate(-4deg); }
.owl-briefing span { color: var(--game-laterite); font-size: 11px; font-weight: 800; letter-spacing: .06em; }
.owl-briefing p { margin: 2px 0 0; font-size: 15px; }
.replay-voice {
  min-height: 44px;
  padding: 8px 12px;
  color: var(--game-ink);
  background: var(--game-sky-soft);
  border: 1px solid #abd9e2;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.mission-game { margin-top: 18px; }
.game-panel {
  --game-panel-padding: clamp(18px, 4vw, 34px);
  padding: var(--game-panel-padding);
  background: var(--game-white);
  border: 2px solid #ded2ad;
  border-radius: 28px;
  box-shadow: 0 12px 35px rgba(16,47,56,.13);
}
.panel-heading { max-width: 700px; margin-bottom: 18px; }
.panel-heading span { color: var(--game-laterite); font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.panel-heading h2 { margin: 4px 0 6px; font: 600 clamp(23px, 3vw, 34px)/1.2 "Mitr", sans-serif; }
.panel-heading p { margin: 0; color: var(--game-ink-soft); }

/* Hotspot game */
.hunt-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(245px, .55fr); gap: 18px; }
.hunt-scene {
  position: relative;
  min-height: 420px;
  overflow: hidden;
  background-position: center;
  background-size: cover;
  border-radius: 21px;
}
.hunt-scene::after { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 2px rgba(255,255,255,.5), inset 0 -90px 80px rgba(9,43,50,.26); }
.hunt-hotspot {
  position: absolute;
  z-index: 2;
  width: 50px;
  height: 50px;
  color: var(--game-ink);
  background: var(--game-sun);
  border: 4px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 10px rgba(255,212,90,.25), 0 5px 16px rgba(16,47,56,.32);
  font-weight: 800;
  cursor: pointer;
  animation: clueBeacon 1.4s ease-in-out infinite alternate;
}
.hunt-hotspot.found { color: #fff; background: var(--game-jungle); animation: none; box-shadow: 0 5px 16px rgba(16,47,56,.32); }
.hunt-hotspot:nth-child(1) { left: 20%; top: 59%; }
.hunt-hotspot:nth-child(2) { left: 53%; top: 44%; }
.hunt-hotspot:nth-child(3) { right: 13%; top: 27%; }
@keyframes clueBeacon { to { transform: scale(1.12); box-shadow: 0 0 0 17px rgba(255,212,90,.08), 0 5px 16px rgba(16,47,56,.32); } }
.clue-list { display: grid; align-content: start; gap: 10px; }
.clue-slot {
  min-height: 92px;
  padding: 13px;
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 10px;
  background: #edf1e7;
  border: 1px dashed #aebbaa;
  border-radius: 15px;
  color: #718078;
}
.clue-slot > span { width: 38px; height: 38px; display: grid; place-items: center; background: rgba(255,255,255,.7); border-radius: 11px; }
.clue-slot strong { display: block; font-size: 13px; }
.clue-slot small { display: block; font-size: 11px; }
.clue-slot.revealed { color: var(--game-ink); background: #fff4c8; border-color: #d8ae33; animation: revealClue .35s ease; }
@keyframes revealClue { from { transform: translateY(7px); opacity: .3; } }

/* Sun alignment game */
.sun-game { overflow: hidden; padding: 0; }
.sun-game .panel-heading { padding: 30px 30px 0; }
.temple-puzzle {
  position: relative;
  min-height: 330px;
  margin-top: 22px;
  overflow: hidden;
  background: linear-gradient(180deg, #79d7f2 0 45%, #d69b62 46% 100%);
  border-top: 2px solid #ded2ad;
}
.temple-sun {
  position: absolute;
  left: var(--sun-position, 12%);
  top: 38px;
  z-index: 1;
  width: 64px;
  height: 64px;
  background: var(--game-sun);
  border-radius: 50%;
  box-shadow: 0 0 0 16px rgba(255,212,90,.22);
  transform: translateX(-50%);
  transition: left .12s linear, box-shadow .25s ease;
}
.temple-beam {
  position: absolute;
  left: var(--sun-position, 12%);
  top: 98px;
  z-index: 0;
  width: 16px;
  height: 210px;
  background: linear-gradient(180deg, rgba(255,239,150,.86), rgba(255,239,150,0));
  filter: blur(5px);
  transform: translateX(-50%);
  transition: left .12s linear;
}
.temple-corridor { position: absolute; inset: 92px 5% 0; display: flex; align-items: end; justify-content: center; perspective: 680px; }
.temple-door {
  position: absolute;
  bottom: 0;
  width: calc(48px + var(--door-index) * 24px);
  height: calc(80px + var(--door-index) * 32px);
  border: calc(7px + var(--door-index) * 2px) solid #643c2c;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  box-shadow: 0 0 0 3px rgba(255,255,255,.12);
}
.temple-target { position: absolute; left: 72%; bottom: 24px; width: 34px; height: 34px; border: 4px solid #fff; border-radius: 50%; transform: translateX(-50%); box-shadow: 0 0 0 7px rgba(255,255,255,.2); }
.sun-game.aligned .temple-sun { box-shadow: 0 0 0 18px rgba(255,212,90,.3), 0 0 45px 25px rgba(255,247,187,.7); }
.sun-controls { padding: 21px 30px 30px; background: #fffaf0; }
.sun-controls label { display: flex; justify-content: space-between; gap: 12px; font-weight: 700; }
.sun-controls label span { color: var(--game-laterite); font-size: 12px; }
.sun-range { width: 100%; margin: 17px 0 20px; accent-color: var(--game-laterite); cursor: ew-resize; }
.sun-feedback { min-height: 24px; margin: 0 0 12px; color: var(--game-ink-soft); font-size: 13px; }

/* Timeline game */
.timeline-board { display: grid; grid-template-columns: minmax(220px,.65fr) minmax(0,1.35fr); gap: 20px; }
.timeline-slots { padding: 18px; display: grid; gap: 9px; background: #edf4e6; border-radius: 19px; }
.timeline-slot {
  min-height: 58px;
  padding: 10px 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,.65);
  border: 1px dashed #9db39c;
  border-radius: 12px;
}
.timeline-slot > span { width: 30px; height: 30px; display: grid; place-items: center; color: #fff; background: var(--game-jungle); border-radius: 50%; font: 700 12px/1 monospace; }
.timeline-slot p { margin: 0; color: #7c8b80; font-size: 12px; }
.timeline-slot.filled { background: #fff4c8; border-color: #d8ae33; animation: revealClue .3s ease; }
.timeline-slot.filled p { color: var(--game-ink); font-weight: 600; }
.evidence-deck { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 11px; }
.evidence-card {
  min-height: 116px;
  padding: 15px;
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 11px;
  text-align: left;
  color: var(--game-ink);
  background: var(--game-white);
  border: 2px solid #d9cda9;
  border-radius: 16px 16px 6px 16px;
  box-shadow: 0 4px 0 #d9cda9;
  cursor: pointer;
  transition: transform .17s ease, border-color .17s ease;
}
.evidence-card:hover { transform: translateY(-3px) rotate(-.5deg); border-color: var(--game-laterite); }
.evidence-card > span { font-size: 30px; }
.evidence-card strong { display: block; font-size: 13px; }
.evidence-card small { display: block; margin-top: 3px; color: var(--game-ink-soft); font-size: 11px; }
.evidence-card.used { opacity: .35; transform: scale(.97); cursor: default; }
.evidence-card.wrong { animation: cardWrong .34s ease; border-color: var(--game-danger); }
@keyframes cardWrong { 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }

.mission-success {
  padding: 25px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 17px;
  color: #fff;
  background: var(--game-jungle-dark);
  border-radius: 22px;
  animation: successRise .45s ease;
}
.mission-success .success-stamp { width: 68px; height: 68px; display: grid; place-items: center; color: var(--game-ink); background: var(--game-sun); border: 3px dashed var(--game-laterite); border-radius: 50%; font-size: 32px; transform: rotate(-8deg); }
.mission-success h3 { margin: 0; font: 600 22px/1.25 "Mitr", sans-serif; }
.mission-success p { margin: 3px 0 0; color: #c9eeee; font-size: 13px; }
@keyframes successRise { from { transform: translateY(12px); opacity: 0; } }

/* Journal */
.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  padding: 90px 18px 18px;
  display: grid;
  place-items: center;
  background: rgba(6,30,36,.78);
  backdrop-filter: blur(9px);
}
.journal {
  position: relative;
  width: min(900px, 100%);
  max-height: calc(100vh - 110px);
  padding: clamp(22px, 4vw, 42px);
  overflow-y: auto;
  background:
    linear-gradient(90deg, transparent 38px, rgba(199,101,60,.17) 39px 41px, transparent 42px),
    repeating-linear-gradient(180deg, var(--game-paper) 0 33px, #dce6d3 34px 35px);
  border: 2px solid #d7c18f;
  border-radius: 16px 30px 17px 30px;
  box-shadow: 18px 20px 0 rgba(0,0,0,.14), var(--game-shadow);
}
.journal-close { position: absolute; top: 15px; right: 17px; width: 44px; height: 44px; background: #fff; border: 1px solid #cbbd98; border-radius: 50%; font-size: 27px; cursor: pointer; }
.journal h2 { margin: 0 0 14px; font: 600 clamp(28px,4vw,42px)/1.1 "Mitr", sans-serif; }
.journal-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; color: var(--game-ink-soft); font-size: 12px; }
.journal-progress i { flex: 1; height: 9px; overflow: hidden; background: #d8dfcd; border-radius: 99px; }
.journal-progress b { display: block; width: 0; height: 100%; background: var(--game-jungle); transition: width .4s ease; }
.journal-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 11px; }
.journal-clue { min-height: 120px; padding: 14px; background: rgba(255,255,255,.76); border: 1px dashed #b9aa83; border-radius: 13px; }
.journal-clue.locked { display: grid; place-items: center; color: #99a295; background: rgba(228,232,218,.58); }
.journal-clue > span { font-size: 25px; }
.journal-clue strong { display: block; margin-top: 5px; font-size: 13px; }
.journal-clue p { margin: 3px 0 0; color: var(--game-ink-soft); font-size: 11px; }
.journal-footer { margin-top: 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.text-button { padding: 8px; color: var(--game-danger); background: transparent; border: 0; text-decoration: underline; cursor: pointer; }

/* Finale */
.final-screen {
  position: relative;
  min-height: 100vh;
  padding: 120px 20px 50px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(circle at 50% 42%, #fff4bd 0 12%, #79d7f2 42%, #2f9f8f 100%);
}
.final-rays { position: absolute; width: 900px; aspect-ratio: 1; background: repeating-conic-gradient(from 0deg, rgba(255,255,255,.2) 0 8deg, transparent 8deg 17deg); animation: raySpin 35s linear infinite; }
@keyframes raySpin { to { transform: rotate(360deg); } }
.final-passport { position: relative; z-index: 1; width: min(660px,100%); padding: clamp(30px,6vw,65px); text-align: center; background: var(--game-paper); border: 3px solid #dcc38b; border-radius: 22px 50px 24px 50px; box-shadow: 20px 22px 0 rgba(16,47,56,.17), var(--game-shadow); }
.final-passport h1 { font-size: clamp(38px,6vw,68px); }
.final-passport > p { color: var(--game-ink-soft); }
.final-stamps { margin: 25px 0; display: flex; justify-content: center; gap: 13px; }
.final-stamp { width: 86px; height: 86px; display: grid; place-items: center; background: var(--game-sun); border: 4px double var(--game-laterite); border-radius: 50%; font-size: 37px; transform: rotate(var(--stamp-turn)); }
.final-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }

.game-toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 500;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 17px;
  color: #fff;
  background: var(--game-ink);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 14px;
  box-shadow: var(--game-shadow);
  opacity: 0;
  transform: translate(-50%, 18px);
  pointer-events: none;
  transition: .25s ease;
}
.game-toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .map-layout { grid-template-columns: 1fr; }
  .journey-map { min-height: 520px; }
  .route-card { display: grid; grid-template-columns: 230px 1fr; }
  .route-card-image { height: 100%; min-height: 260px; }
  .route-card-copy p { min-height: auto; }
  .hunt-layout { grid-template-columns: 1fr; }
  .clue-list { grid-template-columns: repeat(3,1fr); }
}

@media (max-width: 720px) {
  .game-hud { grid-template-columns: 1fr auto; gap: 8px; min-height: 64px; }
  .hud-progress { position: absolute; top: 67px; left: 50%; z-index: 4; padding: 6px 10px; color: #fff; background: rgba(16,47,56,.82); border-radius: 0 0 13px 13px; transform: translateX(-50%); }
  .hud-progress > span { display: none; }
  .hud-stamp { width: 27px; height: 27px; }
  .game-brand img { width: 38px; height: 38px; }
  .game-brand small, .hud-button-label { display: none; }
  .hud-button { min-width: 44px; padding: 5px; }
  .intro-screen { padding: 120px 20px 64px; display: flex; align-items: end; }
  .intro-copy h1 { font-size: clamp(45px, 15vw, 70px); }
  .intro-copy > p { font-size: 16px; }
  .intro-field-note { display: none; }
  .intro-sun { top: 16%; right: 12%; }
  .map-screen { padding: 112px 12px 30px; }
  .map-heading { display: block; padding: 0 6px; }
  .map-heading > p { margin-top: 12px; }
  .journey-map { min-height: 510px; border-width: 5px; }
  .province-label { font-size: 16px; }
  .map-node { width: 112px; }
  .node-pin { width: 52px; height: 52px; }
  .map-node strong { font-size: 12px; }
  .node-one { left: 13%; }
  .node-two { left: 49%; }
  .node-three { left: 87%; }
  .route-card { display: block; }
  .route-card-image { height: 180px; min-height: 0; }
  .mission-screen { padding-top: 64px; }
  .mission-scene { min-height: 300px; padding: 72px 18px 25px; }
  .mission-back { left: 17px; }
  .mission-counter { min-width: 88px; padding: 10px; }
  .mission-workbench { padding: 0 11px 45px; }
  .owl-briefing { grid-template-columns: auto 1fr; padding: 14px; }
  .replay-voice { grid-column: 1 / -1; width: 100%; }
  .game-panel { --game-panel-padding: 16px; padding: var(--game-panel-padding); border-radius: 20px; }
  .hunt-scene { min-height: 330px; }
  .clue-list { grid-template-columns: 1fr; }
  .clue-slot { min-height: 70px; }
  .sun-game { padding: 0; }
  .sun-game .panel-heading { padding: 20px 18px 0; }
  .sun-controls { padding: 18px; }
  .timeline-board { grid-template-columns: 1fr; }
  .timeline-slots { order: 2; }
  .evidence-deck { order: 1; }
  .evidence-card { min-height: 105px; padding: 12px; grid-template-columns: 34px 1fr; }
  .mission-success { grid-template-columns: auto 1fr; padding: 18px; }
  .mission-success .game-button { grid-column: 1 / -1; width: 100%; }
  .dialog-backdrop { padding: 78px 10px 10px; }
  .journal { max-height: calc(100vh - 88px); padding: 24px 18px; }
  .journal-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .journal-footer { align-items: stretch; flex-direction: column-reverse; }
  .journal-footer .game-button { width: 100%; }
}

@media (max-width: 430px) {
  .intro-actions { display: grid; }
  .intro-actions .game-button { width: 100%; }
  .map-heading h1 { font-size: 30px; }
  .journey-map { min-height: 470px; }
  .map-node small { display: none; }
  .map-node strong { max-width: 100px; }
  .node-one { left: 15%; top: 75%; }
  .node-two { left: 48%; top: 35%; }
  .node-three { left: 84%; top: 53%; }
  .mission-place h1 { font-size: 31px; }
  .mission-counter { min-width: 76px; }
  .journal-grid { grid-template-columns: 1fr; }
}

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

/* Journey V2 — ten-stage adaptive expedition. */
button, a, input, textarea { font: inherit; }

.game-hud {
  grid-template-columns: auto minmax(260px, 1fr) auto auto;
  gap: clamp(10px, 1.8vw, 24px);
}
.hud-progress { justify-content: center; min-width: 0; }
.hud-stamps { gap: 4px; }
.hud-stamp { width: 25px; height: 25px; font-size: 12px; }
.hud-intelligence {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
}
.hud-xp, .hud-energy, .hud-ai {
  min-height: 30px;
  padding: 6px 9px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 999px;
}
.hud-xp strong { color: var(--game-sun); font-size: 13px; }
.hud-energy { color: #ff7c74; letter-spacing: .04em; }
.hud-ai i { width: 7px; height: 7px; background: #70e3a4; border-radius: 50%; box-shadow: 0 0 0 3px rgba(112,227,164,.16); }
.hud-ai.thinking i { background: var(--game-sun); animation: aiPulse .8s ease-in-out infinite alternate; }
.hud-ai.offline i { background: #ff9e66; }
@keyframes aiPulse { to { opacity: .35; transform: scale(.7); } }

.journey-map-scroll {
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 34px;
  scrollbar-width: thin;
  scrollbar-color: var(--game-laterite) rgba(16,47,56,.12);
  overscroll-behavior-x: contain;
}
.journey-map-scroll:focus-visible { outline-offset: -7px; }
.journey-map-v2 { width: 100%; min-width: 900px; min-height: 610px; }
.map-node { left: var(--node-x); top: var(--node-y); width: 126px; }
.map-node strong { max-width: 124px; line-height: 1.22; text-align: center; }
.map-node small { max-width: 118px; line-height: 1.2; text-align: center; }
.province-sa-kaeo { left: 5%; top: 8%; transform: rotate(-5deg); }
.province-buriram { left: 29%; top: 50%; transform: rotate(4deg); }
.province-surin { left: 52%; top: 48%; transform: rotate(-4deg); }
.province-sisaket { right: 18%; top: 10%; transform: rotate(4deg); }
.province-ubon { right: 4%; bottom: 8%; transform: rotate(-3deg); }
.route-card-meta { margin: 3px 0 11px; display: flex; justify-content: space-between; gap: 10px; color: var(--game-jungle-dark); font-size: 12px; font-weight: 800; }
.route-card-meta span:last-child { color: #cc8c13; letter-spacing: .08em; }

.ai-coach {
  margin-top: 12px;
  padding: 13px 15px;
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: center;
  gap: 12px;
  color: #eafcff;
  background: linear-gradient(115deg, #173e49, #245a62);
  border: 1px solid rgba(121,215,242,.3);
  border-radius: 18px;
  box-shadow: 0 8px 22px rgba(16,47,56,.16);
}
.ai-coach-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--game-ink);
  background: var(--game-sun);
  border-radius: 50%;
  font: 800 12px/1 "Mitr", sans-serif;
  box-shadow: 0 0 0 5px rgba(255,212,90,.12);
}
.ai-coach-copy { min-width: 0; }
.ai-coach-copy strong { color: var(--game-sun); font-size: 12px; }
.ai-coach-copy p { margin: 2px 0 0; font-size: 13px; }
.ai-coach-copy p strong { display: block; color: #fff; font-size: 14px; }
.ai-coach-copy p span { display: block; margin-top: 2px; color: #c5e7eb; }
.ai-hint-button {
  min-height: 42px;
  padding: 8px 13px;
  color: #fff;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.ai-hint-button:hover { background: rgba(255,255,255,.18); }
.ai-hint-button:disabled { opacity: .65; cursor: wait; }

.game-feedback {
  min-height: 24px;
  margin: 16px 0 0;
  color: var(--game-ink-soft);
  font-weight: 600;
}

.stage-art-banner {
  position: relative;
  min-height: clamp(190px, 29vw, 300px);
  margin: calc(0px - var(--game-panel-padding)) calc(0px - var(--game-panel-padding)) 22px;
  overflow: hidden;
  background-color: #d9eee3;
  background-image: var(--stage-art-image);
  background-position: center;
  background-size: cover;
  border-radius: 26px 26px 8px 8px;
  isolation: isolate;
}
.stage-art-banner::after {
  content: "";
  position: absolute;
  inset: 38% 0 0;
  z-index: -1;
  background: linear-gradient(180deg, transparent, rgba(8,39,46,.68));
}
.stage-art-banner span {
  position: absolute;
  left: 16px;
  bottom: 14px;
  padding: 8px 12px;
  color: #fff;
  background: rgba(16,47,56,.84);
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 5px 14px rgba(8,39,46,.18);
  backdrop-filter: blur(7px);
}

/* Ordered evidence and architectural sequence. */
.order-progress { display: flex; align-items: stretch; gap: 7px; overflow-x: auto; padding: 3px 2px 10px; }
.order-progress span {
  min-width: 48px;
  min-height: 48px;
  padding: 8px;
  display: grid;
  place-items: center;
  color: #7a786d;
  background: #eee9da;
  border: 2px dashed #c9bfa0;
  border-radius: 13px;
  text-align: center;
  font-size: 12px;
  transition: .25s ease;
}
.order-progress span.filled { min-width: 116px; color: #fff; background: var(--game-jungle); border-style: solid; border-color: var(--game-jungle-dark); }
.order-deck { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 10px; }
.order-token {
  min-height: 52px;
  padding: 10px 16px;
  color: var(--game-ink);
  background: #fff2bd;
  border: 2px solid #e4c55f;
  border-radius: 14px;
  box-shadow: 0 4px 0 #cfaa35;
  font-weight: 700;
  cursor: pointer;
}
.order-token:hover { transform: translateY(-2px); }
.order-token.used { opacity: .35; box-shadow: none; transform: scale(.94); }
.order-token.wrong { animation: gameShake .3s ease; border-color: var(--game-danger); }
@keyframes gameShake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* Conservation decision game. */
.rebuild-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.rebuild-card {
  min-height: 132px;
  padding: 16px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--game-ink);
  background: #f8f0d8;
  border: 2px solid #d7c8a0;
  border-radius: 18px;
  cursor: pointer;
}
.rebuild-card span { font-size: 32px; }
.rebuild-card strong { font-size: 13px; text-align: center; }
.rebuild-card.correct { color: #fff; background: var(--game-jungle); border-color: var(--game-jungle-dark); }
.rebuild-card.wrong { color: #fff; background: var(--game-danger); border-color: #a9342f; opacity: .78; }

/* Water network. */
.water-board {
  min-height: 250px;
  padding: 30px clamp(14px,4vw,36px);
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: center;
  gap: 14px;
  overflow: hidden;
  background: linear-gradient(160deg, #e8e0bf, #cdb278);
  border: 4px solid #9b7445;
  border-radius: 23px;
}
.water-source, .water-pool { padding: 9px 11px; color: #fff; background: #2789ad; border-radius: 50% 50% 42% 42%; font-size: 12px; font-weight: 800; text-align: center; }
.water-pool { width: 76px; height: 76px; display: grid; place-items: center; border: 6px double #b6e9f4; }
.water-grid { display: grid; grid-template-columns: repeat(6,minmax(48px,1fr)); gap: 6px; }
.water-tile {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: #247a9a;
  background: #fff7d9;
  border: 2px solid #aa8759;
  border-radius: 11px;
  cursor: pointer;
}
.water-tile span { display: block; font: 800 clamp(30px,5vw,55px)/1 monospace; transform: rotate(var(--tile-turn)); transition: transform .24s ease; }
.water-board.flowing .water-tile { color: #fff; background: #52b9d3; animation: waterGlow .7s ease-in-out infinite alternate; }
@keyframes waterGlow { to { box-shadow: 0 0 14px #a7f4ff; } }

/* Memory game. */
.memory-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; perspective: 900px; }
.memory-card {
  position: relative;
  min-height: 145px;
  padding: 0;
  color: var(--game-ink);
  background: transparent;
  border: 0;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform .42s ease;
}
.memory-card.open, .memory-card.matched { transform: rotateY(180deg); }
.memory-card.matched { filter: drop-shadow(0 0 8px rgba(47,159,143,.35)); }
.card-back, .card-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  backface-visibility: hidden;
  border: 2px solid #c7b98e;
  border-radius: 18px;
}
.card-back { color: #fff; background: repeating-linear-gradient(45deg, #c7653c 0 9px, #b65535 9px 18px); font: 700 42px/1 "Mitr", sans-serif; }
.card-face { padding: 10px; color: var(--game-ink); background: #fff4c9; transform: rotateY(180deg); font-size: 37px; }
.card-face small { display: block; margin-top: -16px; font-size: 11px; font-weight: 700; text-align: center; }

/* Evidence-based route and climbing games. */
.choice-journey { position: relative; margin: 4px 0 22px; padding-top: 38px; }
.journey-steps { display: flex; justify-content: space-between; gap: 8px; border-top: 5px dotted #c9bd9c; }
.journey-steps span { width: 34px; height: 34px; margin-top: -19px; display: grid; place-items: center; color: #fff; background: #8ca0a1; border: 4px solid var(--game-white); border-radius: 50%; font-weight: 800; }
.journey-steps span.done { color: var(--game-ink); background: var(--game-sun); }
.journey-avatar { position: absolute; left: var(--journey-step, 0%); top: -3px; font-size: 28px; transform: translateX(-50%); transition: left .35s ease; }
.round-card { padding: clamp(16px,3vw,26px); color: #fff; background: linear-gradient(135deg, #173e49, #27636a); border-radius: 21px; }
.round-card > span { color: #acdce2; font-size: 11px; font-weight: 800; }
.round-card h3 { margin: 4px 0 15px; font: 500 clamp(19px,2.5vw,27px)/1.35 "Mitr", sans-serif; }
.round-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.round-options button { min-height: 52px; padding: 11px 13px; color: var(--game-ink); background: #fff; border: 2px solid transparent; border-radius: 13px; text-align: left; cursor: pointer; }
.round-options button:hover { border-color: var(--game-sun); }
.round-options button.wrong { color: #fff; background: var(--game-danger); }
.round-card .game-feedback { color: #cae9ec; }

/* AI adaptive gate and open-ended finale. */
.ai-gate { position: relative; overflow: hidden; padding-left: clamp(88px,12vw,145px); background: radial-gradient(circle at 6% 18%, rgba(121,215,242,.28), transparent 24%), var(--game-white); }
.ai-orb {
  position: absolute;
  left: clamp(18px,4vw,42px);
  top: clamp(24px,4vw,43px);
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  color: #fff;
  background: #173e49;
  border: 2px solid #74d7e8;
  border-radius: 50%;
  font: 800 13px/1 "Mitr", sans-serif;
  box-shadow: 0 0 0 10px rgba(121,215,242,.12), 0 0 28px rgba(74,192,219,.32);
}
.ai-orb i { position: absolute; inset: -9px; border: 2px dashed #47bad2; border-radius: 50%; animation: aiOrbit 7s linear infinite; }
.ai-orb.active { background: linear-gradient(145deg, #214f5b, #2f9f8f); }
@keyframes aiOrbit { to { transform: rotate(360deg); } }
.ai-loading { min-height: 80px; display: flex; align-items: center; gap: 12px; color: var(--game-ink-soft); }
.ai-loading i { width: 28px; height: 28px; border: 3px solid #c9eaf0; border-top-color: var(--game-jungle); border-radius: 50%; animation: aiOrbit .8s linear infinite; }
.ai-choices { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px; }
.ai-choices button {
  min-height: 68px;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--game-ink);
  background: #f5f0df;
  border: 2px solid #d6caab;
  border-radius: 15px;
  text-align: left;
  cursor: pointer;
}
.ai-choices button > span { flex: 0 0 34px; height: 34px; display: grid; place-items: center; color: #fff; background: var(--game-ink); border-radius: 10px; font-weight: 800; }
.ai-choices button:hover { border-color: var(--game-jungle); }
.ai-choices button.correct { color: #fff; background: var(--game-jungle); border-color: var(--game-jungle-dark); }
.ai-choices button.wrong { color: #fff; background: var(--game-danger); border-color: #a9342f; }
.ai-feedback { margin-top: 14px; }
.ai-feedback strong { color: var(--game-jungle-dark); font: 600 19px/1.3 "Mitr", sans-serif; }
.ai-feedback p { margin: 4px 0 13px; }

.final-case { position: relative; padding-left: clamp(88px,12vw,145px); }
.evidence-chips { margin: 3px 0 16px; display: flex; flex-wrap: wrap; gap: 7px; }
.evidence-chips button { padding: 7px 10px; color: var(--game-ink); background: #e7f6f5; border: 1px solid #96cfca; border-radius: 999px; font-size: 12px; cursor: pointer; }
.evidence-chips button:hover { background: #cbece8; }
.final-answer-label { margin-bottom: 6px; display: flex; justify-content: space-between; gap: 12px; font-weight: 800; }
.final-answer-label span { color: var(--game-ink-soft); font-size: 12px; font-weight: 500; }
.final-case textarea { width: 100%; min-height: 170px; padding: 15px; resize: vertical; color: var(--game-ink); background: #fffcf2; border: 2px solid #cabf9f; border-radius: 15px; line-height: 1.6; }
.final-case > .game-button { margin-top: 12px; }
.evaluation-card { margin-top: 18px; padding: 18px; display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 16px; background: #eef7ec; border: 2px solid #acd2a8; border-radius: 19px; }
.evaluation-card.revise { background: #fff2e2; border-color: #e0ac70; }
.score-ring { position: relative; width: 86px; height: 86px; display: grid; place-items: center; align-content: center; background: conic-gradient(var(--game-jungle) calc(var(--score) * 1%), #dce3dc 0); border-radius: 50%; }
.score-ring::before { content: ""; position: absolute; inset: 8px; background: var(--game-white); border-radius: 50%; }
.score-ring strong, .score-ring span { position: relative; z-index: 1; }
.score-ring strong { font: 700 25px/1 "Mitr", sans-serif; }
.score-ring span { font-size: 9px; }
.evaluation-card h3 { margin: 2px 0 5px; font: 600 20px/1.3 "Mitr", sans-serif; }
.evaluation-card p, .evaluation-card ul { margin: 4px 0; }
.evaluation-card small { color: var(--game-ink-soft); }
.success-stars { display: block; color: #d99519; font-size: 21px; letter-spacing: .08em; }
.mission-success.grand { background: linear-gradient(135deg, #fff4c8, #e4f5e7); }
.final-stamps { flex-wrap: wrap; max-width: 620px; margin-left: auto; margin-right: auto; }
.final-stamp { width: 62px; height: 62px; font-size: 28px; }

@media (max-width: 1180px) {
  .game-hud { grid-template-columns: auto minmax(220px,1fr) auto auto; gap: 9px; }
  .game-brand small, .hud-progress > span, .hud-button-label { display: none; }
  .hud-progress { gap: 5px; }
  .hud-stamp { width: 22px; height: 22px; font-size: 10px; }
  .hud-ai { max-width: 88px; overflow: hidden; }
  .journey-map-v2 { min-width: 940px; }
}

@media (max-width: 820px) {
  .game-hud { grid-template-columns: auto minmax(0,1fr) auto; min-height: 70px; }
  .hud-progress { position: absolute; top: 70px; left: 0; right: 0; padding: 5px 10px; background: rgba(12,47,56,.9); transform: none; }
  .hud-intelligence { justify-self: center; }
  .hud-ai { display: none; }
  .hud-actions { gap: 5px; }
  .map-screen { padding-top: 118px; }
  .journey-map-v2 { min-width: 980px; min-height: 580px; }
  .map-node { width: 114px; }
  .node-pin { width: 50px; height: 50px; font-size: 17px; }
  .rebuild-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .water-board { grid-template-columns: 1fr; justify-items: center; }
  .water-grid { width: 100%; }
  .memory-grid { grid-template-columns: repeat(4,minmax(70px,1fr)); overflow-x: auto; padding-bottom: 8px; }
  .evaluation-card { grid-template-columns: auto minmax(0,1fr); }
  .evaluation-card > .game-button { grid-column: 1 / -1; width: 100%; }
}

@media (max-width: 600px) {
  .hud-energy { letter-spacing: 0; }
  .hud-xp, .hud-energy { padding: 5px 7px; }
  .hud-intelligence { gap: 4px; }
  .hud-stamps { gap: 2px; }
  .hud-stamp { width: 20px; height: 20px; border-width: 1px; }
  .journey-map-scroll { margin: 0 -1px; border-radius: 23px; }
  .journey-map-v2 { min-width: 940px; min-height: 545px; border-radius: 23px; }
  .map-heading > p::after { content: " · เลื่อนแผนที่ซ้าย–ขวาได้"; color: var(--game-laterite); }
  .ai-coach { grid-template-columns: auto 1fr; }
  .ai-hint-button { grid-column: 1 / -1; width: 100%; }
  .order-progress span { min-width: 42px; min-height: 42px; }
  .stage-art-banner { min-height: 178px; margin: -16px -16px 18px; border-radius: 18px 18px 7px 7px; }
  .sun-game .stage-art-banner { margin: 0 0 18px; }
  .order-progress span.filled { min-width: 100px; }
  .order-token { flex: 1 1 calc(50% - 8px); padding: 10px; font-size: 13px; }
  .rebuild-grid { gap: 8px; }
  .rebuild-card { min-height: 115px; padding: 11px; }
  .water-grid { grid-template-columns: repeat(3,minmax(55px,1fr)); }
  .memory-grid { grid-template-columns: repeat(2,minmax(0,1fr)); overflow: visible; }
  .memory-card { min-height: 132px; }
  .round-options, .ai-choices { grid-template-columns: 1fr; }
  .ai-gate, .final-case { padding: 92px 15px 18px; }
  .ai-orb { left: 20px; top: 18px; width: 57px; height: 57px; }
  .evaluation-card { grid-template-columns: 1fr; }
  .score-ring { margin: 0 auto; }
  .evaluation-card > div:nth-child(2) { text-align: left; }
  .final-stamp { width: 50px; height: 50px; font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .ai-orb i, .hud-ai.thinking i, .water-board.flowing .water-tile { animation: none !important; }
}
