:root {
  --bg: #1c4034; /* deep felt green (Kingshot menu tone) */
  --card: #2e6b4f;
  --accent: #7ee787;
  --danger: #ff6b6b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: #e6edf3;
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 700;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

#game-root {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

canvas#game {
  /* Sized by JS (fitCanvas): CSS size = contain-fit of 960x640; backing
     store = CSS size x devicePixelRatio (cap 2) for crisp HiDPI. */
  background: var(--bg);
}

/* ---------- Level intro video ---------- */
.intro {
  position: absolute;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
}
.intro.hidden { display: none; }
.intro video { max-width: 100%; max-height: 100%; }
.intro-skip {
  position: absolute;
  bottom: 28px;
  right: 28px;
  opacity: 0.85;
}

/* ---------- Overlay ---------- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 12, 15, 0.82);
  backdrop-filter: blur(2px);
  z-index: 20;
}
.overlay.hidden { display: none; }

/* Green felt panel + chunky bubble lettering (Kingshot menu style). */
.overlay-card {
  background:
    repeating-linear-gradient(60deg, rgba(255, 255, 255, 0.025) 0 26px, rgba(0, 0, 0, 0.03) 26px 52px),
    repeating-linear-gradient(-60deg, rgba(255, 255, 255, 0.02) 0 26px, rgba(0, 0, 0, 0.025) 26px 52px),
    #2e6b4f;
  border: none;
  border-radius: 24px;
  padding: 32px 40px;
  max-width: 520px;
  text-align: center;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.12), 0 14px 44px rgba(0, 20, 12, 0.55);
  color: #e8e0c8;
}
.overlay-card h1 {
  font-family: "Lilita One", "Arial Rounded MT Bold", sans-serif;
  font-weight: 400; /* Lilita One ships a single weight */
  font-size: 46px;
  letter-spacing: 2px;
  margin-bottom: 14px;
  color: #ffffff;
  text-shadow:
    -2px -2px 0 #1f4a7a, 2px -2px 0 #1f4a7a, -2px 2px 0 #1f4a7a, 2px 2px 0 #1f4a7a,
    0 5px 0 #16355a, 0 8px 14px rgba(0, 20, 12, 0.5);
}
.overlay-card p { font-size: 16px; line-height: 1.5; margin-bottom: 16px; color: #d9cfb4; }
.overlay-card .hint { font-size: 13px; color: #9fbfa4; margin-top: 8px; margin-bottom: 0; }
.overlay-card b { color: #ffe08a; }

#overlay-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
button.gbtn {
  background: #f0b429;
  color: #5a4100;
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 16px;
  font-family: "Lilita One", "Arial Rounded MT Bold", sans-serif;
  font-weight: 400;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 0 4px 0 #c98f14, 0 6px 12px rgba(40, 28, 10, 0.2);
  transition: transform 0.06s ease, filter 0.15s ease, box-shadow 0.06s ease;
}
button.gbtn:hover { filter: brightness(1.06); }
button.gbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 #c98f14; }
button.gbtn.secondary {
  background: #efe8d8;
  color: #7a5c33;
  box-shadow: 0 4px 0 #cfc4ab, 0 6px 12px rgba(40, 28, 10, 0.12);
}
button.gbtn.secondary:active { box-shadow: 0 1px 0 #cfc4ab; }
button.gbtn:disabled {
  background: #e3ddd0;
  color: #b3a894;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  filter: none;
}

/* ---------- House-ad player ---------- */
.adscreen {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.adscreen.hidden { display: none; }
.adscreen video { max-width: 100%; max-height: 100%; }
.adscreen video.hidden { display: none; }
.ad-pill {
  position: absolute;
  right: 22px;
  bottom: 22px;
  background: rgba(43, 43, 35, 0.92);
  border: 2px solid #c9a227;
  border-radius: 999px;
  padding: 6px 16px;
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 800;
  font-size: 14px;
  color: #f6efd9;
}
.ad-pill.hidden { display: none; }
.ad-continue {
  position: absolute;
  right: 26px;
  bottom: 26px;
  z-index: 2;
  border: none;
  border-radius: 999px;
  padding: 14px 44px;
  background: linear-gradient(#e8b84b, #c9932b);
  color: #22304a;
  font-family: "Lilita One", "Arial Rounded MT Bold", sans-serif;
  font-weight: 400;
  font-size: 19px;
  letter-spacing: 1.5px;
  cursor: pointer;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), 0 4px 0 #8f6a1d, 0 8px 16px rgba(30, 20, 5, 0.4);
  transition: transform 0.06s ease, filter 0.15s ease, box-shadow 0.06s ease;
}
.ad-continue:hover { filter: brightness(1.07); }
.ad-continue:active { transform: translateY(3px); box-shadow: inset 0 2px 0 rgba(255,255,255,0.45), 0 1px 0 #8f6a1d; }
.ad-continue.hidden { display: none; }
/* End card: image letterboxed at its native aspect; the copy container is
   positioned in IMAGE percentages so the text sits ON the billboard. */
.ad-endcard {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-endcard.hidden { display: none; }
.ad-frame {
  position: relative;
  aspect-ratio: 2752 / 1536;
  width: min(100vw, calc(100vh * 1.7917));
  background: url("../assets/ui/ad_endcard.webp") center / contain no-repeat;
  container-type: inline-size;
}
.ad-billboard {
  position: absolute;
  left: 44%;
  top: 16%;
  width: 47%;
  height: 56%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4%;
  text-align: center;
}
.ad-bb-title {
  font-family: "Lilita One", "Arial Rounded MT Bold", sans-serif;
  font-weight: 400;
  /* 34px at the 1280-wide 16:9 reference = 2.66% of frame width */
  font-size: 2.66cqw;
  line-height: 1.18;
  letter-spacing: 0.06em;
  color: #ffffff;
  text-shadow:
    -2px -2px 0 #22304a, 2px -2px 0 #22304a, -2px 2px 0 #22304a, 2px 2px 0 #22304a,
    0 4px 0 #16355a, 0 6px 10px rgba(20, 25, 40, 0.35);
}
.ad-bb-email {
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.7cqw;
  color: #22304a;
}

/* ---------- Out of attempts ---------- */
.ooa {
  position: absolute;
  inset: 0;
  z-index: 26;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 12, 15, 0.7);
  backdrop-filter: blur(2px);
}
.ooa.hidden { display: none; }
.ooa-panel {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 12%, rgba(255, 240, 190, 0.10), rgba(255, 240, 190, 0) 60%),
    repeating-linear-gradient(60deg, rgba(255, 255, 255, 0.025) 0 26px, rgba(0, 0, 0, 0.03) 26px 52px),
    repeating-linear-gradient(-60deg, rgba(255, 255, 255, 0.02) 0 26px, rgba(0, 0, 0, 0.025) 26px 52px),
    #2e6b4f;
  border-radius: 24px;
  padding: 30px 40px 26px;
  max-width: 480px;
  margin: 0 16px;
  text-align: center;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.12), 0 14px 44px rgba(0, 20, 12, 0.55);
}
/* Vignette inside the panel corners. */
.ooa-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 24px;
  background: radial-gradient(ellipse at 50% 40%,
    rgba(20, 25, 15, 0) 60%, rgba(20, 25, 15, 0.22) 100%);
}
.ooa-title {
  font-family: "Lilita One", "Arial Rounded MT Bold", sans-serif;
  font-weight: 400;
  font-size: 34px;
  letter-spacing: 1.5px;
  color: #ffffff;
  margin-bottom: 10px;
  text-shadow:
    -2px -2px 0 #22304a, 2px -2px 0 #22304a, -2px 2px 0 #22304a, 2px 2px 0 #22304a,
    0 4px 0 #16355a, 0 7px 12px rgba(0, 20, 12, 0.5);
}
.ooa-hearts { display: flex; justify-content: center; gap: 8px; margin-bottom: 14px; }
.ooa-hearts img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: grayscale(1) brightness(0.75);
  opacity: 0.5;
}
#ooa-msg {
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.5;
  color: #e7dfc6;
  margin-bottom: 18px;
}
#ooa-msg b { color: #ffe08a; }
.msg-ico { width: 20px; height: 20px; object-fit: contain; vertical-align: -4px; margin-right: 2px; }
.ooa-buttons { display: flex; flex-direction: column; gap: 10px; align-items: center; position: relative; z-index: 1; }
.ooa-buttons.hidden { display: none; }
.ooa-ad {
  border: none;
  border-radius: 999px;
  padding: 15px 54px;
  background: linear-gradient(#e8b84b, #c9932b);
  color: #22304a;
  font-family: "Lilita One", "Arial Rounded MT Bold", sans-serif;
  font-weight: 400;
  font-size: 21px;
  letter-spacing: 1.5px;
  cursor: pointer;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), 0 4px 0 #8f6a1d, 0 7px 14px rgba(30, 20, 5, 0.35);
  transition: transform 0.06s ease, filter 0.15s ease, box-shadow 0.06s ease;
}
.ooa-ad:hover { filter: brightness(1.07); }
.ooa-ad:active { transform: translateY(3px); box-shadow: inset 0 2px 0 rgba(255,255,255,0.45), 0 1px 0 #8f6a1d; }
.ooa-danger {
  border: none;
  border-radius: 999px;
  padding: 10px 24px;
  background: transparent;
  border: 2px solid #e5484d;
  color: #ffb3b5;
  font-family: "Lilita One", "Arial Rounded MT Bold", sans-serif;
  font-weight: 400;
  font-size: 14px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.ooa-danger:hover { background: rgba(229, 72, 77, 0.18); color: #ffffff; }
.ooa-lock {
  position: relative;
  z-index: 1;
  margin-top: 4px;
  background: rgba(43, 43, 35, 0.92);
  border: 2px solid #c9a227;
  border-radius: 999px;
  padding: 9px 22px;
  display: inline-block;
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 800;
  font-size: 15px;
  color: #f6efd9;
}
.ooa-lock.hidden { display: none; }
.ooa-lock span { color: #ffe08a; font-variant-numeric: tabular-nums; }

/* ---------- Title screen ----------
   The key art owns the logo + tagline; code adds only the START button,
   a local contrast pool behind it, and the bottom hint line. */
.titlescreen {
  position: absolute;
  inset: 0;
  z-index: 24;
  overflow: hidden;
  background: #1c4034;
  opacity: 1;
  transition: opacity 0.45s ease, transform 0.45s ease;
}
.titlescreen.hidden { display: none; }
.titlescreen.exit { opacity: 0; transform: translateY(-20px); pointer-events: none; }
/* Full-bleed cover art. Crop anchors toward the TOP so the baked-in logo
   stays in frame at every aspect; Ken Burns zooms toward the logo region. */
.title-art {
  position: absolute;
  inset: 0;
  background: url("../assets/ui/title_keyart.webp") center 22% / cover no-repeat;
  transform-origin: 50% 20%;
  animation: title-kenburns 20s ease-in-out infinite alternate;
}
@keyframes title-kenburns {
  from { transform: scale(1); }
  to { transform: scale(1.04); }
}
/* Button zone: lower third, offset right of the hero. The ::before pool
   adds contrast behind the BUTTON ONLY — the artwork is never dimmed. */
.title-btnzone {
  position: absolute;
  /* Right of the hero at every aspect: percentage placement drifts toward
     the (centre-cropped) hero as the viewport narrows, so hold a minimum
     absolute offset from centre, clamped back on tiny screens. */
  left: clamp(63%, calc(50% + 240px), calc(100% - 150px));
  bottom: 7.5%;
  transform: translateX(-50%);
  animation: title-pulse 1.7s ease-in-out infinite alternate;
}
@keyframes title-pulse {
  from { transform: translateX(-50%) scale(1); }
  to { transform: translateX(-50%) scale(1.03); }
}
.title-btnzone::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 55%;
  transform: translate(-50%, -50%);
  width: 340px;
  height: 150px;
  background: radial-gradient(ellipse, rgba(20, 16, 5, 0.38), rgba(20, 16, 5, 0) 68%);
  pointer-events: none;
}
.title-start {
  position: relative;
  border: none;
  border-radius: 999px;
  padding: 18px 64px 20px;
  background: linear-gradient(#e8b84b, #c9932b);
  color: #22304a;
  font-family: "Lilita One", "Arial Rounded MT Bold", sans-serif;
  font-weight: 400;
  font-size: 30px;
  letter-spacing: 3px;
  cursor: pointer;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.45),
    0 5px 0 #8f6a1d,
    0 9px 18px rgba(30, 20, 5, 0.4);
  transition: transform 0.06s ease, filter 0.15s ease, box-shadow 0.06s ease;
}
.title-start:hover { filter: brightness(1.07); }
.title-start:active {
  transform: translateY(4px);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), 0 1px 0 #8f6a1d,
    0 3px 8px rgba(30, 20, 5, 0.35);
}
.title-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  text-align: center;
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 700;
  font-size: 12px;
  color: rgba(246, 239, 217, 0.85);
  text-shadow: 0 1px 3px rgba(0, 20, 12, 0.7);
  pointer-events: none;
}

/* ---------- Journey map screen (SKILL.md journey-map spec) ----------
   Tokens: felt green ui.feltGreen #2E6B4F, gold #E8B84B->#C9932B, rim
   #C9A227, cream #F6EFD9, navy #22304A, warn #F2A93B, ok #5BB85D. */
.mapscreen {
  position: absolute;
  inset: 0;
  z-index: 22;
  display: flex;
  flex-direction: column;
  background:
    repeating-linear-gradient(60deg, rgba(255, 255, 255, 0.025) 0 26px, rgba(0, 0, 0, 0.03) 26px 52px),
    repeating-linear-gradient(-60deg, rgba(255, 255, 255, 0.02) 0 26px, rgba(0, 0, 0, 0.025) 26px 52px),
    #2e6b4f;
  overflow: hidden;
}
.mapscreen.hidden { display: none; }
/* Vignette on top of everything ambient, under the content. */
.mapscreen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 42%,
    rgba(20, 25, 15, 0) 55%, rgba(20, 25, 15, 0.22) 100%);
  z-index: 1;
}

/* Ambient: oversized gas swirls + soft warm light pools (not a flat card). */
.map-ambient { position: absolute; inset: 0; overflow: hidden; }
.jm-swirl { position: absolute; color: #f6efd9; opacity: 0.05; }
.jm-swirl.s1 { width: 420px; top: 6%; left: -90px; transform: rotate(-18deg); }
.jm-swirl.s2 { width: 560px; top: 38%; right: -150px; transform: rotate(140deg) scaleX(-1); }
.jm-swirl.s3 { width: 380px; bottom: -60px; left: 16%; transform: rotate(64deg); }
.jm-pool { position: absolute; border-radius: 50%; }
.jm-pool.p1 { width: 520px; height: 420px; top: -8%; left: 12%;
  background: radial-gradient(circle, rgba(255, 240, 190, 0.10), rgba(255, 240, 190, 0) 70%); }
.jm-pool.p2 { width: 620px; height: 500px; top: 40%; right: -6%;
  background: radial-gradient(circle, rgba(255, 240, 190, 0.08), rgba(255, 240, 190, 0) 70%); }
.jm-pool.p3 { width: 460px; height: 400px; bottom: -10%; left: 4%;
  background: radial-gradient(circle, rgba(255, 240, 190, 0.09), rgba(255, 240, 190, 0) 70%); }

/* Header: compact lockup + HUD-consistent chips. */
.map-head {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
}
.map-logo {
  font-family: "Lilita One", "Arial Rounded MT Bold", sans-serif;
  font-weight: 400;
  font-size: 30px;
  letter-spacing: 1.5px;
  color: #ffffff;
  text-shadow:
    -2px -2px 0 #22304a, 2px -2px 0 #22304a, -2px 2px 0 #22304a, 2px 2px 0 #22304a,
    0 4px 0 #16355a, 0 6px 10px rgba(0, 20, 12, 0.5);
}
.map-chips { display: flex; align-items: center; gap: 10px; }
.chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(43, 43, 35, 0.92);
  border: 2px solid #c9a227;
  border-radius: 999px;
  padding: 4px 14px 4px 6px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 3px 8px rgba(0, 20, 12, 0.35);
  color: #f6efd9;
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 800;
  font-size: 15px;
}
.chip img { width: 22px; height: 22px; object-fit: contain; }
.help-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid #c9a227;
  background: linear-gradient(#e8b84b, #c9932b);
  color: #22304a;
  font-family: "Lilita One", "Arial Rounded MT Bold", sans-serif;
  font-weight: 400;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 3px 0 #8f6a1d, 0 5px 10px rgba(40, 28, 10, 0.25);
  transition: transform 0.06s ease, filter 0.15s ease;
}
.help-btn:hover { filter: brightness(1.07); }
.help-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #8f6a1d; }

/* Scrolling track. */
.map-scroll {
  position: relative;
  z-index: 2;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  cursor: grab;
}
.map-scroll::-webkit-scrollbar { display: none; }
.map-scroll.dragging { cursor: grabbing; }
.map-track {
  position: relative;
  width: 720px;
  max-width: 100%;
  margin: 0 auto;
  padding: 10px 0 40px;
}

/* A location section: badge one side, path + nodes the other. */
.jm-section { position: relative; height: 252px; }
.jm-section.dim { opacity: 0.55; filter: saturate(0.55); }
.jm-path { position: absolute; inset: 0; width: 100%; height: 100%; }
.jm-dots {
  fill: none;
  stroke: rgba(246, 239, 217, 0.38);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 0.1 19;
}
.jm-dots.done { stroke: #5bb85d; }

.jm-side {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 230px;
  text-align: center;
  pointer-events: none;
}
.badge-left .jm-side { left: 22px; }
.badge-right .jm-side { right: 22px; }
.jm-badge {
  width: 158px;
  height: 158px;
  object-fit: contain;
  filter: drop-shadow(0 10px 14px rgba(0, 20, 12, 0.45));
  animation: jm-bob 3.6s ease-in-out infinite;
}
@keyframes jm-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}
.jm-name {
  margin-top: 2px;
  font-family: "Lilita One", "Arial Rounded MT Bold", sans-serif;
  font-weight: 400;
  font-size: 24px;
  letter-spacing: 1px;
  color: #ffffff;
  text-shadow:
    -2px -2px 0 #22304a, 2px -2px 0 #22304a, -2px 2px 0 #22304a, 2px 2px 0 #22304a,
    0 4px 0 #16355a, 0 5px 9px rgba(0, 20, 12, 0.5);
}

/* Tier nodes: gold coin discs with Lilita pips. */
.jm-nodewrap {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 110px;
}
.jm-node {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 3px solid #c9a227;
  background: radial-gradient(circle at 34% 28%, #f9dc8a, #e8b84b 52%, #c9932b 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.45),
    inset 0 -3px 0 rgba(110, 75, 15, 0.35),
    0 4px 0 #8f6a1d,
    0 7px 12px rgba(0, 20, 12, 0.4);
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s ease, filter 0.15s ease;
}
.jm-node:hover:not(:disabled) { transform: scale(1.05); filter: brightness(1.07); }
.jm-node:active:not(:disabled) { transform: scale(0.98) translateY(2px); }
.jm-pips {
  font-family: "Lilita One", "Arial Rounded MT Bold", sans-serif;
  font-weight: 400;
  font-size: 22px;
  letter-spacing: 2px;
  color: #ffffff;
  text-shadow: -1.5px -1.5px 0 #22304a, 1.5px -1.5px 0 #22304a,
    -1.5px 1.5px 0 #22304a, 1.5px 1.5px 0 #22304a, 0 3px 0 #16355a;
}
.jm-label {
  margin-top: 7px;
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 800;
  font-size: 11px;
  color: #e7dfc6;
  text-shadow: 0 2px 3px rgba(0, 20, 12, 0.5);
  text-align: center;
  line-height: 1.15;
}
.jm-node.done { border-color: #5bb85d; }
.jm-tick {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 22px;
  height: 22px;
  padding: 3px;
  border-radius: 50%;
  background: #5bb85d;
  box-shadow: 0 2px 4px rgba(0, 20, 12, 0.45);
  object-fit: contain;
}
.jm-node.current {
  border-color: #f2a93b;
  animation: jm-halo 1.5s ease-in-out infinite;
}
@keyframes jm-halo {
  0%, 100% { box-shadow: inset 0 2px 0 rgba(255,255,255,0.45), inset 0 -3px 0 rgba(110,75,15,0.35),
    0 4px 0 #8f6a1d, 0 7px 12px rgba(0,20,12,0.4), 0 0 0 0 rgba(242, 169, 59, 0.6); }
  50% { box-shadow: inset 0 2px 0 rgba(255,255,255,0.45), inset 0 -3px 0 rgba(110,75,15,0.35),
    0 4px 0 #8f6a1d, 0 7px 12px rgba(0,20,12,0.4), 0 0 0 12px rgba(242, 169, 59, 0); }
}
.jm-node.locked, .jm-node:disabled {
  filter: grayscale(0.85) brightness(0.82);
  cursor: not-allowed;
}
.jm-lock { width: 24px; height: 24px; object-fit: contain; opacity: 0.9; }
.jm-node.flash { animation: jm-flash 0.24s ease; }
@keyframes jm-flash {
  0% { filter: brightness(1); }
  40% { filter: brightness(1.8); transform: scale(1.12); }
  100% { filter: brightness(1); }
}
.jm-here {
  position: absolute;
  top: -46px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: #ffffff;
  border: 2px solid #f2a93b;
  border-radius: 999px;
  padding: 4px 12px;
  font-family: "Lilita One", "Arial Rounded MT Bold", sans-serif;
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0.5px;
  color: #22304a;
  box-shadow: 0 3px 8px rgba(0, 20, 12, 0.4);
  animation: jm-bob 2.4s ease-in-out infinite;
  pointer-events: none;
}
.jm-here::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #ffffff;
  border-bottom: none;
}

.map-foot {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 8px 12px 12px;
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: #9fbfa4;
}

/* How-to-play overlay panel (skill panel spec). */
.help-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 12, 15, 0.6);
}
.help-overlay.hidden { display: none; }
.help-panel {
  background: rgba(43, 43, 35, 0.96);
  border: 2px solid #c9a227;
  border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 14px 44px rgba(0, 20, 12, 0.55);
  max-width: 440px;
  margin: 0 16px;
  padding: 24px 28px;
  text-align: center;
  color: #f6efd9;
}
.help-panel h2 {
  font-family: "Lilita One", "Arial Rounded MT Bold", sans-serif;
  font-weight: 400;
  font-size: 26px;
  letter-spacing: 1px;
  color: #ffffff;
  margin-bottom: 12px;
  text-shadow: -2px -2px 0 #22304a, 2px -2px 0 #22304a,
    -2px 2px 0 #22304a, 2px 2px 0 #22304a, 0 4px 0 #16355a;
}
.help-panel p {
  font-family: "Nunito", system-ui, sans-serif;
  font-size: 14.5px;
  line-height: 1.55;
  margin-bottom: 12px;
  color: #e7dfc6;
}
.help-panel b { color: #ffe08a; }

/* ---------- Touch controls (SKILL badge styling; built by touch.js) ---- */
#touch-controls { position: absolute; inset: 0; z-index: 12; pointer-events: none; }
#touch-controls.hidden { display: none; }
/* Stick spawn zone: left fraction of the screen (width set by touch.js). */
.tc-zone {
  position: absolute; left: 0; top: 0; bottom: 0;
  pointer-events: auto;
  touch-action: none;
}
/* Floating stick: badge disc (white face, gold ring) at low opacity. */
.tc-stick {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.9), rgba(246,239,217,0.75) 70%);
  border: 3px solid #c9a227;
  box-shadow: 0 4px 12px rgba(0, 20, 12, 0.35);
  pointer-events: none;
}
.tc-stick.hidden { display: none; }
.tc-nub {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 54px; height: 54px; border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #f9dc8a, #e8b84b 52%, #c9932b 100%);
  border: 3px solid #c9a227;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.45), 0 3px 6px rgba(0, 20, 12, 0.35);
}
/* Buttons: gold-ring badge discs with drawn SVG icons. */
.tc-btn {
  position: absolute;
  border-radius: 50%;
  border: 3px solid #c9a227;
  background: radial-gradient(circle at 35% 30%, #fffdf4, #f6efd9 60%, #e7dcbe 100%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.6), 0 4px 0 #8f6a1d, 0 8px 14px rgba(0, 20, 12, 0.35);
  padding: 16%;
  pointer-events: auto;
  touch-action: none;
  transition: transform 0.06s ease, filter 0.2s ease;
}
.tc-btn svg { width: 100%; height: 100%; display: block; }
.tc-btn.held { transform: scale(0.94); }
.tc-sprint.exhausted {
  filter: grayscale(0.9) brightness(0.75);
}
/* Hold-fart charge ring: fills around the disc while held. */
.tc-ringwrap {
  position: absolute; inset: -3px;
  width: calc(100% + 6px) !important; height: calc(100% + 6px) !important;
  pointer-events: none;
}
.tc-ring {
  fill: none;
  stroke: #f2a93b;
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: none;
}
.tc-fart.held .tc-ring {
  transition-property: stroke-dashoffset;
  transition-timing-function: linear;
  /* duration set from TOUCH_TUNING.CHARGE_MS by touch.js */
  stroke-dashoffset: 0;
}

/* ---------- Privacy link ---------- */
.privacy-link {
  color: rgba(246, 239, 217, 0.8);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.privacy-link:hover { color: #ffe08a; }
.help-privacy { margin-top: 12px; font-size: 12px; }
