/* ===== Mozei: The Market Is The Puzzle ===== */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&display=swap');

:root {
  --terracotta: #D9531E;
  --saffron: #F5A623;
  --emerald: #2E7D32;
  --indigo: #1E3A8A;
  --kente: #B71C1C;
  --parchment: #FFF8E7;
  --ebony: #2C1A0E;
  --bg: #1e130b;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body, #root {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: var(--bg);
  font-family: 'Fredoka', 'Segoe UI', system-ui, sans-serif;
  color: var(--parchment);
  overflow: hidden;
  touch-action: manipulation;
}

#app,
#app-shell {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}

#game-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#game-container canvas {
  display: block;
  margin: 0 auto;
}

/* ===== Overlays ===== */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(30, 19, 11, 0.82);
  backdrop-filter: blur(2px);
}

.boot-error { z-index: 99; }

.panel {
  background: linear-gradient(180deg, #3a2415, #2C1A0E);
  border: 3px solid var(--saffron);
  border-radius: 20px;
  padding: 28px 26px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

/* ===== Buttons ===== */
.btn {
  display: block;
  width: 100%;
  min-height: 56px;
  margin: 10px auto;
  padding: 14px 20px;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  color: var(--parchment);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
  letter-spacing: 0.5px;
}
.btn:hover { transform: translateY(-2px) scale(1.02); filter: brightness(1.1); }
.btn:active { transform: translateY(1px) scale(0.97); }
.btn--primary { background: var(--terracotta); box-shadow: 0 4px 0 #a03a12; }
.btn--primary:active { box-shadow: 0 1px 0 #a03a12; }
.btn--secondary { background: var(--indigo); box-shadow: 0 4px 0 #14265e; }
.btn--ghost { background: rgba(255,255,255,0.08); border: 2px solid rgba(245,166,35,0.5); }
.btn--danger { background: var(--kente); box-shadow: 0 4px 0 #7a1212; }

/* ===== Help & Lore Overlay (main menu) ===== */
.menu-help-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 2px solid rgba(245, 166, 35, 0.75);
  background: linear-gradient(180deg, #3a2415, #2a1a0e);
  color: var(--parchment);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  animation: helpPulse 2.2s ease-in-out infinite;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
  transition: box-shadow 0.2s ease, transform 0.1s ease, filter 0.2s ease;
}
.menu-help-btn .help-q { font-size: 17px; line-height: 1; }
.menu-help-btn:hover { box-shadow: 0 0 12px rgba(245, 158, 11, 0.7); filter: brightness(1.08); }
.menu-help-btn:active { transform: scale(0.95); }

/* ===== First-load onboarding: Griot's Guide welcome cue ===== */
.help-welcome-banner {
  order: -1;
  width: 100%;
  margin: 0 0 14px;
  padding: 12px 16px;
  border-radius: 12px;
  text-align: center;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: 0.4px;
  color: #2a1503;
  background: linear-gradient(135deg, #ffd24a 0%, #f59e0b 55%, #d97706 100%);
  border: 2px solid #fff3c4;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
  animation: welcomeGlow 1.8s ease-in-out infinite;
}

@keyframes welcomeGlow {
  0%, 100% {
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.45), 0 0 20px rgba(245, 158, 11, 0.25);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 18px rgba(245, 158, 11, 0.85), 0 0 34px rgba(245, 158, 11, 0.5);
    transform: scale(1.02);
  }
}

.help-close {
  font-weight: 800;
  letter-spacing: 0.3px;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.45);
}
@keyframes helpPulse {
  0%, 100% { box-shadow: 0 0 6px rgba(245, 158, 11, 0.35); }
  50% { box-shadow: 0 0 16px rgba(245, 158, 11, 0.75); }
}

.help-backdrop {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: helpFadeIn 0.3s ease;
}
@keyframes helpFadeIn { from { opacity: 0; } to { opacity: 1; } }

.help-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 384px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 18px;
  border-radius: 20px;
  border: 2px solid rgba(245, 166, 35, 0.4);
  background: rgba(41, 27, 15, 0.96);
  color: var(--parchment);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: helpPop 0.25s ease;
}
@keyframes helpPop {
  from { transform: translateY(14px) scale(0.97); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.help-head { display: flex; align-items: center; gap: 10px; }
.help-badge { font-size: 22px; line-height: 1; }
.help-title { margin: 0; font-size: 20px; font-weight: 700; color: var(--saffron); letter-spacing: 0.3px; }

.help-tabs { display: flex; gap: 6px; }
.help-tab {
  flex: 1 1 0;
  min-height: 42px;
  padding: 8px 6px;
  border-radius: 10px;
  border: 1px solid rgba(245, 166, 35, 0.25);
  background: rgba(60, 40, 22, 0.85);
  color: #e7d9c3;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.help-tab:hover { background: rgba(90, 62, 34, 0.92); }
.help-tab:active { transform: scale(0.97); }
.help-tab.active {
  background: #b45309;
  color: #ffffff;
  border-color: rgba(251, 191, 36, 0.85);
  box-shadow: 0 2px 0 #7c3a06;
}

.help-body { display: flex; flex-direction: column; gap: 10px; }
.help-line {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.42;
  color: #f4e7d3;
}

.help-close {
  width: 100%;
  height: 48px;
  min-height: 48px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(90deg, #d97706, #ea580c);
  color: #ffffff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 5px 0 #9a3412;
  transition: transform 0.1s ease, filter 0.2s ease;
}
.help-close:hover { filter: brightness(1.08); }
.help-close:active { transform: scale(0.95); }
.help-hint { margin: 0; text-align: center; font-size: 12px; color: rgba(244, 231, 211, 0.65); }

.btn--play {
  background: linear-gradient(135deg, var(--saffron), var(--terracotta));
  font-size: 22px;
  box-shadow: 0 5px 0 #a03a12, 0 0 20px rgba(245,166,35,0.5);
}

.top-back {
  background: none;
  border: 2px solid var(--saffron);
  color: var(--saffron);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

/* ===== MENU ===== */
.menu-screen {
  justify-content: flex-start;
  padding-top: 110px;
  background:
    radial-gradient(circle at 20% 15%, rgba(245,166,35,0.15), transparent 40%),
    radial-gradient(circle at 80% 25%, rgba(46,125,50,0.2), transparent 40%),
    rgba(30, 19, 11, 0.9);
}
.menu-logo { text-align: center; margin-bottom: 34px; animation: popIn 0.5s ease; }
.menu-star { font-size: 40px; color: var(--saffron); animation: twinkle 1.6s infinite; }
.menu-title {
  font-size: 58px;
  margin: 0;
  color: var(--saffron);
  text-shadow: 4px 4px 0 var(--terracotta), 0 0 30px rgba(245,166,35,0.4);
  letter-spacing: 3px;
}
.menu-subtitle { font-size: 16px; color: var(--parchment); margin: 6px 0 0; letter-spacing: 1px; opacity: 0.9; }
.menu-buttons { width: 100%; max-width: 300px; }
.menu-hint { opacity: 0.5; font-size: 13px; margin-top: 22px; }

/* ===== Screen header / shared ===== */
.screen-title { font-size: 30px; margin: 0; color: var(--saffron); text-shadow: 2px 2px 0 var(--terracotta); }
.map-header, .info-top { display: flex; align-items: center; gap: 14px; width: 100%; }

/* ===== MARKET MAP ===== */
.map-screen { justify-content: flex-start; padding-top: 60px; }
.map-header { padding: 0 20px; margin-bottom: 14px; }
.map-canvas { position: relative; flex: 1; width: 100%; }
.node-wrap { position: absolute; width: 84px; height: 84px; }
.node-path { position: absolute; left: 50%; width: 6px; transform: translateX(-50%); background: linear-gradient(var(--saffron), rgba(245,166,35,0.2)); border-radius: 3px; }
.level-node {
  position: relative;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff6a2b, var(--terracotta) 60%, #a03a12);
  color: var(--parchment);
  cursor: pointer;
  box-shadow: 0 6px 0 #7a2a10, 0 0 0 4px rgba(245,166,35,0.25);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  animation: nodeBob 2.4s ease-in-out infinite;
}
.level-node:hover { transform: scale(1.08); box-shadow: 0 8px 0 #7a2a10, 0 0 22px var(--saffron); }
.level-node .node-num { font-size: 30px; font-weight: 700; }
.level-node .node-stars { position: absolute; bottom: -12px; left: 50%; transform: translateX(-50%); display: flex; gap: 1px; font-size: 15px; }
.level-node .star { color: rgba(255,255,255,0.4); text-shadow: 1px 1px 0 #000; }
.level-node .star.on { color: var(--saffron); text-shadow: 0 0 8px rgba(245,166,35,0.8); animation: twinkle 1.4s infinite; }
.level-node.locked { background: #4a4a4a; box-shadow: 0 4px 0 #222; cursor: not-allowed; animation: none; }
.level-node .node-lock { position: absolute; top: -10px; right: -6px; font-size: 22px; filter: drop-shadow(0 2px 3px #000); }
.node-ring { position: absolute; inset: -6px; border-radius: 50%; border: 2px dashed rgba(255,255,255,0.35); animation: spin 12s linear infinite; }

/* ===== INSTRUCTIONS / SETTINGS / CREDITS ===== */
.info-screen { justify-content: flex-start; padding-top: 70px; }
.info-scroll { flex: 1; width: 100%; max-width: 380px; overflow-y: auto; padding: 10px 6px 20px; }
.info-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: rgba(255,248,231,0.06);
  border: 1px solid rgba(245,166,35,0.3);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
  text-align: left;
}
.info-ico { font-size: 28px; }
.info-card b { color: var(--saffron); display: block; margin-bottom: 4px; }
.info-card p { margin: 0; font-size: 14px; opacity: 0.9; line-height: 1.4; }

.setting-row { display: flex; justify-content: space-between; align-items: center; background: rgba(255,255,255,0.05); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.toggle { min-width: 72px; min-height: 44px; border-radius: 999px; border: 2px solid #555; background: #333; color: #ccc; font-weight: 700; font-family: inherit; cursor: pointer; }
.toggle.on { background: var(--emerald); border-color: #1f5c25; color: #fff; }
.btn--danger { margin-top: 8px; }
.credit-line { text-align: center; opacity: 0.9; line-height: 1.6; margin-bottom: 14px; }

/* ===== HUD ===== */
.hud { position: absolute; top: 0; left: 0; right: 0; z-index: 15; padding: 12px 14px; pointer-events: none; }
.hud--contrast .hud-obj, .hud--contrast .hud-metrics { background: rgba(0,0,0,0.85); border-color: #fff; }
.hud-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.hud-obj { flex: 1; background: rgba(44,26,14,0.88); border: 2px solid var(--terracotta); border-radius: 14px; padding: 10px 14px; }
.hud-level { display: block; font-size: 13px; color: var(--saffron); font-weight: 700; }
.hud-goal { display: block; font-size: 14px; margin-top: 2px; line-height: 1.3; }
.hud-pause { pointer-events: auto; width: 52px; height: 52px; border-radius: 50%; border: 2px solid var(--saffron); background: rgba(44,26,14,0.9); color: var(--saffron); font-size: 22px; cursor: pointer; }
.hud-metrics { display: flex; gap: 8px; margin-top: 10px; }
.metric { flex: 1; background: rgba(44,26,14,0.85); border-radius: 12px; padding: 8px 10px; text-align: center; }
.m-label { display: block; font-size: 11px; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.5px; }
.m-val { display: block; font-size: 17px; font-weight: 700; margin-top: 2px; }
.m-val.over { color: #ff5a5a; }
.m-meter { display: block; height: 10px; background: #3a2415; border-radius: 6px; margin-top: 4px; overflow: hidden; }
.m-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--emerald), var(--saffron), var(--kente)); border-radius: 6px; transition: width 0.3s ease; }

/* ===== Touch Controls ===== */
.touch-controls { position: absolute; inset: 0; z-index: 14; pointer-events: none; }

/* Hide touch controls on desktop (fine pointer + hover) so they don't clutter/block gameplay */
@media (hover: hover) and (pointer: fine) {
  .touch-controls { display: none; }
}
.touch-controls button { pointer-events: auto; user-select: none; -webkit-user-select: none; }

.dpad { position: absolute; bottom: 24px; left: 22px; width: 150px; height: 150px; display: grid; grid-template-columns: repeat(3,1fr); grid-template-rows: repeat(3,1fr); gap: 4px; }
.dpad-btn { border: none; background: rgba(30,58,138,0.85); border-bottom: 3px solid #14265e; border-radius: 10px; cursor: pointer; transition: transform 0.08s ease; }
.dpad-btn:active { transform: scale(0.9); background: var(--indigo); }
.dpad-up { grid-column: 2; grid-row: 1; }
.dpad-left { grid-column: 1; grid-row: 2; }
.dpad-down { grid-column: 2; grid-row: 3; }
.dpad-right { grid-column: 3; grid-row: 2; }
.dpad-btn::after { content: ''; display: block; width: 26px; height: 26px; margin: auto; }
.dpad-up::after { border-left: 12px solid transparent; border-right: 12px solid transparent; border-bottom: 16px solid var(--parchment); }
.dpad-down::after { border-left: 12px solid transparent; border-right: 12px solid transparent; border-top: 16px solid var(--parchment); }
.dpad-left::after { border-top: 12px solid transparent; border-bottom: 12px solid transparent; border-right: 16px solid var(--parchment); }
.dpad-right::after { border-top: 12px solid transparent; border-bottom: 12px solid transparent; border-left: 16px solid var(--parchment); }

.action-buttons { position: absolute; right: 22px; bottom: 24px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.act-btn { width: 74px; height: 74px; border-radius: 50%; border: none; color: var(--parchment); font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform 0.08s ease; }
.act-btn:active { transform: scale(0.88); }
.act-grab { background: var(--terracotta); border-bottom: 5px solid #a03a12; font-size: 14px; }
.act-jump { background: var(--saffron); color: var(--ebony); border-bottom: 5px solid #c07d14; font-size: 16px; }
.act-reset { width: 52px; height: 52px; background: rgba(255,255,255,0.12); border: 2px solid rgba(255,255,255,0.3); font-size: 20px; }

.layout-left .dpad { left: auto; right: 22px; }
.layout-left .action-buttons { right: auto; left: 22px; }

/* ===== Modal (paused) ===== */
.modal .panel { padding: 26px; }
.modal-sub { opacity: 0.85; margin-bottom: 18px; }

/* ===== Level Complete ===== */
.levelcomplete { background: radial-gradient(circle at 50% 20%, rgba(245,166,35,0.25), rgba(30,19,11,0.93) 60%); }
.celebrate { font-size: 46px; color: var(--saffron); animation: twinkle 1.2s infinite; }
.win-title { font-size: 28px; margin: 6px 0; color: var(--saffron); text-shadow: 2px 2px 0 var(--terracotta); }
.win-level { opacity: 0.85; margin: 0 0 8px; font-size: 15px; }
.star-row { display: flex; justify-content: center; gap: 8px; margin: 12px 0; }
.big-star { font-size: 44px; }
.big-star.on { color: var(--saffron); text-shadow: 0 0 16px rgba(245,166,35,0.8); animation: starPop 0.6s ease; }
.big-star.empty { color: rgba(255,255,255,0.25); }

.metrics-grid { display: flex; gap: 8px; margin: 12px 0; }
.mc { flex: 1; background: rgba(255,255,255,0.07); border-radius: 10px; padding: 8px; }
.mc-label { display: block; font-size: 11px; opacity: 0.7; }
.mc-val { display: block; font-size: 17px; font-weight: 700; margin-top: 2px; }

.ranket {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255,248,231,0.07);
  border-radius: 14px;
  padding: 12px;
  text-align: left;
  margin: 6px 0 12px;
}
.ranket-avatar { width: 64px; height: 64px; border-radius: 50%; background-color: var(--indigo); position: relative; flex-shrink: 0; }
.ranket-avatar::before {
  content: ''; position: absolute; top: 6px; left: 6px; right: 6px; height: 14px;
  border-radius: 7px 7px 4px 4px; background: var(--saffron);
}
.ranket-avatar::after {
  content: ''; position: absolute; top: 26px; left: 16px; width: 32px; height: 26px;
  border-radius: 50%; background: #8a5a2b;
}
.ranket-avatar.mood-cheer { animation: cheerBob 0.7s ease-in-out infinite; }
.ranket-avatar.mood-cheer::after { border-radius: 50% 50% 6px 6px; }
.ranket-avatar.mood-pensive::after { top: 30px; height: 20px; border-radius: 50% 50% 40% 40%; }
.ranket-quote { margin: 0; font-size: 14px; font-style: italic; line-height: 1.4; }
.win-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  width: 100%;
  max-width: 240px;
  margin: 12px auto 0;
}

/* ===== Calabash Harvest additions ===== */
.menu-highscore { color: var(--saffron); font-size: 15px; margin: 4px 0 18px; opacity: 0.9; }
.menu-tips { margin-top: 20px; text-align: center; font-size: 13px; opacity: 0.8; line-height: 1.6; max-width: 320px; }
.menu-tips p { margin: 4px 0; }
.tip-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.tip-dot--green { background: #4ADE80; }
.tip-dot--gold { background: #FBBF24; }
.tip-dot--thorn { background: #EF4444; }

.hud-top-bar {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: min(100vw, 56.25vh); right: auto; z-index: 15;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 14px 8px; pointer-events: none;
  background: linear-gradient(180deg, rgba(20,10,5,0.75), transparent);
}
.hearts-row { display: flex; gap: 4px; font-size: 22px; }
.heart.full { color: #ff5a5a; text-shadow: 0 0 8px rgba(255,90,90,0.7); }
.heart.empty { color: rgba(255,255,255,0.3); }
.hud-score-block, .hud-unbanked-block { display: flex; flex-direction: column; align-items: center; background: rgba(44,26,14,0.85); border: 2px solid var(--saffron); border-radius: 12px; padding: 4px 10px; min-width: 76px; }
.hud-score-label { font-size: 10px; text-transform: uppercase; opacity: 0.75; letter-spacing: 0.5px; }
.hud-score-val, .hud-unbanked-val { font-size: 16px; font-weight: 700; color: var(--parchment); }
.weight-meter { position: absolute; top: 68px; left: 14px; right: 14px; height: 10px; background: rgba(20,10,5,0.82); border-radius: 6px; overflow: hidden; border: 1px solid rgba(245,166,35,0.45); }
.weight-fill { height: 100%; transition: width 0.2s ease, background 0.2s ease; }

.anansi-meter { position: absolute; top: 84px; left: 14px; right: 70px; height: 14px; background: rgba(20,10,5,0.82); border-radius: 8px; overflow: hidden; border: 1px solid rgba(245,166,35,0.45); }
.anansi-fill { height: 100%; background: linear-gradient(90deg, #67e8f9, #a5f3fc); transition: width 0.2s ease; }
.anansi-fill.ready { background: linear-gradient(90deg, #22d3ee, #ffffff); box-shadow: 0 0 10px rgba(103,232,249,0.9); }
.anansi-fill.active { background: linear-gradient(90deg, #ffffff, #e0f2fe); animation: anansi-pulse 0.5s ease-in-out infinite alternate; }
@keyframes anansi-pulse { from { opacity: 0.65; } to { opacity: 1; } }
.anansi-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; letter-spacing: 0.6px; color: #FDE68A; text-shadow: 0 1px 2px rgba(0,0,0,0.9); pointer-events: none; }

.harmattan-badge { position: absolute; top: 104px; left: 50%; transform: translateX(-50%); background: rgba(220,140,60,0.92); color: #2b1607; font-size: 11px; font-weight: 800; letter-spacing: 0.5px; padding: 4px 12px; border-radius: 10px; border: 1px solid #fde68a; box-shadow: 0 0 12px rgba(220,140,60,0.7); pointer-events: none; white-space: nowrap; }

.anansi-btn {
  position: absolute; bottom: 18px; right: auto; left: calc(50% + min(50vw, 28.125vh) - 70px); z-index: 16; pointer-events: auto;
  width: 56px; height: 56px; border-radius: 50%; border: 2px solid rgba(103,232,249,0.5);
  background: rgba(14,42,51,0.85); color: #67e8f9; font-size: 24px; cursor: pointer;
  opacity: 0.45; transition: opacity 0.2s ease, box-shadow 0.2s ease;
}
.anansi-btn.ready { opacity: 1; border-color: #ffffff; box-shadow: 0 0 14px rgba(103,232,249,0.9); }
.anansi-btn:disabled { cursor: default; }

.hud-pause-btn {
  position: absolute; top: 82px; right: auto; left: calc(50% + min(50vw, 28.125vh) - 58px); z-index: 16; pointer-events: auto;
  width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--saffron);
  background: rgba(44,26,14,0.9); color: var(--saffron); font-size: 16px; cursor: pointer;
}

.bank-toast {
  position: absolute; top: 40%; z-index: 18; font-size: 22px; font-weight: 700;
  color: var(--saffron); text-shadow: 0 0 12px rgba(245,166,35,0.9), 2px 2px 0 #000;
  animation: bankFloat 0.9s ease forwards; pointer-events: none;
}
.bank-toast--left { left: 40px; }
.bank-toast--right { right: 40px; }
@keyframes bankFloat { 0% { opacity: 0; transform: translateY(10px) scale(0.8); } 30% { opacity: 1; transform: translateY(-10px) scale(1.1); } 100% { opacity: 0; transform: translateY(-40px) scale(1); } }

/* ===== Animations ===== */
@keyframes popIn { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes twinkle { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.6; transform: scale(0.85); } }
@keyframes nodeBob { 0%,100% { margin-top: 0; } 50% { margin-top: -6px; } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes starPop { 0% { transform: scale(0) rotate(-30deg); } 70% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes cheerBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* ===== Nomadic Trade Route bar ===== */
.trade-route {
  position: absolute; top: 0; left: 0; right: 0; z-index: 16; pointer-events: none;
  padding: 6px 12px 4px;
  background: linear-gradient(180deg, rgba(20,10,5,0.92), rgba(20,10,5,0.12));
}
.trade-route-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 10px; letter-spacing: 0.6px; text-transform: uppercase; }
.trade-route-title { color: var(--saffron); font-weight: 700; }
.trade-route-distance { color: var(--parchment); font-weight: 700; }
.trade-route-track {
  position: relative; height: 14px; margin-top: 4px; border-radius: 8px;
  background: rgba(0,0,0,0.5); border: 1px solid rgba(245,166,35,0.5);
}
.trade-route-fill {
  position: absolute; top: 0; bottom: 0; left: 0; height: 100%; border-radius: 8px;
  background: linear-gradient(90deg, #F5A623, #D9531E 55%, #A855F7);
  transition: width 0.35s ease;
}
.trade-marker {
  position: absolute; top: -3px; width: 2px; height: 20px;
  background: repeating-linear-gradient(180deg, rgba(255,248,231,0.9) 0 4px, transparent 4px 8px);
}
.trade-merchant-wrap { position: absolute; top: -15px; transform: translateX(-50%); transition: left 0.35s ease; }
.trade-merchant { display: block; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.75)); }
.trade-merchant.walking { animation: merchantWalk 0.4s ease-in-out infinite alternate; }
@keyframes merchantWalk { from { transform: translateY(0) rotate(-5deg); } to { transform: translateY(-3px) rotate(5deg); } }
.trade-route-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; font-size: 10px; }
.biome-tag { padding: 2px 8px; border-radius: 8px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase; }
.biome-tag--0 { background: rgba(249,115,22,0.88); color: #230E05; }
.biome-tag--1 { background: rgba(220,140,60,0.92); color: #2b1607; }
.biome-tag--2 { background: rgba(168,85,247,0.92); color: #FFFBEB; }
.trade-route-best { color: rgba(255,248,231,0.8); font-weight: 700; }

/* The trade bar pushes the classic HUD rows down */
.hud-top-bar { top: 62px; }
.weight-meter { top: 64px; }
.anansi-meter { top: 80px; }
.hud-pause-btn { top: 132px; }
.harmattan-badge { top: 200px; }

/* ===== Griot's Praise Combo badges ===== */
.griot-row { position: absolute; top: 168px; left: 12px; z-index: 16; pointer-events: none; display: flex; flex-direction: column; gap: 6px; }
.griot-badge { display: flex; align-items: center; gap: 8px; background: rgba(44,26,14,0.92); border: 2px solid var(--saffron); border-radius: 12px; padding: 4px 10px; }
.griot-badge.tier-1 { border-color: #FBBF24; box-shadow: 0 0 10px rgba(251,191,36,0.5); }
.griot-badge.tier-2 { border-color: #FB923C; box-shadow: 0 0 12px rgba(251,146,60,0.6); }
.griot-badge.tier-3 { border-color: #A855F7; box-shadow: 0 0 16px rgba(168,85,247,0.8); }
.griot-streak { font-size: 20px; font-weight: 800; color: var(--saffron); min-width: 26px; text-align: center; }
.griot-info { display: flex; flex-direction: column; line-height: 1.15; }
.griot-info b { font-size: 12px; color: var(--parchment); }
.griot-info i { font-size: 10px; font-style: normal; color: var(--saffron); }
.buff-badge { font-size: 11px; font-weight: 800; letter-spacing: 0.5px; padding: 4px 10px; border-radius: 10px; }
.buff-badge--kola { background: rgba(168,85,247,0.92); color: #ffffff; box-shadow: 0 0 12px rgba(168,85,247,0.8); }
.buff-badge--ancestral { background: rgba(251,191,36,0.95); color: #2b1607; box-shadow: 0 0 14px rgba(251,191,36,0.9); }
.tip-dot--kola { background: #A855F7; }

/* ===== Praise milestone flash ===== */
.praise-overlay { position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.praise-card {
  text-align: center; padding: 14px 26px; border-radius: 16px;
  background: rgba(35,14,5,0.74); border: 3px solid var(--saffron);
  box-shadow: 0 0 26px rgba(245,166,35,0.8);
  animation: praisePop 0.9s ease forwards;
}
.praise-title { font-size: 26px; font-weight: 800; color: #FDE047; letter-spacing: 1.5px; text-shadow: 3px 3px 0 var(--terracotta); }
.praise-sub { font-size: 13px; color: var(--parchment); letter-spacing: 1px; margin-top: 4px; }
@keyframes praisePop {
  0% { opacity: 0; transform: scale(0.6); }
  18% { opacity: 1; transform: scale(1.08); }
  32% { transform: scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.02); }
}

/* ===== Calabash Harvest — Main Menu UI/UX upgrade ===== */
.menu-screen {
  justify-content: flex-start;
  padding: 18px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  background:
    radial-gradient(circle at 22% 12%, rgba(245,166,35,0.18), transparent 42%),
    radial-gradient(circle at 80% 22%, rgba(46,125,50,0.16), transparent 44%),
    radial-gradient(circle at center, rgba(15,8,3,0.74) 0%, rgba(10,5,2,0.92) 66%, rgba(0,0,0,0.97) 100%);
}
.menu-content {
  position: relative;
  z-index: 2;
  margin: auto 0;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: popIn 0.5s ease;
}

/* Floating brand header */
.menu-logo { text-align: center; margin-bottom: 2px; animation: float-sway 3s ease-in-out infinite; }
.menu-title {
  font-size: 46px;
  line-height: 1.05;
  margin: 0;
  color: var(--saffron);
  text-shadow: 4px 4px 0 var(--terracotta), 0 6px 14px rgba(0,0,0,0.55), 0 0 30px rgba(245,166,35,0.35);
  letter-spacing: 2px;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.4));
}
.menu-subtitle { font-size: 14px; color: var(--parchment); margin: 6px 0 0; letter-spacing: 0.8px; opacity: 0.9; }

/* Frosted glass stats pill */
.menu-stats-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid rgba(249,115,22,0.22);
  box-shadow: inset 0 1px 6px rgba(0,0,0,0.5);
  color: #fed7aa;
}
.stat-chip { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.stat-label { text-transform: uppercase; letter-spacing: 0.6px; opacity: 0.8; font-size: 10px; }
.stat-chip b { font-size: 15px; color: var(--saffron); }
.stat-divider { width: 1px; height: 18px; background: rgba(249,115,22,0.35); }

/* Pulsating call-to-action */
.menu-cta-wrap {
  width: 100%;
  max-width: 300px;
  border-radius: 999px;
  animation: pulse-glow 2.2s ease-in-out infinite;
}
.menu-cta-wrap .btn--play {
  margin: 0;
  background: linear-gradient(90deg, #F59E0B, #EA580C);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.menu-cta-wrap .btn--play:active { transform: scale(0.95); }
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 12px rgba(249,115,22,0.45); }
  50% { box-shadow: 0 0 26px rgba(249,115,22,0.9); }
}

/* Glassmorphism cards */
.menu-card {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 12px 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 18px 30px rgba(0,0,0,0.45);
  text-align: left;
}
.menu-card-title { margin: 0 0 8px; font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--saffron); opacity: 0.95; }
.item-grid { display: flex; flex-direction: column; gap: 8px; }
.item-row { display: flex; align-items: center; gap: 10px; text-align: left; }
.item-ico { width: 26px; height: 26px; flex-shrink: 0; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.6)); animation: item-shimmer 3.2s ease-in-out infinite; }
.item-row:nth-child(2) .item-ico { animation-delay: 0.4s; }
.item-row:nth-child(3) .item-ico { animation-delay: 0.8s; }
.item-row:nth-child(4) .item-ico { animation-delay: 1.2s; }
.item-name { font-size: 13px; font-weight: 700; color: var(--parchment); min-width: 118px; }
.item-desc { font-size: 11.5px; opacity: 0.78; line-height: 1.25; }
@keyframes item-shimmer {
  0%, 100% { transform: translateY(0) rotate(0deg) scale(1); }
  50% { transform: translateY(-2px) rotate(-4deg) scale(1.06); }
}

/* Trade route stepper */
.route-stepper { position: relative; display: flex; justify-content: space-between; padding-top: 4px; }
.route-stepper::before {
  content: '';
  position: absolute;
  top: 11px;
  left: 16px;
  right: 16px;
  border-top: 2px dashed rgba(245,166,35,0.45);
}
.route-node { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.route-dot { width: 14px; height: 14px; border-radius: 50%; background: #2C1A0E; border: 2px solid var(--saffron); animation: route-glow 2s ease-in-out infinite; }
.route-node:nth-child(2) .route-dot { animation-delay: 0.5s; }
.route-node:nth-child(3) .route-dot { animation-delay: 1s; }
.route-dot.gold { border-color: #D8B4FE; box-shadow: 0 0 12px rgba(168,85,247,0.85); }
.route-dist { font-size: 11px; font-weight: 800; color: var(--saffron); }
.route-name { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.4px; opacity: 0.82; text-align: center; line-height: 1.2; }
@keyframes route-glow {
  0%, 100% { box-shadow: 0 0 6px rgba(245,166,35,0.5); }
  50% { box-shadow: 0 0 16px rgba(245,166,35,1); }
}

/* Control / banking hint chips */
.menu-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chip { font-size: 11px; padding: 5px 12px; border-radius: 999px; background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.14); color: var(--parchment); opacity: 0.9; }

/* Corner market baskets */
.menu-baskets { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.basket {
  position: absolute;
  bottom: 8px;
  width: 92px;
  height: 92px;
  opacity: 0.5;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,0.6));
  transform-origin: bottom center;
  animation: basket-rock 2.4s ease-in-out infinite alternate;
}
.basket--left { left: 6px; }
.basket--right { right: 6px; animation-direction: alternate-reverse; }
@keyframes basket-rock {
  from { transform: rotate(-6deg); }
  to { transform: rotate(6deg); }
}
@keyframes float-sway {
  0%, 100% { transform: translateY(0) rotate(-0.6deg); }
  50% { transform: translateY(-8px) rotate(0.6deg); }
}

/* Small-phone fit */
@media (max-width: 400px) {
  .menu-title { font-size: 38px; letter-spacing: 1px; }
  .menu-subtitle { font-size: 12.5px; }
  .basket { width: 72px; height: 72px; opacity: 0.38; }
  .item-name { min-width: 100px; font-size: 12px; }
  .item-desc { font-size: 10.5px; }
}
@media (max-height: 740px) {
  .menu-title { font-size: 38px; }
  .menu-content { gap: 9px; }
  .menu-card { padding: 10px 12px; }
  .menu-hint { margin-top: 8px; }
}

/* ===== Now Playing: Track 1 "The March of Mbaku" (Main Menu Theme) ===== */
.now-playing {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px auto 4px;
  max-width: 380px;
  padding: 8px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(44, 26, 14, 0.92), rgba(20, 12, 8, 0.92));
  border: 1px solid rgba(217, 83, 30, 0.5);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(245, 166, 35, 0.12);
  text-align: left;
  pointer-events: none;
}
.now-playing.live { border-color: rgba(245, 166, 35, 0.78); }

/* ===== Now Playing: Track 4 "Fortress Activation" (Mbaku Bastion golden climax) ===== */
.now-playing.fortress {
  background: linear-gradient(135deg, rgba(74, 48, 8, 0.95), rgba(30, 18, 4, 0.95));
  border-color: rgba(250, 204, 21, 0.85);
  box-shadow: 0 4px 18px rgba(250, 204, 21, 0.28), inset 0 1px 0 rgba(253, 224, 71, 0.28);
}
.now-playing.fortress .np-label { color: #fde68a; }
.now-playing.fortress .np-title { color: #fef3c7; }
.now-playing.fortress .np-eq i { background: #facc15; }
.np-eq { display: flex; align-items: flex-end; gap: 2px; height: 22px; width: 20px; flex: 0 0 auto; }
.np-eq i {
  display: block;
  width: 3px;
  height: 6px;
  border-radius: 2px;
  background: var(--saffron);
  opacity: 0.5;
}
.now-playing.live .np-eq i { animation: np-bar 0.85s ease-in-out infinite; opacity: 1; }
.now-playing.live .np-eq i:nth-child(1) { animation-delay: 0s; }
.now-playing.live .np-eq i:nth-child(2) { animation-delay: 0.16s; }
.now-playing.live .np-eq i:nth-child(3) { animation-delay: 0.32s; }
.now-playing.live .np-eq i:nth-child(4) { animation-delay: 0.48s; }
@keyframes np-bar {
  0%, 100% { height: 5px; }
  50% { height: 20px; }
}
.np-info { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.np-label { font-size: 9.5px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--saffron); opacity: 0.92; }
.np-title { font-size: 15px; color: var(--parchment); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-sub { font-size: 10.5px; color: rgba(255, 248, 231, 0.62); }
@media (max-width: 400px) {
  .now-playing { max-width: 300px; padding: 7px 11px; }
  .np-title { font-size: 13.5px; }
}

/* ===== Global audio toggle (Menu + HUD), 52px touch target ===== */
.audio-toggle-btn {
  position: fixed;
  bottom: 16px;
  left: 14px;
  z-index: 40;
  width: 52px;
  height: 52px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid rgba(245, 166, 35, 0.6);
  background: rgba(30, 19, 11, 0.85);
  color: var(--parchment);
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.audio-toggle-btn:hover { transform: scale(1.06); background: rgba(217, 83, 30, 0.32); }
.audio-toggle-btn:active { transform: scale(0.94); }
.audio-toggle-btn:focus-visible { outline: 2px solid var(--saffron); outline-offset: 2px; }
.audio-toggle-btn.is-muted { color: rgba(255, 248, 231, 0.62); border-color: rgba(255, 248, 231, 0.3); }